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

Vary grapheme baselines by script #2

Draft
wants to merge 11 commits into
base: complex-text-50
Choose a base branch
from
Draft

Vary grapheme baselines by script #2

wants to merge 11 commits into from

Conversation

1ec5
Copy link
Owner

@1ec5 1ec5 commented Aug 23, 2024

Even when text-offset and text-letter-spacing are both 0, there is a slight gap in the top line between each grapheme, depending on the angle of the line at the grapheme boundary: maplibre/maplibre-native#778 (comment). This change shifts graphemes in northern Brahmic scripts downward according to a hanging baseline instead of an alphabetic baseline, closing the gap.

Before After
All text with a consistent baseline. Latin and Telugu with a baseline much higher than Devanagari.

Depends on #1 and 1ec5/tiny-sdf#2.

1ec5 added 10 commits August 27, 2024 09:31
If a grapheme cluster begins with a combining diacritical mark or ends with an invisible stacker, combine it with an adjacent grapheme cluster to avoid drawing diacritics over dotted circles or placeholder diacritics where adjacent characters should be ligated instead.
Added a script that fetches the latest Unicode character database’s property file for Indic syllable categories and generates a function for combining graphemes based on it.
Replace zero-width joiners with temporary strip markers to prevent ICU from stripping them.
Preemptively swap combining marks with the characters they modify to visual order, so that the RTL plugin will swap them back to logical order.
Replaced custom word break heuristics when determining line breaks with a word segmenter. Added a simple polyfill for older versions of Firefox.
Fixed an issue where vertical CJK text was shifted upwards by one em.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant