THPDFFontDecoder Record
Contiene le tabelle di decodifica risolte e le metriche di larghezza per un font PDF caricato, costruite dalla catena di fallback di decodifica dei font
Dichiarazione
THPDFFontDecoder= record
FontKey: AnsiString; // resource key (e.g. /F1) for diagnostics
Subtype: AnsiString; // Type0, Type1, TrueType, CIDFontType2
Strategies: THPDFFontStrategies; // which fallbacks are populated
ToUnicodeMap: THPDFCMapParseResult;
EncodingMap: THPDFCMapParseResult; // /Encoding stream or named CMap
PredefinedEncoding: AnsiString; // 'WinAnsiEncoding' etc
CIDToGIDIdentity: boolean;
CIDToGIDs: array of Word; // binary CIDToGIDMap stream
CIDToUnicode: THPDFCIDToUnicodeTable; // cid2code.txt fallback
GlyphNameUnicode: array[0.. 255] of Cardinal;
GIDToUnicode: THPDFUnicodeByGID;
// v2.505.0 simple-font /Widths (PDF 1.7 9.6.3 Table 111). Index =
// (code - FirstChar); values are 1/1000-em glyph advances. Empty when
// the font has no /Widths array (the interpreter falls back to 0.5*fs)
Widths: array of Double;
FirstChar: Integer;
LastChar: Integer;
CIDWidths: THPDFCIDWidthRanges;
CIDDefaultWidth: Double;
// Vertical (WMode 1) counterparts from the descendant CIDFont /W2 and
// /DW2 (ISO 32000-1 9.7.4.3). Each /W2 metric is a [w1y v1x v1y]
// triple: w1y is the displacement along the writing axis, v1x/v1y the
// position vector from the glyph's horizontal origin to its vertical
// origin. A range entry (cFirst cLast w1y v1x v1y) stores one triple;
// a list entry (c [w1y v1x v1y ...]) stores one triple per CID from
// FirstCID to LastCID. VerticalWriting gates the resolver's vertical
// branch
CIDVertWidths: THPDFCIDWidthRanges;
CIDVertDefaultAdvance: Double; // /DW2 w1y (second entry); default -1000
CIDVertDefaultOriginY: Double; // /DW2 v1y (first entry); default 880
VerticalWriting: boolean;
Ascent: Double;
Descent: Double;
HasVerticalMetrics: boolean;
CodeUnitBytes: Integer; // bytes per char code
OK: boolean;
end;
Unità
HPDFTextExtraction
Campi
| Campo | Scopo |
|---|---|
FontKey | Chiave di risorsa come /F1 che nomina il font, tenuta per i diagnostici |
Subtype | Sottotipo del dizionario del font: Type0, Type1, TrueType, CIDFontType2 e simili |
Strategies | Insieme delle strategie di fallback popolate con successo |
ToUnicodeMap | CMap /ToUnicode analizzata con voci bfchar e bfrange, priorità massima |
EncodingMap | Stream /Encoding analizzato o CMap nominata |
PredefinedEncoding | Nome di codifica predefinita come WinAnsiEncoding |
CIDToGIDIdentity | True quando il CIDToGIDMap è Identity e non serve una tabella esplicita |
CIDToGIDs | Stream CIDToGIDMap binario espanso a un Word per CID |
CIDToUnicode | Tabella CID a Unicode dal fallback cid2code.txt |
GlyphNameUnicode | Tabella a 256 voci da nome glifo a Unicode usata dal recupero /Differences |
GIDToUnicode | CMap incorporata invertita da glyph ID a Unicode |
Widths | Avanzamenti /Widths del font semplice in 1/1000 di em, indicizzati per codice meno FirstChar |
FirstChar | Primo codice carattere supportato dell'array Widths |
LastChar | Ultimo codice carattere supportato dell'array Widths |
CIDWidths | Intervalli di larghezza CID dall'array /W del CIDFont |
CIDDefaultWidth | Avanzamento CID predefinito da /DW |
CIDVertWidths | Metriche verticali /W2 memorizzate come triple [w1y v1x v1y] per CID o intervallo |
CIDVertDefaultAdvance | Spostamento verticale predefinito da /DW2 w1y, per predefinito -1000 |
CIDVertDefaultOriginY | Origine verticale predefinita da /DW2 v1y, per predefinito 880 |
VerticalWriting | True quando le metriche WMode 1 abilitano il ramo verticale del resolver |
Ascent | Ascent del font letto dalle metriche del font descriptor |
Descent | Descent del font letto dalle metriche del font descriptor |
HasVerticalMetrics | True quando sono state trovate metriche verticali per il font |
CodeUnitBytes | Byte per codice carattere, risposto all'interprete di contenuto per il font |
OK | True quando almeno una strategia di decodifica è utilizzabile |
Note sull'utilizzo
- Costruiscilo con
HPDFBuildFontDecoder; il record semplice tiene il corredo di font di una pagina a costo minimo, senza allocazioni di heap proprie HPDFDecodeCharCodescorre le strategie in ordine di priorità e restituisce 0 in caso di mancata corrispondenza; gli stream mancanti degradano silenziosamente alla strategia successiva- Chiama
HPDFCloneFontDecoderquando un decoder deve sopravvivere alla cache che l'ha prodotto, visto che gli array dinamici sono condivisi per riferimento