|
THotPDF.AssignSyntheticCodepointForGID / GetSyntheticCodepointForGID THotPDF PUA 합성 코드포인트 할당기(v2.119.68)
|
GSUB Engine Auto Shaping Pipeline Arabic Shaping |
|
폰트의 cmap으로는 자연스럽게 도달할 수 있는 Unicode 코드포인트가 없는 OpenType GSUB 치환 GID를 위해 Private Use Area(U+E000 - U+F8FF)의 합성 코드포인트를 할당하고 조회합니다. v2.119.43-66의 GSUB 조회 및 정제 API에서 남아 있던, 생성 측 GID 단위 출력의 공백을 메웁니다.
Delphi syntax: function AssignSyntheticCodepointForGID(GID: Word; out SyntheticCP: Word): Boolean; function GetSyntheticCodepointForGID(GID: Word): Word;
Why the API exists v2.119.32-67의 생성 측 자동 셰이핑 파이프라인(Arabic / Latin / Devanagari)에서는 GSUB 엔진이 반환하는 치환 GID에 Unicode 코드포인트로 도달할 수 있어야 합니다. 기존의 16진수 인코딩 텍스트 파이프라인은 GID가 아닌 코드포인트를 출력하고, 리더는 임베드된
하지만 폰트 내부 GID로만 존재하는 폰트별 치환 글리프는 폰트 cmap에 코드포인트가 아예 없습니다. 대부분의 Devanagari 클러스터 형태, 디자이너가 번호가 매겨진 GID로만 제공하는 스타일 대체 글리프, CJK 이형자 시퀀스(IVS), 대응하는 Presentation Form이 없는 discretionary 합자가 여기에 해당합니다. v2.119.68 이전에는 이러한 GID에 생성 측 16진수 파이프라인으로 도달할 수 없었습니다. v2.119.68에서는 호출자가 임의의 GID에 Private Use Area의 합성 코드포인트를 할당할 수 있게 하여 이 공백을 메웠습니다.
AssignSyntheticCodepointForGID semantics 주어진 GID에 대해 사용 가능한 다음 PUA 코드포인트(U+E000부터)를 할당하고, 그 할당 내용을 기존 생성 측 16진수 파이프라인과 리더 해석 체인이 의존하는 모든 캐시에 반영합니다:
1. 2. 3.
성공하면
GetSyntheticCodepointForGID semantics 기존 할당을 조회만 하는 순수 함수입니다.
Allocator state lifecycle
Typical workflow (Devanagari cluster shape)
PDF.RegisterUnicodeTTF('NotoDeva', 'NotoSansDevanagari-Regular.ttf'); PDF.ShapingFeatures := [sfIndicShaping]; PDF.SetGSUBScript('deva');
// GSUB 엔진을 통해 폰트 내부 클러스터 GID 얻기 ClusterGID := PDF.GetSingleSubstituteGlyph(BaseGID, 'nukt'); if ClusterGID <> BaseGID then begin // cmap이 치환 글리프에 도달하는지 확인 - Indic에서는 대개 도달하지 않음 // clusters, since cluster GIDs are font-internal // 생성 측에서 사용할 합성 코드포인트를 할당 // hex pipeline can emit if PDF.AssignSyntheticCodepointForGID(ClusterGID, SyntheticCP) then begin // SyntheticCP는 이제 U+E000-F8FF 범위 안에 있으므로 이를 출력 // through UnicodeTextOut just like a normal codepoint PDF.CurrentPage.UnicodeTextOut(X, Y, 0, UnicodeChar(SyntheticCP)); PDF.MarkUnicodeGlyphUsed(ClusterGID); end; end;
Idempotency example
PDF.AssignSyntheticCodepointForGID(150, CP1); // CP1 = $E000 PDF.AssignSyntheticCodepointForGID(151, CP2); // CP2 = $E001 PDF.AssignSyntheticCodepointForGID(150, CP3); // CP3 = $E000 (idempotent) CP4 := PDF.GetSyntheticCodepointForGID(150); // CP4 = $E000 CP5 := PDF.GetSyntheticCodepointForGID(999); // CP5 = 0 (no assignment)
Consumer-reader behavior 리더는 텍스트 출력 연산자에서 PUA 코드포인트를 확인하고, 문서에 임베드된
복사 / 붙여넣기 동작: ToUnicode CMap이 PUA 코드포인트를 항등 매핑으로 선언해 두면, 복사 / 붙여넣기 시 PUA 코드포인트가 그대로 왕복됩니다. 치환 글리프를 만들어 낸 원래 입력 런의 Unicode 문자가 왕복되게 하려면,
Phase 8 roadmap closure v2.119.68 / Phase 8c.6으로 Phase 8 GSUB 엔진 로드맵이 마무리됩니다. LookupType 1-8의 모든 조회 API(Phase 1-6), Script / LangSys 선택 API(Phase 7), TTF 서브세터 클로저 진입점(Phase 9), 정적 후처리 합자 접기(v2.119.32 / 58 / 60 / 62), 옵트인 자동 파이프라인(v2.119.59), 아랍어
See also: OpenType GSUB Substitution Engine, Automatic Shaping Pipeline (Phase 8), Arabic / Persian / Urdu Shaping Support, Syriac / Mongolian / Devanagari Shaping, THotPDF.BeginTaggedContent |