WoffParser
in package
FinalYes
WOFF (Web Open Font Format 1.0) decompressor.
Parses a WOFF container, decompresses each table, and reconstructs the original sfnt (TrueType/OpenType) font bytes. The result can be passed to TrueTypeParser::fromBytes() or OpenTypeParser::fromBytes().
WOFF 1.0 uses zlib (gzcompress) for per-table compression.
Tags
Table of Contents
Methods
- decompress() : string
- Decompress a WOFF file to raw sfnt (TTF/OTF) bytes.
- decompressBytes() : string
- Decompress WOFF bytes to raw sfnt (TTF/OTF) bytes.
- detectFlavor() : string
- Detect the flavor (TrueType or OpenType CFF) of a WOFF file.
- isWoff() : bool
- Detect whether bytes are a WOFF file.
Methods
decompress()
Decompress a WOFF file to raw sfnt (TTF/OTF) bytes.
public
static decompress(string $woffPath) : string
Parameters
- $woffPath : string
-
Path to the WOFF file
Return values
string —Raw sfnt bytes
decompressBytes()
Decompress WOFF bytes to raw sfnt (TTF/OTF) bytes.
public
static decompressBytes(string $data) : string
Parameters
- $data : string
Return values
stringdetectFlavor()
Detect the flavor (TrueType or OpenType CFF) of a WOFF file.
public
static detectFlavor(string $data) : string
Parameters
- $data : string
Return values
string —'truetype' or 'opentype', or 'unknown'
isWoff()
Detect whether bytes are a WOFF file.
public
static isWoff(string $data) : bool
Parameters
- $data : string