|
CFF and OpenType Font Subsetting Functions
|
傳回頂部 EnableFontSubsetting 目錄 |
|
這些 unit-level functions 會暴露 HotPDF embedded font pipeline 使用的公開 CFF、OpenType-CFF 與 sfnt font-inspection surface。HotPDF 也隨附可重複使用的 Type 1 PFB 與 CFF parser units,供需要較低階 font inspection 的呼叫端使用
Delphi 語法 function HPDFSubsetCFF(const CFFBytes: TBytes; const KeepGlyph: array of Boolean): TBytes; function HPDFIsCFF2Font(const FontBytes: TBytes): Boolean; function HPDFInstantiateCFF2Font(const FontBytes: TBytes; const AxisValues: THPDFVariableFontAxisValueArray): TBytes; function HPDFSubsetCFF2Font(const FontBytes: TBytes; const KeepGlyph: array of Boolean): TBytes; function HPDFIsTrueTypeVariableFont(const FontBytes: TBytes): Boolean; function HPDFInstantiateTrueTypeVariableFont(const FontBytes: TBytes; const AxisValues: THPDFVariableFontAxisValueArray): TBytes; function HPDFSfntIsOTF(const Data: TBytes): Boolean; function HPDFOTFFindCFFTable(const Data: TBytes; out TableOff: Cardinal; out TableLen: Cardinal): Boolean; function HPDFSubsetOTFContainer(const OTFBytes: TBytes; const KeepGlyph: array of Boolean): TBytes; function HPDFExtractTTFPostScriptName(const Data: TBytes): AnsiString;
說明 HPDFSubsetCFF 會就地改寫 CFF 字型內容,保留 glyph ID,並把未使用的 CharStrings 與 subroutines 換成最小 stub。這是給已經從字型容器取出 CFF table 的呼叫端使用的 helper
HPDFIsCFF2Font 會偵測含
HPDFSubsetCFF2Font 執行同樣的 default-coordinate instancing,並把未使用的 glyph 程式換成空 CharStrings。它會保留 glyph ID、multi-FD 字典、private hint 資料與字型矩陣
HPDFIsTrueTypeVariableFont 會偵測含
HPDFSfntIsOTF 會偵測版本為 OTTO 的 sfnt 容器。HPDFOTFFindCFFTable 會找出內嵌的 'CFF ' table。HPDFSubsetOTFContainer 會子集化內嵌的 CFF 或 CFF2 資料,並傳回 sfnt checksum 正確的 OTF 容器。HPDFExtractTTFPostScriptName 會從 sfnt
subsetter 會同時識別 name-keyed CFF(單一 Private DICT、單一 Local Subr INDEX)與 CID-keyed CFF(Top DICT ROS operator、多個 sub-font Private DICT 的 FDArray、FDSelect glyph-to-FD map、per-FD Local Subr INDEXes)。CID 支援涵蓋 CJK / Indic / Arabic OpenType-CFF fonts;closure scan 會追蹤每個保留 CharString 的 FD context,因此 per-FD Local Subr INDEXes 可獨立子集化
較低階的 CFF integer decoders、FDArray / FDSelect parsers 與 subroutine scanners 都是此公開 helper surface 後方的實作細節
Type 1 and CFF parser units
|
原生字形轉譯器實作標準的 Type 2 布林、算術、條件、暫存陣列與堆疊運算,包括 put、get、ifelse、random、dup、exch、index 與 roll
暫存值會在每個字形重設,隨機值可重現,而運算元、暫存陣列、遞迴與執行上限會拒絕格式錯誤的程式,不會回傳不完整的外框
子集掃描器會解析本地與全域子常式呼叫用到的算術與暫存陣列運算式,包括 Type 2 16.16 定點數運算元
當隨機值、未知暫存狀態或跨程序的堆疊效應讓呼叫目標無法確定時,子集化會保留每一個候選子常式,而不是丟掉可能還連得到的外框相依
保留與已棄用的 Multiple Master 運算仍不支援,並會明確失敗