Documentation

CidDecoder
in package

Pdf extract CID font decoder class

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
6.0.0

Table of Contents

Properties

$reverseCmapCache  : WeakMap
Per-FontInfo cache of built glyph-ID-to-Unicode reverse cmaps

Methods

decode()  : string
Decode a Type0/CID composite font's raw byte string to Unicode text
buildReverseCmap()  : array<string|int, mixed>
Build a glyph-ID-to-Unicode reverse cmap from an embedded TrueType font's own cmap table
cidToGid()  : int
Map a CID to a glyph ID via the CIDToGIDMap stream bytes, or identity
codepointToUtf8()  : string
Convert a Unicode codepoint to a UTF-8 string
codeToCid()  : int
Map a character code to a CID via the encoding's cidMappings, or identity
getReverseCmap()  : array<string|int, mixed>
Get a cached reverse cmap for a FontInfo, building and caching it if needed
splitCodes()  : array<string|int, mixed>
Split raw bytes into fixed-width character codes per the encoding's codespace range

Properties

$reverseCmapCache

Per-FontInfo cache of built glyph-ID-to-Unicode reverse cmaps

protected static WeakMap $reverseCmapCache

Methods

decode()

Decode a Type0/CID composite font's raw byte string to Unicode text

public static decode(string $rawBytes, FontInfo $info) : string
Parameters
$rawBytes : string
$info : FontInfo
Return values
string

buildReverseCmap()

Build a glyph-ID-to-Unicode reverse cmap from an embedded TrueType font's own cmap table

protected static buildReverseCmap(string|null $embeddedFontBytes) : array<string|int, mixed>
Parameters
$embeddedFontBytes : string|null
Return values
array<string|int, mixed>

cidToGid()

Map a CID to a glyph ID via the CIDToGIDMap stream bytes, or identity

protected static cidToGid(int $cid, mixed $cidToGidMap) : int
Parameters
$cid : int
$cidToGidMap : mixed
Return values
int

codepointToUtf8()

Convert a Unicode codepoint to a UTF-8 string

protected static codepointToUtf8(int $codepoint) : string
Parameters
$codepoint : int
Return values
string

codeToCid()

Map a character code to a CID via the encoding's cidMappings, or identity

protected static codeToCid(int $code, mixed $encoding) : int
Parameters
$code : int
$encoding : mixed
Return values
int

getReverseCmap()

Get a cached reverse cmap for a FontInfo, building and caching it if needed

protected static getReverseCmap(FontInfo $info) : array<string|int, mixed>
Parameters
$info : FontInfo
Return values
array<string|int, mixed>

splitCodes()

Split raw bytes into fixed-width character codes per the encoding's codespace range

protected static splitCodes(string $rawBytes, mixed $encoding) : array<string|int, mixed>
Parameters
$rawBytes : string
$encoding : mixed
Return values
array<string|int, mixed>

        
On this page

Search results