fix(pptx): render shape image fills, fix picture placeholders, and load embedded fonts#73
Merged
Merged
Conversation
… handling - Resolve <a:blipFill> on shapes to an image fill (prefers the SVG blip) so custGeom icons, globes, stars and grid textures render instead of blank. - ShapeView paints the image clipped to the custGeom path, or as a box-filling background for rect/rounded/circle shapes. - Suppress empty layout picture-placeholder prompt boxes from leaking onto the slide; on-slide picture placeholders inherit geometry + fill from the layout/master placeholder.
- Clear WE_HAVE_INSTRUCTIONS on every composite component (not just the first) so the reconstructed glyf table parses; a stray bit made OTS read a non-existent instructionLength past the glyph and reject the font. - Sanitize cmap subtable 'language' to 0 on non-Macintosh platforms; some embedded faces ship format-12 language=1007, which OTS rejects. - Alias weight-named embedded families (Montserrat Bold/Semi-Bold) to the base family at the matching numeric weight so base-family bold/semibold text uses the real face instead of a synthetic bold.
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.
Summary
Fixes a set of PPTX import-rendering fidelity gaps surfaced by a real-world deck (an "Education" template). Each was verified against the actual file; the font work was additionally verified in real headless Chrome (the browser's OTS sanitizer is far stricter than fontTools).
1. Picture / SVG fills on shapes
Shapes whose fill is an
<a:blipFill>— the modern Office "icon" pattern, including dual PNG+SVG blips — now render their artwork. Previously thesecustGeomicons (globes, stars, grid textures, brand marks) imported with no fill and showed blank/grey.url("data:…")and feeds it into the existingfillfield.ShapeViewpaints the image clipped to the custGeom silhouette, or as a box-filling background for rect/rounded/circle.2. Picture-placeholder handling
3. Embedded fonts (EOT / MicroType-Express) now load
Embedded
.fntdatafonts decode to browser-valid TTFs. Two independent bugs caused the browser's font sanitizer (OTS) to reject the whole font and fall back to a system typeface:WE_HAVE_INSTRUCTIONSon a non-first component produced a malformedglyftable (a parser read a non-existentinstructionLengthpast the glyph).cmapsubtables shipped a non-zerolanguagefield (1007); OTS requires0on non-Macintosh platforms.4. Weight-named font families
Weight-named embedded families (e.g.
Montserrat Bold,Montserrat Semi-Bold) are now aliased to their base family at the matching numeric weight, so bold/semibold text bound to the base family uses the real embedded face instead of a synthetic bold. Display-only —deck.fonts(PPTX export) is untouched.Verification
font1…font8 = true); base-family weights (Montserrat400/600/700) resolve to the real faces.splitFamilyWeight(3 cases).Notes
1.2) was investigated and intentionally left unchanged — the observed title-overlap was caused by fallback-font width, not line spacing.