-
Notifications
You must be signed in to change notification settings - Fork 6k
Paint tab characters as a single space #34389
Conversation
|
Tabs are typically rendered as multiple spaces, but it looks like this skparagraph impl always replaces with a single space. This would result in changed layouts and potentially unexpected tab behavior (one space, expecting 2 spaces), no? |
|
During text shaping, Skia’s SkPagraph converts characters into font glyphs. Most fonts don't have a glyph for
In other words, this change makes Windows consistent with iOS, Android, macOS, and Linux. See this Google internal doc on Flutter control characters for more information. I agree that drawing a |
|
The test is failing on CI |
|
FYI I changed the test as the original one failed due to differences in rendering across platforms. The new test creates 3 images: a baseline image of text containing a space, a baseline image of text containing a tofu, and a test image of text containing a tab. If then compares these three images to verify that a tab is rendered identically to a space on that platform. |
This change makes Windows render tabs as a single space. Previously, tabs rendered differently depending on your platform:
Part of flutter/flutter#79153.
Background
During text shaping, Skia’s SkPagraph converts characters into font glyphs. Most fonts don't have a glyph for
\t, so the "unknown" glyph should be selected and a tofu should be drawn. However, some platforms will override this using their own platform-specific logic and select the glyph for a single space instead. For more information, see: https://bugs.chromium.org/p/skia/issues/detail?id=12334Skia added a feature to substitute tabs with a single space so that platforms could behave consistently. This change enables this new feature on Flutter, thereby making tabs no longer render as a tofu on Windows.
Pre-launch Checklist
writing and running engine tests.
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.