Repository navigation
Keep characters above U+FFFF whole when wrapping text - #1880
Open
ravitejas-tech wants to merge 2 commits into
Open
ravitejas-tech wants to merge 2 commits into
ravitejas-tech wants to merge 2 commits into
Conversation
A character above U+FFFF, such as an emoji or U+24256, is two UTF-16 code units. The line wrapper moved one code unit at a time when it split a word wider than the line and when it shortened a line for the ellipsis, so it could cut such a character in half. Both halves were then drawn as missing glyphs. This happens when half a character measures narrower than a whole one: with a font whose .notdef is narrower than its glyphs, or with characterSpacing, which counts code units. The wrapper now steps over a surrogate pair as one character.
…characters # Conflicts: # CHANGELOG.md
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Bug fix. Related to #1565.
A character above U+FFFF, such as an emoji or U+24256, is two UTF-16 code units.
LineWrappermoved one code unit at a time when it split a word wider than the line and when it shortened a line to make room for the ellipsis, so it could cut such a character in half. Both halves were then drawn as missing glyphs.It shows when half a character measures narrower than a whole one: with
characterSpacing, which counts code units, or with a font whose.notdefis narrower than its glyphs. With the font from #1565 (Chocolate Classical Sans):Before, some lines ended with half a character and the next line started with the other half, both drawn as missing glyphs. The wrapper now steps over a surrogate pair as one character. Grapheme clusters can still be split, as the existing TODO says.
Checklist:
The two new
LineWrappertests wrap with Roboto at every width from 20 to 120 and fail without the change.