Repository navigation
fix(viewer): space banner glyphs by whole-pixel cluster advances - #461
Merged
Merged
Conversation
Glyphs draw at whole pixels, but advances were fractional. At 12 px a glyph as wide as its advance, such as e or é, left an empty column about every 31 glyphs, which showed as gaps inside a long word. Advances now round to whole pixels, so spacing is even.
Each mark glyph still took the embedded font's tracking. Rounded, it added a whole pixel per mark from 25 px up, so a marked letter stood apart. Marks now move the pen by nothing. The test also returns the glyph_ids doc comment to its function.
Rounding each glyph's advance moved a mark against its base, because the font places the mark from the fractional advance. Glyphs inside a cluster now keep their shaped places, and only the cluster's advance is rounded. A new test checks the mark against the shaper's own placement.
3 tasks
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.
Closes #450
A long word in the viewer's attention banner showed an empty column inside the word about every 31 glyphs. Glyphs draw at whole pixels, but the pen moved by fractional advances. At 12 px the embedded
eandéare 7 px wide, and their advance with tracking is 7.032 px, so about every 31st step was 8 px. Decomposedé, precomposedéand a plaineall showed the gaps.shape_runnow moves the pen by a whole-pixel advance per cluster. Inside a cluster, glyphs keep the places the shaper gave them, so a mark stays where the font puts it on its base. A cluster that advances nothing, such as a lone mark, takes no tracking.Traceability
a_long_word_draws_with_even_spacingdraws 80 decomposedéat 12 px and checks that no ink column inside the word is empty; QA banner with 150 decomposedéé; 12, 18 and 24 pxmainwith 7.032 px steps, and themainbanner shows the gaps~/.pickforge/investigations/450/cause.txt,before.txt,r3/tests.txt,qa-before/latin-banner.png,qa-r3/latin-banner.png,compare-banners-1.pngmain~/.pickforge/investigations/450/before.txt,r2-before.txt,r3/tests.txta_mark_keeps_its_place_on_its_basecompares the mark's offset from its base with the shaper's own placement~/.pickforge/investigations/450/r3/before.txt,r3/tests.txtqa.shon a private Xvfb: banners in English, Arabic and CJK, and thumbnail labels forcafé, Arabic and CJK project namesmain, the first fix and the final revision~/.pickforge/investigations/450/qa.sh,qa-before/,qa-after/,qa-r3/,compare-banners-2.pngfull-suite.sh~/.pickforge/investigations/450/full/pickcheck check --base origin/main --fail-on new,worsened,unmatched; gitleaks on the branch commits~/.pickforge/investigations/450/pickcheck.jsonReview