How fonts are chosen
The layout asks a font registry for each family name in the deck (Calibri, Arial …). The registry gives a face, or a fallback. A font that the deck embeds is used before any other face of that name.
The library uses the portable profile in @reductoai/portable-fonts. It has open fonts with the same metrics as the Office fonts:
Plus script fallbacks for CJK and other scripts.
Node
registerPptxFonts() from @reductoai/pptx/node registers fonts once per registry. PowerPointPresentation.toPdf() and toPng() call it for you; call it yourself before runPptxPipelineFile.
- If
DOCX_FONT_MIRRORis set, it uses the portable profile plus the faces in that folder. The folder must contain afont-table.json(see below). - Else, on a Mac with the Office fonts installed, it uses those fonts.
- Else (Linux servers, CI), it uses the portable profile and writes one warning:
registerPortableFonts() first.
Use your own fonts on a server
If you have a licence for the Office fonts, put them in a folder with afont-table.json:
DOCX_FONT_MIRROR=/path/to/folder. @reductoai/docx and @reductoai/pptx read the same folder.
Browser
A page cannot read system fonts, so you give the layout a face provider. It downloads only the faces that a deck uses, and only once.node_modules/@reductoai/portable-fonts/files to your static folder and point the URL there. To serve other fonts, use tableFaceProvider(table, urlFor).
A face download is async, but layout is sync. So a page lays out once to learn which faces the deck needs, fetches them, and lays out again. JS API in the browser shows the steps. The editor does this for you.
Embed a font in the deck
presentation.embeddedFonts.add(typeface, faces) stores TrueType or OpenType files in the deck, so Microsoft PowerPoint and the viewer show the font where it is not installed. A font whose licence forbids embedding is refused. presentation.fonts lists the typefaces the deck uses and whether each is embedded.