Skip to content

Hebrew text is not properly vertically aligned  #27033

Closed

Description

@jossef

My app's layout is RTL. When I'm using Hebrew text the bounding box increases and the text slightly top-padded which makes things hard to vertically align center.

Example without Hebrew:

    Row(
      children: [
        Container(
          color: Colors.red,
          width: 24,
          height: 24,
        ),
        Container(
          color: Colors.red,
          child: Text("world"),
        ),
        Container(
          color: Colors.yellow,
          child: Text("hello"),
        ),
      ],
    );

image


Example with Hebrew:

    Row(
      children: [
        Container(
          color: Colors.red,
          width: 24,
          height: 24,
        ),
        Container(
          color: Colors.red,
          child: Text("כככ"),
        ),
        Container(
          color: Colors.yellow,
          child: Text("hello"),
        ),
      ],
    );

image

Activity

  1. zoechi commented on Jan 24, 2019

    @zoechi
    Contributor

    Please add the output of flutter doctor -v.

    Please also check if this is still the same in master channel

    flutter channel master
    flutter doctor
    
  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 24, 2019
  3. zoechi commented on Jan 24, 2019

    @zoechi
    Contributor

    Might be #24317
    @GaryQian ?

  4. jossef commented on Jan 24, 2019

    @jossef
    Author

    @zoechi

    Please add the output of flutter doctor -v.

    Please also check if this is still the same in master channel

    flutter channel master
    flutter doctor
    
    [✓] Flutter (Channel stable, v1.0.0, on Linux, locale en_US.UTF-8)
        • Flutter version 1.0.0 at /opt/flutter
        • Framework revision 5391447fae (8 weeks ago), 2018-11-29 19:41:26 -0800
        • Engine revision 7375a0f414
        • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
    
    [!] Android toolchain - develop for Android devices (Android SDK 28.0.3)
        • Android SDK at /opt/android-sdk
        • Android NDK location not configured (optional; useful for native profiling
          support)
        • Platform android-28, build-tools 28.0.3
        • ANDROID_HOME = /opt/android-sdk
        • Java binary at: /opt/android-studio/jre/bin/java
        • Java version OpenJDK Runtime Environment (build
          1.8.0_152-release-1136-b06)
        ! Some Android licenses not accepted.  To resolve this, run: flutter doctor
          --android-licenses
    
    [✓] Android Studio (version 3.2)
        • Android Studio at /opt/android-studio
        • Flutter plugin version 29.1.1
        • Dart plugin version 181.5656
        • Java version OpenJDK Runtime Environment (build
          1.8.0_152-release-1136-b06)
    
    [✓] VS Code (version 1.29.1)
        • VS Code at /usr/share/code
        • Flutter extension version 2.21.1
    
    [✓] Connected device (1 available)
        • Moto G 5 Plus • ZY224322QC • android-arm • Android 8.1.0 (API 27)
    
    ! Doctor found issues in 1 category.
    

    same results on the master branch.

  5. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jan 24, 2019
  6. added
    engineflutter/engine related. See also e: labels.
    a: typographyText rendering, possibly libtxt
    on Jan 24, 2019
  7. added this to the milestone on Jan 24, 2019
  8. cbracken commented on Apr 8, 2019

    @cbracken
    Member

    /cc @GaryQian can you confirm if this is a dupe of #24317?

  9. tigrenok00 commented on Jul 25, 2019

    @tigrenok00

    Following, still happens (Hebrew)

  10. jossef commented on Jul 27, 2019

    @jossef
    Author

    haven't checked but worth trying using a customized font with a fixed character size

  11. changed the title [-]typography - Hebrew text is not properly vertically aligned [/-] [+]Hebrew text is not properly vertically aligned [/+] on Apr 29, 2020
  12. added
    P2Important issues not at the top of the work list
    on May 29, 2020
  13. removed this from the milestone on Aug 17, 2020
  14. 8 remaining items

  15. GaryQian commented on Nov 29, 2022

    @GaryQian
    Contributor

    cc @Rusino @jason-simmons This bug has persisted through the SkParagraph switch

  16. Rusino commented on Feb 13, 2024

    @Rusino
    Contributor

    To understand whether it's a bug or a correct behavior I need to know how Flutter does vertical alignment.
    For instance, do we have two different paragraphs, once for "Hello" and another for "Hello"? Or it's a single paragraph with two different runs misaligned? I don't think it's the second case and I can't fix the first one - it depends on the font metrics unless you make a special efforts to align baselines for both paragraphs.

  17. GaryQian commented on Feb 14, 2024

    @GaryQian
    Contributor

    It would be the first case, two separate runs being aligned together by Flutter layout rather in the text layout.

  18. Rusino commented on Feb 14, 2024

    @Rusino
    Contributor

    As I said I am not sure if these two runs belong to the same paragraph or not.
    Can you confirm that?

  19. gnprice commented on Feb 17, 2024

    @gnprice
    Member

    Looking at the original example code, there are two separate Text widgets for the two fragments of text, so as a result there will be two different paragraphs sent to SkParagraph.

    As @LongCatIsLooong pointed out on a related issue at #120862 (comment), Row centers its children by default. And looking back at the screenshots in the original report above, one of them illustrates quite nicely that the boxes are indeed each being centered:
    image

    If the children contain text and you want the text to look aligned, then you want to pass CrossAxisAlignment.baseline instead.

    It does seem like the docs could better signpost the situations when one wants CrossAxisAlignment.baseline instead of the default, given the number of people (including me last March) who interacted with either #120862 or this issue and didn't make that connection. I'll see if I can write up a quick docs PR.

  20. added
    r: fixedIssue is closed as already fixed in a newer version
    on Feb 21, 2024
  21. github-actions commented on Mar 6, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  22. locked as resolved and limited conversation to collaborators on Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: internationalizationSupporting other languages or locales. (aka i18n)a: typographyText rendering, possibly libtxtengineflutter/engine related. See also e: labels.found in release: 3.3Found to occur in 3.3found in release: 3.6Found to occur in 3.6has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions