Skip to content

PDF export emits one link annotation per glyph for wrapped links (regression after v1.1.23; breaks Native PDF CI) #2803

Closed

Description

@lanyue-llk

Environment

Steps to reproduce

<!doctype html><style>body{margin:0;height:3600px} a{color:#174ac0}
#wrap{position:absolute;left:40px;top:100px;width:100px;line-height:30px}</style>
<div id=wrap><a href="https://links.example/wrapped">First Second</a></div>
moli fetch --resource --layout --wait-until load --dump pdf http://127.0.0.1:8000/index.html > out.pdf
uv run --no-project --with pymupdf python -c "import pymupdf,sys; d=pymupdf.open('out.pdf'); print([tuple(round(v,1) for v in l['from']) for l in d[0].get_links()])"

Expected

One link annotation per line box of the link, which is what v1.1.23 produces and what check-native-pdf.py asserts:

v1.1.23: 1 link  [(39.9, 59.3, 63.2, 63.9)]

Actual

One annotation per glyph:

main:   13 links [(39.9, 59.3, 42.5, 63.9), (42.5, 59.3, 43.8, 63.9), (43.8, 59.3, 45.3, 63.9), (45.3, 59.3, 47.1, 63.9), ...]

In CI, the same fixture embedded in the full test page produces many ~3.5 pt wide rects instead of 2.

Root cause

Not bisected yet. The change lies between v1.1.23 and cbf4d0149f. The most likely suspects are the recent inline paint and hit-test commits, which change how inline boxes and their fragments are emitted:

  • 0165b5b94c fix(layout): hit-test atomic inlines in front of wrapping inline boxes
  • c88f14e0cf, 077025be8b, 40ace558e3: atomic inline paint ordering
  • cbf4d0149f fix(layout): paint mixed inline carets without glyph runs

The PDF link extraction probably now sees one inline fragment per glyph run instead of one per line.

Impact

  • PDF exports get one link annotation per character, which makes the files larger and gives readers fragmented hit areas.
  • The "Native PDF rendering and links" CI job fails for every PR based on current main, so PRs that touch rendering cannot get a clean CI run.

Activity

  1. lanyue-llk commented on Nov 12, 2026

    @lanyue-llk
    ContributorAuthor

    Fixed on main by 05ea642 ("fix(pdf): deduplicate link regions independently of paint order"). #2771 and #2772 are being updated to current main so their "Native PDF rendering and links" job reruns and confirms it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions