Builds physical TrueType subsetting plans.
The subset preserves original glyph identifiers, so the PDF Type 0 font can continue to use its existing CID mapping. Unused glyph programs are removed while composite dependencies are retained. This trades the smallest possible font for a safe, deterministic physical subset that needs no CID remapping.
Summary
Functions
Rebuilds a physical TrueType subset containing only requested glyph programs and their composite dependencies.
Types
@type plan() :: %{ binary_hash: binary(), requested_glyphs: [non_neg_integer()], glyphs: [non_neg_integer()], composite_dependencies: [non_neg_integer()], rebuild_tables: [binary()], checksums: %{optional(binary()) => non_neg_integer()} }
Functions
@spec checksum(binary()) :: non_neg_integer()
@spec checksums(%{optional(binary()) => binary()}) :: %{ optional(binary()) => non_neg_integer() }
@spec plan(PaperForge.Fonts.TrueType.t(), Enumerable.t()) :: plan()
@spec subset(PaperForge.Fonts.TrueType.t(), Enumerable.t()) :: %{ data: binary(), plan: plan(), checksums: map() }
Rebuilds a physical TrueType subset containing only requested glyph programs and their composite dependencies.
The rebuilt font preserves the original glyph count and hmtx metrics. This
makes it safe for a PDF that already addresses glyphs by their original CID.
glyf, loca, hmtx, and maxp are included in the reconstructed table
directory and every table checksum is recalculated.