Skip to content

fix(viewer): space banner glyphs by whole-pixel cluster advances - #461

Merged
ElbertePlinio merged 5 commits into
mainfrom
fix/450-banner-mark-gaps
Oct 29, 2026
Merged

ElbertePlinio merged 5 commits into
mainfrom
fix/450-banner-mark-gaps

Conversation

@ElbertePlinio

Copy link
Copy Markdown
Member

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 e and é 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 plain e all showed the gaps.

shape_run now 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

Requirement Verification Scenario and edge cases Result Evidence
Find the cause and draw a long decomposed word without gaps Probe of glyph widths and advances; a_long_word_draws_with_even_spacing draws 80 decomposed é at 12 px and checks that no ink column inside the word is empty; QA banner with 150 decomposed é Decomposed and precomposed é; 12, 18 and 24 px Pass; the test fails on main with 7.032 px steps, and the main banner 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.png
Test the advances of a long run with marks The same test checks equal whole-pixel steps over 80 clusters, and that marks add no width 12, 18, 24 px for the steps; 12, 24, 36 px for two stacked marks Pass; fails on main ~/.pickforge/investigations/450/before.txt, r2-before.txt, r3/tests.txt
A mark keeps its place on its base a_mark_keeps_its_place_on_its_base compares the mark's offset from its base with the shaper's own placement 12, 18, 26 and 36 px Pass; fails on the second revision, which rounded every glyph ~/.pickforge/investigations/450/r3/before.txt, r3/tests.txt
Other text does not regress qa.sh on a private Xvfb: banners in English, Arabic and CJK, and thumbnail labels for café, Arabic and CJK project names main, the first fix and the final revision The banners of the final revision match the reviewed screenshots pixel for pixel; the labels differ only in the random session id ~/.pickforge/investigations/450/qa.sh, qa-before/, qa-after/, qa-r3/, compare-banners-2.png
Full suite full-suite.sh build, lint, typecheck, viewer build, vitest, cargo All steps pass at c446748: vitest 3529 passed, 4 skipped; cargo 355 passed ~/.pickforge/investigations/450/full/
PickCheck and secret scan pickcheck check --base origin/main --fail-on new,worsened,unmatched; gitleaks on the branch commits 10 files checked 0 violations; no leaks ~/.pickforge/investigations/450/pickcheck.json

Review

Reviewer Revision Score Result
Fable c3ee04e 8 Two nits: a test had split a doc comment from its function, and zero-advance marks still took tracking. Both fixed in 0557f7e.
Sol 0557f7e 7 Rounding each glyph moved a mark one pixel against its base. Fixed in c446748 by rounding per cluster.
Sol c446748 9 No findings.

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.
@ElbertePlinio
ElbertePlinio merged commit 1bad124 into main Oct 29, 2026
10 checks passed
@ElbertePlinio
ElbertePlinio deleted the fix/450-banner-mark-gaps branch October 29, 2026 21:39
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.

viewer: a long word of decomposed Latin text draws gaps in the banner

1 participant