Skip to content

fix(html): the underline and the squiggle sit under the text - #914

Merged
andiwand merged 2 commits into
mainfrom
fix/the-underline-sits-under-the-text
Sep 20, 2026
Merged

andiwand merged 2 commits into
mainfrom
fix/the-underline-sits-under-the-text

Conversation

@andiwand

@andiwand andiwand commented Sep 20, 2026

Copy link
Copy Markdown
Member

Reported from the app: the two features that mark under text overlap the text instead. Rebased onto main now that #913 has landed, which is what makes b[3] the bottom of the glyph boxes rather than the selection layer's em box.

The shapes were drawn inside the box.

mark drawn at where that is
underline b[3] - h/16b[3] the bottom sixteenth, inside the box
squiggly b[3] - h/8b[3] - h/4 an eighth to a quarter up, squarely in the text
strikeOut b[1] + h/2 the middle — correct, it is meant to cross

Both now hang off b[3] and run below it. The strike-out is untouched.

The saved file draws them too. pdf_annotation.cpp::text_markup_appearance writes an /AP appearance stream and carries its own copy of the same geometry — bar(out, c, c.bottom + height / 16, …) and a wave based at quad.bottom + amplitude. Changing only the view would have left every saved pdf with the underline still through the text, and the two renderers disagreeing. Both move together here.

Checked

  • test/browser/annotation: 70 checks, none failing, three of them new. They read the d the script writes and compare every y it names against the box, so they state the rule rather than a pixel.
  • odr_test --gtest_filter='PdfAnnotation.*': 9 tests, all passing, one of them new. It parses the appearance stream and holds every m/l/re y under the quad for the underline and the squiggle, and inside it for the strike-out.
  • Both new tests bite. Against main's appearance stream the gtest fails with 691 vs 688 — the squiggle three points up inside the text.

🤖 Generated with Claude Code

https://claude.ai/code/session_0149gFxhkvKTBQidz6brU8Vt

Base automatically changed from fix/a-mark-covers-the-text-it-marks to main September 20, 2026 10:35
`barPath` drew both inside the box: the underline in its bottom sixteenth and
the squiggle between an eighth and a quarter above the bottom. Both therefore
ran through the descenders they belong under.

They now start at `b[3]`, where the glyphs end, and run below it. A strike-out
keeps the middle of the box, which is the one that is meant to cross.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0149gFxhkvKTBQidz6brU8Vt
@andiwand
andiwand force-pushed the fix/the-underline-sits-under-the-text branch from 4cc82e4 to 5f8b520 Compare September 20, 2026 10:36
`text_markup_appearance` carries its own copy of the geometry, so the view
and the appearance stream a save writes have to move together. Both now hang
the underline and the squiggle off the bottom edge of the quad.

A gtest reads every y the stream names and holds the two under the quad, with
the strike-out inside it, which is the rule the browser checks state as well.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0149gFxhkvKTBQidz6brU8Vt
@andiwand
andiwand merged commit b9d058b into main Sep 20, 2026
27 checks passed
@andiwand
andiwand deleted the fix/the-underline-sits-under-the-text branch September 20, 2026 10:43
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