THotPDF GSUB Lookup Methods

THotPDF API 참조

 

THotPDF 메서드  자동 shaping  GSUB

single, multiple, alternate, ligature, contextual, chained contextual, reverse chained, contextual-feature, localized-form 치환용 능력 수준 GSUB lookup API를 문서화합니다

 

Delphi 문법

function GetSingleSubstituteGlyph(InputGID: Word; const FeatureTag: AnsiString): Word;

function GetMultipleSubstituteGlyphs(InputGID: Word; const FeatureTag: AnsiString; var OutGIDs: TGSUBLookupArray): Boolean;

function GetAlternateGlyphCount(InputGID: Word; const FeatureTag: AnsiString): Integer;

function GetAlternateGlyph(InputGID: Word; const FeatureTag: AnsiString; AlternateIndex: Integer): Word;

function ApplyLigatureSubstitution(const InputGIDs: array of Word; StartIndex: Integer; const FeatureTag: AnsiString; out OutGID: Word; out ConsumedCount: Integer): Boolean;

function ApplyContextualSubst(const InputGIDs: array of Word; StartIndex: Integer; const FeatureTag: AnsiString; var OutGIDs: TGSUBLookupArray; out ConsumedLen: Integer): Boolean;

function ApplyReverseChainedContextualSubst(const InputGIDs: array of Word; StartIndex: Integer; const FeatureTag: AnsiString; out OutGID: Word): Boolean;

function ApplyGSUBContextualFeature(const Wide: UnicodeString; const AFeatureTag: AnsiString): UnicodeString;

function ApplyLocalizedForms(const Wide: UnicodeString): UnicodeString;

 

다루는 API

API사용 참고 사항
GetSingleSubstituteGlyphGSUB LookupType 1 single 치환을 조회하고 일치가 없으면 입력 GID를 반환합니다
GetMultipleSubstituteGlyphsGSUB LookupType 2 multiple 치환을 조회하고 대체 glyph 시퀀스를 반환합니다
GetAlternateGlyphCount커버되는 입력 glyph의 GSUB LookupType 3 alternate glyph 수를 셉니다
GetAlternateGlyph0 기반 alternate 인덱스로 선택된 alternate glyph를 반환합니다
ApplyLigatureSubstitution특정 인덱스에서 시작하는 glyph run에 대해 GSUB LookupType 4 ligature 치환을 조회합니다
ApplyContextualSubst규칙이 run 세그먼트를 교체할 수 있는 GSUB contextual/chained contextual 치환을 적용합니다
ApplyReverseChainedContextualSubstright-to-left 호환 shaping 규칙용 GSUB reverse chained contextual single 치환을 조회합니다
ApplyGSUBContextualFeaturerclt, calt 같은 이름 지정 GSUB contextual feature를 Unicode run에 적용하고 치환을 안전하게 매핑합니다
ApplyLocalizedForms활성 script와 language 아래에서 GSUB locl 치환을 적용하면서 텍스트 추출 매핑을 유지합니다
MarkUnicodeGlyphUsed반환된 치환 GID를 내장 폰트 subset 클로저에 추가합니다
sfContextualAlternatesrclt 지원 GSUB contextual lookup 경로로 필요한 contextual alternates를 적용합니다
sfLocalizedForms활성 script와 language 아래에서 GSUB locl localized-form 치환을 적용합니다

 

사용 참고 사항

이 메서드들은 폰트 GSUB 테이블이 수행할 일에 답합니다. ApplyGSUBContextualFeature는 rclt, calt 같은 contextual feature의 공용 경로이고, ApplyLocalizedForms는 활성 GSUB script·language 아래에서 locl을 적용합니다. 호출자가 반환된 치환 GID를 수동으로 출력한다면 MarkUnicodeGlyphUsed나 합성 codepoint 매핑으로 그 glyph이 내장 subset과 ToUnicode 맵 안에 머물게 해야 합니다. 해석된 lookup을 하나씩 적용하는 complex script 파이프라인은 glyph별 feature 마스크를 PGSUBLookupArray 포인터로 공유 TGSUBLookupArray run에 실어, 각 lookup을 적용 가능한 glyph 위치로 한정합니다

 

참고: OpenType GSUB Engine GSUB script·language 메서드 ShapingFeatures subset·매핑 메서드