Skip to content

libtxt: Text metrics are sometimes wrong (in different ways on different platforms at different sizes) #12357

@gspencergoog

Description

@gspencergoog

When the textScaleFactor in a RenderParagraph is not 1.0, or the font size is particular sizes (even without scaling) the Linux tests render, or at least measure, widths that are different than the same tests on Mac. When they are off, they appear to be exactly one pixel off, and only in width.

Mac: fontSize: 10.0, textScaleFactor: 1.3 --> 13.0 wide
Linux: fontSize: 10.0, textScaleFactor: 1.3 --> 14.0 wide

Mac: fontSize: 123.0, textScaleFactor: 1.3 --> 160.0 wide
Linux: fontSize: 123.0, textScaleFactor: 1.3 --> 161.0 wide

Mac: fontSize: 100.0, textScaleFactor: 2.0 --> 200.0 wide
Linux: fontSize: 100.0, textScaleFactor: 2.0 --> 201.0 wide

BUT:
Mac: fontSize: 200.0, textScaleFactor: 2.0 --> 400.0 wide
Linux: fontSize: 200.0, textScaleFactor: 2.0 --> 400.0 wide

So it's not ALL the time, for all scales/font sizes. This suggests some subtle difference in font rendering on one/both platforms.

Since Blink-based text rendering is being replaced, re-evaluate this bug once that has completed.

Some tests affected by this:

test/painting/text_painter_test.dart
test/widgets/text_test.dart
test/rendering/paragraph_test.dart

There is a TODO(#12357) in paragraph_test.dart that marks where the test should have the anyOf converted to a single value once this issue is fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: typographyText rendering, possibly libtxtengineflutter/engine related. See also e: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions