Repository navigation
fix(pptx): name the carried face whose program states another family - #1069
Merged
Merged
Conversation
A presentation matches an embedded face to the family a deck declares by the family the program states for itself — `name` id 1 — and not by the names its container carries. Where the two differ, the runs laid out in that face are not drawn from it, and nothing said so. Measured in PowerPoint 16, one deck per run, a 45-character line at 20pt, with neither family installed: a deck declaring `Asap Condensed` and carrying the bundled `AsapCondensed-Italic`, whose own record reads `Asap Condensed Condensed Regular`, had that paragraph drawn in Arial Italic at 566.51pt where the program itself draws 443.96pt, while the same deck's regular paragraph came out at 442.92pt against 443.14pt. Rewriting that one record to the declared name had the program drawn at 443.65pt; rewriting it to the string it already held changed nothing, so neither the rewriting nor the stale checksums it leaves were what the viewer went by. Declaring the family as the italic states it drew that program for both paragraphs and left the regular face unused, so for a family whose faces disagree in that record no single declared name serves them all. What the mismatch costs differs, and both halves were measured: that face was not drawn at all, while `Oswald-SemiBold`, which a preset here pairs under `Oswald`, was drawn and then weighted again — 480.10pt where the program draws 469.70pt. So `render.pptx.font.undrawn` names both families and the face's own source and leaves the outcome to the reader. It claims nothing about whether the family travels either: a later face of it can still collide or fail to be read, and those have their own lines. Nothing is refused, the program travels as the caller asked, and no deck's bytes change. The comparison is on id 1 and not on the typographic family the DOCX backend prefers, which would answer the declared name for the very face a presentation refuses and silence the `Oswald` pair as well; a sabotage holds that. The reading is pinned to the Windows en-US record, the one the measurement read, and a face stating id 1 only elsewhere is left unsaid. The condition is not confined to a mis-built file: the declared name is `wordFamily()` and defaults to whatever a family was registered under, so the font-coverage page now tells a caller to declare the name their files state. A sweep over the bundled catalogue keeps the count the documents quote honest.
The line said the runs laid out in such a face "are not drawn from it", and its key said `undrawn`. One of the two measured arms refutes that: `Oswald-SemiBold` under `Oswald` was drawn from the program and then weighted again by the viewer. The key is now `render.pptx.font.name.mismatch`, which names the condition the export tests, and the line says the runs are not reached the way the page laid them out — true of a substituted face and of a re-weighted one. The CHANGELOG headline, the capability details, the font-coverage page and the test class carried the same claim and no longer do. The line also presupposed runs that need not exist: a registered family is read before a slide is drawn, so all four of its faces are read whether or not the deck sets text in them. It says "any runs" now, as the substitution line beside it does. `statedFamilyOf`'s javadoc said the header read keeps no record it needs, which is wrong and contradicted the same file's account of that predicate: the header read does keep the family record, but `FontHeaders` exposes only fontbox's own English-name pick and not the record itself. It now says that, and the parse is asked to take an embedded font so a face missing a table a standalone one must have is read here as the embedder reads it — which also makes the unreadable branch below it reachable. The name is trimmed, as the name a family declares already is, so a trailing space in a file cannot pass for another family. `wrap` takes the bytes a caller already holds, which the embedder does: it reads each face once to ask what family the program states, and the stream overload would have copied every face a second time. The capability matrix cell and its details entry move from ✅ to⚠️ together: the row now names a deviation, and the legend reserves ✅ for a backend whose details name none. The documentation guard requires the two marks to agree. `docs/troubleshooting.md` gains the symptom a caller searches for — Arial where the deck embeds a font.
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.
Why
A PPTX deck carries an embedded face in a container and declares the family on
p:embeddedFont.A presentation matches the carried face to that declared family by the family the program
states for itself —
nameid 1 — and not by the names the container carries. Where the twodiffer, the runs laid out in that face are not reached the way the page laid them out, and nothing
said so.
Measured in PowerPoint 16, one deck per run, a 45-character line at 20pt, with neither family
installed on the machine. The engine's own render of those two faces is 443.14pt regular and
443.96pt italic:
Asap Condensed Condensed RegularAsap CondensedAsap CondensedAsap CondensedAsap CondensedAsap Condensed Condensed RegularAsap Condensed Condensed RegularThe second row is the control that makes the third a proof rather than a coincidence: the rewriter
appends a name table and leaves the table directory's checksums stale, and rewriting the record to
the string it already held changed nothing, so neither the rewriting nor the checksums are what the
viewer went by. The fourth row is the same finding from the other side — declaring the name the
italic states draws that program for both paragraphs and leaves the regular face unused, so for a
family whose faces disagree in that record no single declared name serves them all. The container's
own name fields were varied in the previous change and altered nothing PowerPoint drew, which is
why they are not the key.
What the mismatch costs differs, and both halves are measured. The face above was not drawn at all.
Oswald-SemiBold, which theOrangeOpspreset here pairs underOswaldand whose own recordreads
Oswald SemiBold, was drawn and then weighted again by the viewer — 480.10pt where theprogram itself draws 469.70pt. So the condition predicts trouble without predicting which.
What changed
PptxEmbeddedFont.statedFamilyOfreads the family a program states for itself, pinned to theWindows en-US record because that is the record the measurement read; a face stating id 1 only
elsewhere answers null and is left unsaid, which is the safe direction for a warning.
PptxRenderEnvironment.readProgramscompares it with the declared typeface and logsrender.pptx.font.name.mismatchwith both families and the face's own source. The key names thecondition and the line names no outcome, because the two measured outcomes differ. Deliberately
on id 1
and not on the typographic family (id 16) the DOCX backend prefers: that answers the declared
name for the very face a presentation refuses, and would silence the
Oswaldpair as well. Asabotage holds that choice.
face of it can still collide or fail to be read, and those have their own lines. Nothing is
refused here: the program travels as the caller asked and no deck's bytes change.
its log-key list, in the capability matrix row, and on the font-coverage page — which now also
says the thing a caller needs: declare a family under the name its files state, since the
declared name is
wordFamily()and defaults to whatever the family was registered under, anddocs/troubleshooting.mdanswers the symptom a caller searches for. The capability matrix cell and itsdetails entry move from ✅ to
details name a deviation — the documentation guard in
qarequires the two marks to agree, andcaught the first attempt that moved only the matrix.
Verification
./mvnw -B -ntp clean test -pl :graph-compose-render-pptx -am— 188 tests, none skipped.PptxFontNameMismatchTestholds 4: the reading itself against four real files, the warning readoff both the artefact (both faces travel — this is not a refusal) and the log, silence for a family
whose every face states the declared name, and a sweep of the bundled catalogue asserting that
exactly one bundled face differs, which is the count the two documents quote and which a font bump
would otherwise falsify silently.
Two sabotages, each turning exactly one case red (
tests=1 failures=1) with both sourcesbyte-identical afterwards: warning about a face that states the declared name turns the silent case
red, and reading id 16 where the viewer matches on id 1 turns the warning case red.
The 105-document DOCX corpus, exported from this head and from
develop:unchanged— 105documents byte-identical, with the same 1718 report notes, none added and none removed. The change
is on the PPTX path and in the log, so it could not reach a DOCX byte; the export is reported
because the claim is cheap to check.
The full reactor gate ran on this branch's final head:
GATE PASS— core, the three renderbackends, templates, testing, qa and coverage, the four knowledge-pack checks, core javadoc, then
the install and the examples suite (93 tests). No example deck draws the new line: the two presets
that use that family render to PDF and DOCX, and the one bundled face it names is embedded by no
example deck.