Repository navigation
fix(pptx): say what a font-name mismatch costs, and what it does not - #1070
Merged
Merged
Conversation
The line `render.pptx.font.name.mismatch` named two outcomes for a face whose program states another family than the deck declares. The second was wrong. It cited `Oswald-SemiBold`, which a preset here pairs under `Oswald`, as drawn and then weighted again by the viewer — 480.10pt where that program draws 469.70pt. That deck is not drawn from the carried programs at all: the subsets PowerPoint 16 wrote into its own PDF export are the Oswald Regular and Oswald Bold of Office's cloud-font cache, glyph for glyph, and the extra 10.40pt is the difference between that family's Bold (weight 700) and the SemiBold (600) the page measured. Oswald is in no Windows font folder or font registry key on that machine, so a face being "not installed" never established that the carried program is what gets drawn. Nothing a deck can say reaches it, measured one factor at a time and each to the hundredth of a point: the container's weight field, the program's `usWeightClass`, its `fsSelection` bold bit, its `head.macStyle` bold bit, its own family record rewritten to the declared name, all four of those at once, and the run's `b` flag, which only picks the slot. A control arm recompiled the file without changing a value and drew the same, so none of that was the recompile. Declaring the family as the carried face states it is worse rather than better: that name is a local family too, and the plain paragraph then reaches 440.93pt where the page measured 405.02pt. The condition the line tests also costs nothing in two arrangements, each drawn exactly as the page laid it out under a declared name the machine has no font for: a face in the bold slot stating another family (439.86pt against 439.70pt), and an italic face of a family whose faces all state the same other name (497.95pt, from files marked to differ from any the machine holds). So the loss was measured on one arrangement only — a family whose faces state different names, where the odd face is the one replaced. The line keeps firing on the same condition, for the cleared arrangements too: a viewer may yet refuse a bold-slot face, and the line is already there if it does. It now names the condition and no outcome. Its javadoc, and the javadoc of the test class that pins it, say which arrangements were measured and that all of them needed a declared name no local font answers to, since under a name that has one the carried program decides nothing. No behaviour and no deck's bytes change. The limit itself is recorded where a caller will meet it: the PPTX font-portability entry of the backend capability details, its row in the capability matrix, a section of the font-coverage page with the arms and the numbers, and a symptom in the troubleshooting page for a deck drawn in the right family at the wrong weight. The CHANGELOG entry that carried the refuted outcome says what replaced it, and the three sentences of it that stated the condition's cost as universal now read as the measurements do. The details entry also named the sweep by a class name that a rename left behind.
A review round of this change found the first commit stating three of its own numbers more strongly than the arms support, and two places it had missed. The two cleared arrangements are now named with the condition they were measured under: a declared name no font on the measuring machine answers to. Without that clause the second figure reads as if it came from the deck declaring a cached family, which is the one case where the carried program decides nothing — and that deck does not meet the condition at all, since both its faces state the name it declares. The decomposition of the gap did not add up: 9.60pt and 0.88pt against a measured 10.40pt. Those two come from the programs' own line sums, where the cached Bold draws 450.18pt; PowerPoint drew that line at 450.10pt. The three places that carry the split now say which basis each figure is on. The capability details still offered the deck declaring a cached family as evidence about the container's name fields, where the javadoc beside it no longer does: that deck cannot answer either way, because the program it carries is not what gets drawn. The same entry called the replaced face "refused" a sentence before saying nothing is refused for it, in a document where a refusal is this backend's own act. The font-coverage page sent a caller to a measurement that does not say what the cross-reference claimed: declaring the whole family under the odd face's own name was measured costing more than it saves, while setting only that face in it was not measured at all — and on the programs' own numbers it would land the bold run 0.88pt out rather than 10.40pt. The page also called a route "measured to work" while adding a requirement to it; both forms of it were in fact measured, with the files rewritten to state the declared name and with them left stating their own, and the page now says so. It had dropped the recompile control that rules out an inert tool, and that is back. The troubleshooting page sent a reader to the next section on the strength of the log line firing, which for a family whose faces all state its declared name it does not: a cached family can be drawn whether or not the line fires, and the page says that instead. Three sentences of the entry this change corrects stated the condition's cost as universal, and its id-16 paragraph still argued from the deck whose outcome was retracted; both now read as the measurements do. The Asap premise cited the family not being "installed", which is the test this change discredits — it names the font folders, the registry keys and the cloud-font cache. The measurement prose says "element" where it means the one a deck declares a face under, which this backend keeps apart from the slot a family registers it in.
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 can carry its fonts, and
render.pptx.font.name.mismatchnames a face whose programstates a family other than the typeface the deck declares. The line named two outcomes for that
condition. The second was wrong, and the deck it cited has another cause entirely.
The cited case: the
OrangeOpsCV preset declaresOswaldand carriesOswald-Regularinp:regularandOswald-SemiBoldinp:bold. Its bold paragraph comes out 10.40pt wider than thepage measured, which the line read as the viewer adding its own weight to an already-bold program.
It is not: that deck is not drawn from the carried programs at all.
Measured in PowerPoint 16, one deck per PowerPoint instance, a 45-character line at 20pt, with
Oswald in no Windows font folder, neither font registry key, and — the thing that turned out to
matter — present in Office's cloud-font cache. Every figure below is a line width, as
PDFTextStripperreports it; the 480.10pt this item was opened on is the same bold line read as aright edge on a page whose text starts at 30pt.
The programs PowerPoint embedded in its own PDF export match the cached files
(
%LOCALAPPDATA%\Microsoft\FontCache\4\CloudFonts\Oswald) glyph for glyph, and not the carriedpair:
A=551 W=697 a=476, 22509 units over the line, id6Oswald-Bold, weight 700a=426, id6Oswald-Regulara=409)Most of the 10.40pt is the weight and a little is the build: on the programs' own numbers the
cached Bold draws 450.18, its SemiBold 440.58 and the carried SemiBold 439.70, so 9.60 of it is
Bold against SemiBold and 0.88 is the cache holding another build of the family. A cloud-font cache
is not a font folder, which is why "the font is not installed" never established that a carried
face is what gets drawn.
Nothing in a deck reaches it. Each arm below changed one thing; seven of the ten drew the bold line
at 450.10, to the hundredth:
OS/2usWeightClass600 → 700OS/2fsSelectionbold bit sethead.macStylebold bit setnameid 1 rewritten to the declaredOswaldBoldb="true"→b="false"Oswald SemiBoldThe complement, which is what makes the rest a measurement rather than a story: under a declared
name the machine has no font for, the carried programs are drawn and the page's geometry holds —
439.86 against the page's 439.70, from the same two files, identified in the subset.
While confirming that, two arrangements of the condition the line does test turned out to cost
nothing, both under a declared name no local font answers to. A face in the bold element stating
another family was drawn from the carried program (439.86 against the page's 439.70). So was an
italic face of a family whose faces all state the same other name, in a deck declaring a name
of its own: 497.95 against the page's 497.68, where the machine's cached italic of that family
draws 493.49 — the two carried files are marked in one glyph by +400 units, so no other build of
them could pass for them. The loss the line was built on remains measured on one arrangement: a
family whose faces state different names, where the odd face is the one replaced by a
substitute.
What changed
yet refuse a bold-slot face; the line is already in place if it does.
PptxEmbeddedFont.statedFamilyOf's javadoc says which arrangements were measured, that two ofthem cost nothing, and that every one of them needed a declared name no local font answers to —
under a name that has one, this record decides nothing. The
metadatajavadoc no longer offersthe
Oswalddeck as evidence about the container's fields: that deck could not have moved eitherway.
capability details and its log-key list, a new section of
docs/font-coverage.mdwith the armsand the numbers, and a new symptom in
docs/troubleshooting.md— the right family at the wrongweight — which says plainly that no field in the deck and no line in the log can reach it,
because an export cannot know what the viewing machine has.
has an entry of its own.
PptxUndrawnFaceWarningTest);it is
PptxFontNameMismatchTest.about: there is no signal an export could key such a warning on.
Verification
./mvnw -B -ntp test -pl :graph-compose-render-pptx -am— 188 tests, none skipped, the same fourin
PptxFontNameMismatchTest. The line's text changed and no test asserted the refuted phrase, sonothing in the suite had to be rewritten to keep passing — which is also why this change adds no
test: the measured facts are a viewer's, and an export cannot observe them. What that leaves
unguarded is worth saying plainly: nothing pins that the line names no outcome, and no guard reads
the three documents that now carry these numbers, so a regression here would look exactly like the
state this PR found.
The documentation guards in
⚠️
qa: 74 tests over two runs, includingDocxCapabilityMatrixGuardTest(14 — the matrix cell and its details entry already carry thethis entry needs),
DocsBoldFaceGuardTest,DocumentationExamplesTestandDocumentationSnippetCompileTest.Both sabotages from the change that added the line, re-run against this tree, each turning exactly
one case red (
tests=1 failures=1) with both sources byte-identical afterwards: warning about aface that states the declared name turns the silent case red, and reading the typographic family
(id 16) where the viewer matches on id 1 turns the named case red.
The 105-document DOCX corpus, exported from this branch and from
develop:unchanged— everydocument byte-identical with the same 1718 report notes. The change is prose and one log string on
the PPTX path, so it could not reach a DOCX byte; the export is reported because the claim is cheap
to check.
The full reactor gate on the final head:
GATE PASS.