CffSubsetter
Subsets a CFF font program (the outlines inside an OpenType .otf) down to the glyphs a document uses, and re-emits it as a CID-keyed CFF.
The output is always CID-keyed with a charset that maps each new glyph id to its original glyph id (used as the CID). Under a PDF Type0 / CIDFontType0 / Identity-H font that means the content stream can keep emitting the original glyph id as the 2-byte code (identical to the TrueType path) and the reader resolves code → CID(=original gid) → new gid via this charset. So /W and /ToUnicode stay keyed by the original gid too.
Only the CharStrings INDEX is subset; all global and local subroutines are kept verbatim (their biased references stay valid), as do all FontDicts. For a CJK CFF the charstrings dominate, so this is the bulk of the size win without the complexity (and risk) of renumbering subrs. The deprecated seac-via- endchar accent composition is not followed, so a glyph built that way would lose its components. CID-keyed fonts don't use it.
Functions
Subset cff to usedGids plus .notdef. unitsPerEm is the number of font units in an em, such as the head value of an OpenType font. A bare CFF program has 1000 by default (Adobe Technical Note 5176, Table 9), so the subset records any other value in its FontMatrix.