Create font subsets for PDF embedding
masterFontkit supports subsetting, which creates a new font containing only specified glyphs. This is primarily used to reduce font size for PDF generation.
Note: Currently, subsets are designed for PDF embedding and may not work as standalone files because they lack essential tables like cmap.
To use subsets:
- Call
font.createSubset()to create aSubsetobject. - Use
subset.includeGlyph(glyph)to add specific glyph objects or glyph IDs to the subset. - Call
subset.encode()to get the resulting font as aUint8Array.