Tincture.PDF.FontEmbed (Tincture v0.1.0)

Copy Markdown View Source

Builds the PDF objects for embedded TrueType and OpenType fonts.

This is everything between "the document uses these fonts" and "here are the PDF objects that carry them": choosing simple vs composite (Type0/CID) fonts, subsetting the sfnt tables, rebuilding glyf/loca and CFF, computing descriptors and widths, and emitting the ToUnicode CMap.

It was extracted from Tincture.PDF.Serialize, where 134 of that module's 174 private functions were reachable from this one entry point. The rest of the serializer — pages, content streams, images, the object table — never needed any of it, and could not be read without scrolling past it.

The public surface is deliberately narrow: build_embedded_font_objects/3 is the whole contract, and returns everything the page and content-stream code needs to reference the fonts it produced.

Summary

Functions

build_embedded_font_objects(pdf, page_numbers, start_object_id)

font_names_from_operations(operations)