|
자동 셰이핑 파이프라인은 OpenType GSUB 엔진을 조회 기능만 제공하던 상태에서, 텍스트를 PDF 콘텐츠 스트림에 출력하는 동안 자동으로 적용되는 producer 측 기능으로 끌어올립니다. 호출자가 타입이 지정된 집합(ShapingFeatures: THPDFShapingFeatures)으로 특정 GSUB 기능을 켜면, HotPDF가 알맞은 치환을 실행하고, 대체 글리프를 임베드된 글꼴 서브셋에 표시하며, 접근성에 필요한 ToUnicode CMap 역매핑 항목을 출력합니다
Opt-in framework (v2.119.59 / Phase 8a)
A new enum and property control which automatic substitutions run during text emission:
type
THPDFShapingFeature = (
sfArabicGSUB, // native Arabic init / medi / fina / isol + rlig / calt / rclt
sfStandardLigatures, // Latin 'liga' (ff / fi / fl / ffi / ffl / sft / st)
sfContextualLigatures,// Latin 'clig' (contextual ligatures)
sfContextualAlternates,// 'rclt' (Required Contextual Alternates)
sfIndicShaping); // Devanagari Repha + pre-base I-matra reorder
THPDFShapingFeatures = set of THPDFShapingFeature;
property ShapingFeatures: THPDFShapingFeatures read ... write ...;
기본값은 [](빈 집합)이며, v2.119.32-58 정적 post-pass 셰이퍼에 의존하는 호출자에게 바이트 단위로 동일한 출력을 보장합니다. 플래그를 하나 이상 설정하면 해당 기능에 대해 엔진이 자동 모드로 전환됩니다
sfArabicGSUB - native Arabic GSUB shaping (v2.185.0)
sfArabicGSUB를 설정하면 HotPDF는 논리적 Arabic 런을 기본 글리프 ID로 매핑하고, 각 문자에 대해 선택된 연결 위치에 등록된 글꼴의 위치별 init, medi, fina, isol lookup을 적용한 다음, 셰이핑된 런 전체에 rlig, calt, rclt를 적용합니다. 유니코드 코드 포인트가 없는 대체 글리프는 ToUnicode 역매핑과 함께 synthetic 코드 포인트 경로로 출력되므로, 문맥 Arabic 글리프가 cmap 밖에 있는 글꼴도 임베드하고 올바르게 복사할 수 있습니다
sfArabicGSUB를 설정하면 Arabic에 대해 v2.85.0 정적 4-위치 셰이퍼가 암묵적으로 우회됩니다. 글꼴의 GSUB가 선언한 범위 밖의 코드 포인트를 정적 셰이퍼가 계속 처리해야 한다면 sfArabicGSUB를 끄십시오
sfStandardLigatures / sfContextualLigatures - Phase 8b (v2.119.65)
sfStandardLigatures를 설정하면 글꼴의 liga 기능을 사용해 Latin Standard Ligatures가 자동으로 합쳐집니다. ApplyLatinLigatureRefinement는 Alphabetic Presentation Forms 블록(U+FB00-FB4F)을 대상으로 하며, 대표적으로 FB00 ff, FB01 fi, FB02 fl, FB03 ffi, FB04 ffl, FB05 long-s + t, FB06 st가 있습니다. sfContextualLigatures는 글꼴의 clig 기능을 위한 두 번째 패스를 추가합니다. 두 패스 모두 sfArabicGSUB와 같은 역 cmap 메커니즘을 사용하며, ToUnicode CMap 역매핑 항목 7개(FB00-FB06)를 새로 출력하므로 소비하는 리더에서 복사 / 붙여넣기를 하면 합자가 원래 글자로 복원됩니다
sfContextualAlternates - GSUB 'rclt' (v2.119.66)
sfContextualAlternates를 설정하면 글꼴의 rclt(Required Contextual Alternates) 기능이 적용됩니다. ApplyArabicGSUBContextualRefinement는 v2.119.47의 ApplyContextualSubst 진입점을 사용하며 가변 길이 N-to-M 출력을 처리합니다(치환은 모든 대체 GID가 역 cmap으로 도달 가능할 때만 확정됩니다). 역 cmap 범위는 Latin + Arabic + Hebrew Presentation Forms를 포괄하도록 FB00-FDFF + FE70-FEFF로 확장되었습니다
rclt의 대표적인 사용처는 다음과 같습니다. 글꼴이 위치별 셰이핑을 Unicode Presentation Forms 코드 포인트가 아닌 GSUB로 구동하는 경우의 Arabic init / medi / fina / isol, 일부 Latin 시퀀스 구분 규칙, 그리고 Indic 셰이핑 pres / blws / psts / half / pstf / cjct 기능을 글꼴 디자이너가 rclt로 등록한 경우입니다
sfIndicShaping - Phase 8e (v2.119.67)
sfIndicShaping을 설정하면 v2.119.55의 Devanagari 기능 ApplyDevanagariReorder가 수동 메서드에서 세 개의 BuildUnicode*FieldContent 헬퍼 내부에서 적용되는 자동 사전 패스로 승격됩니다. Devanagari 런에서는 Repha(클러스터 시작의 Ra + Halant)가 post-base 위치로, pre-base I-matra(U+093F)가 클러스터 base 자음 앞으로 이동하므로, 소비하는 리더의 GSUB 엔진이 음절을 올바른 렌더링 순서로 처리하게 됩니다. 그 밖의 Indic 재정렬(above-base / below-base 마트라, 결합 자음 형성)은 계속 글꼴의 GSUB가 담당합니다
Advance-query support (v2.119.64 / Phase 8c.5)
보조 API가 캐시된 /W em 비율을 노출하므로, GSUB로 치환된 글리프를 출력할 때 word-wrap을 정확히 계산할 수 있습니다:
function GetCodepointAdvance(CP: Cardinal): Single;
CP의 cmap 해석 글리프에 대해 hmtx에서 얻은 advance width를 em의 비율로 반환합니다. 같은 릴리스에서 CodeUnitAdvance도 수정되어 Arabic Presentation Forms(U+FB50-FDFF + U+FE70-FEFF)를 WIDE가 아닌 NARROW로 분류합니다(v2.65 이전에는 휴리스틱 fallback이 잘못되어 있었습니다)
Typical workflow (full Arabic auto-shaping)
PDF.RegisterUnicodeTTF('NotoArab', 'NotoSansArabic-Regular.ttf');
PDF.ShapingFeatures :=
[sfArabicGSUB, // native Arabic GSUB contextual glyphs
sfCursiveAttachment]; // GPOS cursive entry / exit anchors
PDF.SetGSUBScript('arab');
PDF.BeginDoc;
PDF.CurrentPage.SetFont('NotoArab', [], 14);
PDF.CurrentPage.RtLTextOut(100, 700, 0,
UnicodeString(#$0628#$0633#$0645#$0020#$0627#$0644#$0644#$0647));
PDF.EndDoc;
Typical workflow (Latin standard ligatures + Devanagari reorder)
PDF.RegisterUnicodeTTF('NotoSans', 'NotoSans-Regular.ttf');
PDF.RegisterUnicodeTTF('NotoDeva', 'NotoSansDevanagari-Regular.ttf');
PDF.ShapingFeatures :=
[sfStandardLigatures, // FB00-FB06 Latin liga
sfContextualLigatures, // + clig
sfIndicShaping]; // Devanagari Repha + I-matra reorder
Phase 8 roadmap closure
Phase 8a(v2.119.59) opt-in 프레임워크 + Arabic 기능, Phase 8b(v2.119.65) Latin 표준 합자, Phase 8c.1(v2.119.60) Allah, Phase 8c.2(v2.119.63) GID 수준 GSUB rlig, Phase 8c.3(v2.119.61) ToUnicode 역매핑, Phase 8c.4(v2.119.62) Bismillah, Phase 8c.5(v2.119.64) advance 조회 + 휴리스틱 수정, Phase 8c.6(v2.119.68) PUA synthetic 코드 포인트 출력, Phase 8d는 8c 하위 단계에 통합, Phase 8e(v2.119.67) Devanagari 자동 재정렬입니다. v2.119.68로 Phase 8 기능 매트릭스는 마무리되었으며, 추가 개선(추가 Indic 스크립트, OpenType GPOS 위치 지정, BiDi 해석)은 별도의 로드맵 항목으로 관리됩니다
Scope and limitations
opt-in 파이프라인은 정적 post-pass 셰이퍼 위에 덧붙는 방식으로 의도적으로 설계되었으므로, 기존 호출자는 opt-in하지 않는 한 동작 변화가 없습니다. 기본 [] 집합은 바이트 단위로 안정적인 회귀 결과가 필요할 때 안전한 선택입니다. 요청한 GSUB 기능 테이블이 없는 글꼴은 안전한 no-op 출력을 만듭니다(치환이 적용되지 않으며 예외도 발생하지 않습니다)
Current shaping API map
현재 파이프라인은 더 이상 치환만 하는 구조가 아닙니다. sfKerning은 GPOS pair kerning을, sfMarkPositioning은 Mark-to-Base와 Mark-to-Mark 오프셋을, sfMarkToLigature는 Mark-to-Ligature 배치를, sfCursiveAttachment는 cursive entry/exit anchor 정렬을, sfTibetanShaping은 Tibetan GSUB 셰이핑을, sfMongolianShaping은 Mongolian 위치별 형태를 적용하고, sfIndicGSUB는 음절 재정렬 이후 Indic GSUB 기능 체인을 적용합니다. ShapingFeatures, GPOS 메서드, Indic 셰이핑 메서드를 참조하십시오
최근에는 sfLocalizedForms(locl 지원), calt(ApplyGSUBContextualFeature 경유), 문맥 및 세로쓰기 GPOS 커닝, 네이티브 Arabic GSUB 문맥 글리프 출력, 그리고 N'Ko, Adlam, Thai/Lao, Hebrew, Javanese 경로가 추가되었습니다. 스크립트 셰이핑 사전 처리 메서드를 참조하십시오
See also: OpenType GSUB Substitution Engine, Arabic / Persian / Urdu Shaping Support, Syriac / Mongolian / Devanagari Shaping, THotPDF.AssignSyntheticCodepointForGID, CFF / OpenType Font Subsetting
|