Skip to content

fix(pptx): say no face of a font travels where none did - #1088

Merged
DemchaAV merged 3 commits into
developfrom
fix/pptx-say-when-no-face-travels
Nov 26, 2026
Merged

DemchaAV merged 3 commits into
developfrom
fix/pptx-say-when-no-face-travels

Conversation

@DemchaAV

@DemchaAV DemchaAV commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Why

A registered or bundled family the PPTX deck could not carry was told
render.pptx.font.substitution family=X — could not be embedded, so "X" is not carried whole; ….
That wording is for a deck holding part of the family, and PptxDeckFonts could not choose
another: PptxFontEmbedder.embedFontFamily answered a boolean and embedFontFamilyWithMetrics
a nullable metrics object, so "nothing of the family travelled" and "the presentation kept part
of it" arrived as the same answer.

Every refusal a font can provoke arrives before the presentation is handed a face — a face that
cannot be read, licence bits that forbid embedding, a header the presentation could not read back,
two of the family's faces reading back as one style slot, a face arriving into a slot another
family holds, and on the registered path the viewer metrics. In each of them nothing of the family
is in the deck, so the hedge was always the weaker claim. The one refusal left after the hand-over
starts is POI's part store: the presentation's first read of a face, FontHeader.bufferInit, reads
only the container's header, which PptxEmbeddedFont has already measured against it. (A family
whose declared name another registered family carries a face under is told its text is drawn from
that program, whatever refused it, and keeps that line.)

What changed

  • PptxFontEmbedder.Carried (WHOLE, NONE, PART) and PptxFontEmbedder.Embedding(carried, metrics), both package-private. NONE where the family is refused before the hand-over; PART
    where handOverPrograms fails after the presentation was handed the family, which only POI's own
    part store can do.
  • PptxDeckFonts writes could not be embedded, so no face of it travels with the deck; any text drawn with it is referenced as "X" by name, and needs that font installed where the deck is opened for identical glyphs for NONE on the registered path, and the same with its text on the
    bundled path, where the family is known to be drawn in — in both cases where no other registered
    family carries a face under the declared name, which is asked first and keeps the shared-name
    line whatever refused the family. not carried whole stays where something
    of the name is in the deck: PART, or an earlier registration of the same FontName that
    travelled while its last registration did not.
  • Javadoc and the CHANGELOG say so, including the 2.5.2 entry above this one, whose "registered
    again" limit now applies only to a re-registration without sources.
  • The saveSubsetFonts clear follows "anything of a family was carried" on both paths, instead of
    "some registered family kept its metrics" and "some bundled family travelled whole". The two agree
    on every path a font reaches; they differ only for PART, where addFacet may have set the flag
    before it refused.

No public API changes. On every path a font can reach, only the log changes: what a deck carries is
unchanged.

Tests

  • PptxUnreadableFontSourceTest (missing classpath resource, one unreadable face of two, metrics
    refusal) and PptxFontStyleSlotTest (two faces in one slot): the substitution line now has to say
    no face of it travels with the deck and must not say not carried whole.
  • New PptxFontSubstitutionWarningTest.aNameAnEarlierRegistrationCarriedIsNotToldNoFaceOfItTravels:
    files("Brand", Lato) then files("Brand", Lato truncated by a byte) — one part in the deck, the
    last registration refused on its viewer metrics (asserted), and the line stays "Brand" is not carried whole.
  • New PptxSharedViewerFamilyTest.aFamilyGivenUpInAFreeSlotOfACarriedNameIsToldItsTextIsDrawnFromThatProgram:
    a family whose only face reads back as bold under wordFamily("Brand"), beside a regular-only
    carrier of Brand, given up by the viewer metrics. In both orders of registration it gets the
    shared-name line (draws it from the program that did travel), not the install line. This already
    held since the line is chosen from the slot ledger after the last registration; the test pins it.
  • The bundled NONE line has no test, as the bundled line it replaces had none: a bundled family
    refused beside a registration that declares its name gets the shared-name line, and no test draws
    a bundled family whose own face is refused.
  • ./mvnw -B -ntp test -pl :graph-compose-render-docx,:graph-compose-render-pptx -am: render-pptx
    207, core 845, render-pdf 347, render-docx 2,823, testing 5, 0 failures; ./mvnw -B -ntp test -f qa/pom.xml: 1,927, 0 failures.
  • Sabotages, each run against the test that owns the rule, all caught: the NONE line swapped for the
    hedged one (4 tests fail), an earlier registration that travelled forgotten (the new re-registration
    test fails), a registered family reported as it is read instead of after the last registration (the
    new free-slot test fails, with three others).

A family the deck could not carry was told `"X" is not carried whole`,
worded for a deck holding part of the family, because the embedder
answered a boolean (bundled path) or nullable metrics (registered path)
and the caller could not tell "nothing travelled" from "the
presentation kept part of it". Every refusal a font can provoke arrives
before the presentation is handed a face and leaves nothing.

PptxFontEmbedder now answers a package-private Carried (WHOLE, NONE,
PART) and, on the registered path, an Embedding of it and the viewer
metrics. PptxDeckFonts writes `no face of it travels with the deck` for
NONE on both paths, and keeps `not carried whole` for PART and for a
FontName an earlier registration of which travelled. The saveSubsetFonts
clear follows "anything carried", the same on every path a font reaches.

A family given up by its viewer metrics in a style slot that the family
sharing its viewer name left free is told its text is drawn from the
program that travelled, in either order of registration: already true
since the line is chosen from the slot ledger after the last
registration, now pinned by a test.

Only the log changes.
…keeps

The embedder's javadoc counted four refusals and called every one of
them NONE; the presentation refusing a face it was handed is PART, and
a family the page had to measure fails the render. It now says which
answer each gives, and why the only refusal left after the hand-over
starts is POI's part store: FontHeader.bufferInit reads only the
header, which PptxEmbeddedFont has measured.

The CHANGELOG's exception is widened to what the code does: a family
whose declared name another registered family carries a face under
keeps the shared-name line whatever refused it, the ledger being asked
first. The bundled-path comment says the subsetting flag may have been
set by a refused hand-over, rather than that it was.
@DemchaAV
DemchaAV marked this pull request as ready for review November 25, 2026 23:45
@DemchaAV
DemchaAV merged commit 310a518 into develop Nov 26, 2026
13 checks passed
@DemchaAV
DemchaAV deleted the fix/pptx-say-when-no-face-travels branch November 26, 2026 00:13
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