Skip to content

feat(pptx): warn explicitly whenever a font is substituted in the deck#410

Merged
DemchaAV merged 3 commits into
developfrom
feature/pptx-font-substitution-warnings
Jul 17, 2026
Merged

feat(pptx): warn explicitly whenever a font is substituted in the deck#410
DemchaAV merged 3 commits into
developfrom
feature/pptx-font-substitution-warnings

Conversation

@DemchaAV

Copy link
Copy Markdown
Owner

Why

A font that cannot travel into the .pptx identically was substituted silently in two of three cases: standard-14 families render as their metric-compatible replacements (Helvetica → Arial — identical widths, slightly different letterforms), and families without binary sources reach the deck as name-only references that viewers substitute at open time. Only license-restricted embeds warned. Silent substitution makes the letterform difference look like a rendering bug.

What changed

  • PptxRenderEnvironment.fontFamily warns once per family per render pass on the render logger (render.pptx.font.substitution): standard-14 families name their replacement and point at registerFontFamily for identical glyphs; unregistered names and families registered without binary sources are flagged as name-only references. An embedded family stays silent.
  • PptxFontMapping.standardReplacementFor exposes the replacement decision (used by the warning and available to callers).
  • Capability matrix and CHANGELOG state the explicit-substitution contract.

Verification

./mvnw -B -ntp test -pl :graph-compose-render-pptx -amBUILD SUCCESS, suite 32 → 33 tests. PptxFontSubstitutionWarningTest pins all three outcomes and the once-per-family semantics through a logback appender: two warnings for Helvetica + an unregistered name, none for the embedded Lato family, no duplicates on repeated lookups.

Lane: canonical (document.backend.fixed.pptx).

Stacked on #409 (table rows) — merge #409 first.

@DemchaAV
DemchaAV changed the base branch from feature/pptx-tables to develop July 17, 2026 11:27
DemchaAV added 3 commits July 17, 2026 12:27
A font that cannot travel into the .pptx identically now says so, once per
family per render pass, on the render logger: standard-14 families warn
with their metric-compatible replacement (Helvetica renders as Arial —
identical widths, slightly different letterforms); families registered
without binary sources and unregistered font names warn that the deck
carries a name-only reference that viewers without the font will
substitute; license-restricted embeds already warned. An embedded family
stays silent — registering binary sources (registerFontFamily) remains
the way to guarantee identical glyphs in both formats on any machine.

PptxFontMapping.standardReplacementFor exposes the replacement decision;
PptxFontSubstitutionWarningTest pins all three outcomes and the
once-per-family semantics through a logback appender.
Renders the same specimen line (regular/bold/italic plus a size ramp)
through four embedded families — Lato, Poppins, JetBrains Mono, Spectral —
into the PDF/PPTX pair under target/visual-tests/pptx-parity/font-identity/.
Both outputs embed the same TTF programs, so a real viewer shows identical
glyphs; the specimen exists to check that claim by eye, page against
slide.
…matrix note

Substitution warnings now dedupe on the resolved viewer family, so
facet-suffixed names (Roboto-Regular, Roboto-Bold) warn once per family
per render while the message still names the source font the document
asked for. A family whose embed fails also emits the shared
render.pptx.font.substitution key — one log filter now catches every
substitution — alongside the cause-carrying embed-skip warning.
familyFor delegates to standardReplacementFor, collapsing the third
prefix switch on the same standard-14 names. The capability matrix
states the explicit-substitution contract (the sentence previously
missed the file). The specimen demo now asserts the deck actually embeds
all four families; the warning test covers the facet dedupe and stops
its appender.
@DemchaAV
DemchaAV force-pushed the feature/pptx-font-substitution-warnings branch from 4eff84a to 848f0f9 Compare July 17, 2026 11:27
@DemchaAV
DemchaAV merged commit 0ca205d into develop Jul 17, 2026
12 checks passed
@DemchaAV
DemchaAV deleted the feature/pptx-font-substitution-warnings branch July 17, 2026 11:32
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