THPDFFontDecoder Record
폰트 디코드 폴백 체인이 만든, 로드된 PDF 폰트 하나의 디코드 테이블과 폭 메트릭을 담고 있습니다
선언
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;
유닛
HPDFTextExtraction
필드
| 필드 | 목적 |
|---|---|
FontKey | 폰트를 가리키는 /F1 같은 리소스 키. 진단용으로 유지합니다 |
Subtype | 폰트 사전 subtype. Type0, Type1, TrueType, CIDFontType2 등 |
Strategies | 성공적으로 채워진 폴백 전략의 집합 |
ToUnicodeMap | bfchar·bfrange 항목을 담아 파싱한 /ToUnicode CMap. 최우선 순위입니다 |
EncodingMap | 파싱한 /Encoding 스트림 또는 이름 있는 CMap |
PredefinedEncoding | WinAnsiEncoding 같은 사전 정의 인코딩 이름 |
CIDToGIDIdentity | CIDToGIDMap이 Identity라 명시적 테이블이 필요 없을 때 True |
CIDToGIDs | CID당 Word 하나로 펼친 바이너리 CIDToGIDMap 스트림 |
CIDToUnicode | cid2code.txt 폴백에서 온 CID-Unicode 테이블 |
GlyphNameUnicode | /Differences 복구에 쓰이는 256항목짜리 glyph 이름-Unicode 테이블 |
GIDToUnicode | glyph ID에서 Unicode로 뒤집은 내장 cmap |
Widths | 단순 폰트 /Widths 어드밴스(1/1000 em 단위). code에서 FirstChar를 뺀 값이 인덱스입니다 |
FirstChar | Widths 배열이 지원하는 첫 문자 코드 |
LastChar | Widths 배열이 지원하는 마지막 문자 코드 |
CIDWidths | CIDFont /W 배열에서 온 CID 폭 범위 |
CIDDefaultWidth | /DW에서 온 기본 CID 어드밴스 |
CIDVertWidths | 세로쓰기 /W2 메트릭. CID별 또는 범위별 [w1y v1x v1y] 트리플로 저장합니다 |
CIDVertDefaultAdvance | /DW2 w1y에서 온 기본 세로 변위량. 기본값 -1000 |
CIDVertDefaultOriginY | /DW2 v1y에서 온 기본 세로 원점. 기본값 880 |
VerticalWriting | WMode 1 메트릭이 resolver의 세로 분기를 담당할 때 True |
Ascent | 폰트 디스크립터 메트릭에서 읽은 폰트 ascent |
Descent | 폰트 디스크립터 메트릭에서 읽은 폰트 descent |
HasVerticalMetrics | 폰트의 세로 메트릭을 찾았을 때 True |
CodeUnitBytes | 문자 코드당 바이트 수. 콘텐츠 인터프리터에 이 폰트에 대해 답합니다 |
OK | 디코드 전략이 하나라도 쓸 수 있을 때 True |
사용 참고 사항
HPDFBuildFontDecoder로 만듭니다. 단순 레코드라 자체 힙 할당 없이도 한 페이지 분량의 폰트를 값싸게 유지합니다HPDFDecodeCharCode는 전략을 우선순위대로 훑고 실패 시 0을 반환합니다. 스트림이 없으면 조용히 다음 전략으로 낮아집니다- 동적 배열은 참조로 공유되므로, 디코더가 그것을 만든 캐시보다 오래 살아야 할 때는
HPDFCloneFontDecoder를 호출합니다