class HexaPDF::Font::TrueType::Subsetter

Parent

Subsets a TrueType font in the context of PDF.

TrueType fonts can be embedded into PDF either as a simple font or as a composite font. This subsetter implements the functionality needed when embedding a TrueType subset for a composite font.

This means in particular that the resulting font file cannot be used outside of the PDF.

Public Class Methods

new(font)

Creates a new Subsetter for the given TrueType Font object.

Public Instance Methods

build_font()

Builds the subset font file and returns it as a binary string.

subset_glyph_id(glyph_id)

Returns the new subset glyph ID for the given glyph ID, or nil if the glyph isn’t subset.

use_glyph(glyph_id)

Includes the glyph with the given ID in the subset and returns the new subset glyph ID.

Can be called multiple times with the same glyph ID, always returning the correct new subset glyph ID.