Expand description
Type 0 CID-keyed font emission for bundled embedded faces.
Each embedded face used in a document is emitted as five indirect objects:
Fontdict (Type 0,Identity-H, descendant +ToUnicoderefs)CIDFontdict (CIDFontType2,/CIDSystemInfo,/W,/CIDToGIDMap /Identity, descriptor ref)FontDescriptordict (bbox, ascent, descent, italic angle, stem widths,/FontFile2ref)/FontFile2stream (the subsetted TTF, with/Length1= uncompressed size)/ToUnicodeCMap(maps each subset CID back to the source clusterβs UTF-8 codepoints)
The subset is built per-document over the union of glyph IDs seen
across every run that uses the face. With /CIDToGIDMap /Identity
the CID in the content stream equals the GID inside the subset
font file. subsetter::GlyphRemapper provides the original-GID β
subset-GID mapping.
StructsΒ§
- Embedded
Font πPlan - Per-face plan: which glyph IDs were used, the subset bytes, the
GlyphRemapperthat maps original β subset GIDs, and the gid-to-source-text map used to build/ToUnicode. - Embedded
Refs π - PDF objects emitted for one embedded face. The 5 refs are allocated up front so the cross-references resolve.
EnumsΒ§
- Content
Op π
FunctionsΒ§
- accumulate_
glyphs π - cids_
to_ πbytes - emit_
embedded π - Emit the 5 PDF objects for one embedded face. Caller allocates the
refs and ensures theyβre cross-referenced from each pageβs
/Fontresource dict. - encode_
glyph_ πrun - Encode shaped glyphs into PDF text-content operations. Each
ShapedGlyph::gidis remapped throughplan.remapperto its subset CID. GPOS advances becomeTJadjustments; glyphs with GPOS offsets get their own absoluteTmso marks draw at the shaped position and the next glyph resumes from the un-offset pen. - flush_
cids π - plan_
embedded π - Plan every embedded face touched by
runs. Returns oneEmbeddedFontPlanper face actually referenced, in stable (EmbeddedFontId-sorted) order. - subset_
tag π - Six-letter uppercase subset tag derived deterministically from the
subset bytes. Required by PDF 1.7 Β§9.6.4 for embedded subsets:
the
/BaseFontandFontDescriptor/FontNamemust start with<6 uppercase letters>+. - units_
to_ πf32 - units_
to_ πpt - units_
to_ πtext_ adjust - write_
font_ πdescriptor