Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick "LibWeb: Iterate over text chunks using a grapheme-aware segmenter" #25490

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nico
Copy link
Contributor

@nico nico commented Nov 27, 2024

Our current text iterator is not aware of multi-code point graphemes. Instead of simply incrementing an iterator one code point at a time, use our Unicode grapheme segmenter to break text into fragments.

(cherry picked from commit f0105b473b9cc3446ec36359b559db9a8e78446d; amended as usual for Unicode::Segmenter -> Locale::Segmenter, and to tweak expected/multi-code-point-graphemes.txt for serenity's superior emoji glyphs)


LadybirdBrowser/ladybird#1465, second commit. (Don't need the first, already have a predictable emoji font.)
LadybirdBrowser/ladybird#1702

Less dramatic for us than upstream. Before:

Screenshot 2024-11-26 at 7 59 14 PM

After:

Screenshot 2024-11-26 at 7 59 26 PM

Our current text iterator is not aware of multi-code point graphemes.
Instead of simply incrementing an iterator one code point at a time, use
our Unicode grapheme segmenter to break text into fragments.

(cherry picked from commit f0105b473b9cc3446ec36359b559db9a8e78446d;
amended as usual for Unicode::Segmenter -> Locale::Segmenter, and to
tweak expected/multi-code-point-graphemes.txt for serenity's superior
emoji glyphs)
@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Nov 27, 2024
@nico nico changed the title Cherry-pick "LibWeb: Iterate over text chunks using a grapheme-aware segmenter" Cherry-pick "LibWeb: Iterate over text chunks using a grapheme-aware segmenter" + follow-up fix Nov 27, 2024
@nico nico force-pushed the pr-1465 branch 2 times, most recently from 28e4091 to 7d85d03 Compare November 27, 2024 01:22
@nico nico changed the title Cherry-pick "LibWeb: Iterate over text chunks using a grapheme-aware segmenter" + follow-up fix Cherry-pick "LibWeb: Iterate over text chunks using a grapheme-aware segmenter" Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 pr-needs-review PR needs review from a maintainer or community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants