phpdftk API Documentation

TrueTypeSubsetter
in package

Produces a minimal valid TrueType font containing only requested glyphs.

Takes raw TTF bytes and a set of glyph IDs, and emits a new TTF with only those glyphs (plus GID 0 / .notdef and any composite components).

Table of Contents

Methods

getGidMap()  : array<int, int>
The old → new GID map from the most recent `subset()` call. Returns an empty array if `subset()` has not been called yet. Callers use this to translate any pre-subset GIDs they hold into the renumbered GIDs that live in the emitted subset font.
subset()  : string

Methods

getGidMap()

The old → new GID map from the most recent `subset()` call. Returns an empty array if `subset()` has not been called yet. Callers use this to translate any pre-subset GIDs they hold into the renumbered GIDs that live in the emitted subset font.

public getGidMap() : array<int, int>
Return values
array<int, int>

subset()

public subset(string $fontBytes, array<string|int, int> $glyphIds[, array<int, int> $unicodeToGid = [] ]) : string
Parameters
$fontBytes : string

Raw TTF file bytes

$glyphIds : array<string|int, int>

GIDs to keep (GID 0 is always included)

$unicodeToGid : array<int, int> = []

Unicode codepoint => GID map (for rebuilding cmap)

Return values
string

Subset TTF bytes


        
On this page

Search results