THotPDF 字型後援方法
設定有序的後援字體,並公開涵蓋範圍與直書度量診斷
宣告
procedure SetFontFallbackChain(Script: THPDFFontScript;
const FontNames: array of AnsiString);
procedure ClearFontFallbackChain(Script: THPDFFontScript);
procedure ClearAllFontFallbackChains;
function FontFallbackCount(Script: THPDFFontScript): Integer;
function FontFallbackName(Script: THPDFFontScript;
Index: Integer): AnsiString;
function FontScriptForCodePoint(CodePoint: Cardinal): THPDFFontScript;
function ResolveFontForCodePoint(CodePoint: Cardinal;
const PrimaryFontName: AnsiString;
out ResolvedFontName: AnsiString): boolean; overload;
function ResolveFontForCodePoint(CodePoint: Cardinal;
const PrimaryFontName: AnsiString; const FontStyle: TFontStyles;
out ResolvedFontName: AnsiString): boolean; overload;
function AnalyzeUnresolvedGlyphs(const Text: WideString;
const PrimaryFontName: AnsiString): THPDFUnresolvedGlyphInfoArray; overload;
function AnalyzeUnresolvedGlyphs(const Text: WideString;
const PrimaryFontName: AnsiString; const FontStyle: TFontStyles):
THPDFUnresolvedGlyphInfoArray; overload;
function GetUnresolvedGlyphs: THPDFUnresolvedGlyphInfoArray;
procedure ClearUnresolvedGlyphs;
function GetVerticalGlyphMetrics(CodePoint: Cardinal;
out AdvanceY, OriginY: Integer): boolean;
procedure SetVerticalDefaultMetrics(AdvanceY, OriginY: Integer);
型別
THPDFFontScript = (hfsCommon, hfsLatin, hfsGreek, hfsCyrillic,
hfsHebrew, hfsArabic, hfsIndic, hfsSoutheastAsian, hfsCJK,
hfsKana, hfsHangul, hfsEmoji, hfsOther);
THPDFUnresolvedGlyphInfo = record
CodePoint: Cardinal;
FontName: AnsiString;
Script: THPDFFontScript;
SuggestedFonts: AnsiString;
end;
THPDFUnresolvedGlyphInfoArray = array of THPDFUnresolvedGlyphInfo;
成員主題
- SetFontFallbackChain
- ClearFontFallbackChain
- ClearAllFontFallbackChains
- FontFallbackCount
- FontFallbackName
- FontScriptForCodePoint
- ResolveFontForCodePoint
- AnalyzeUnresolvedGlyphs
- GetUnresolvedGlyphs
- ClearUnresolvedGlyphs
- GetVerticalGlyphMetrics
- SetVerticalDefaultMetrics
- VerticalDefaultAdvanceY
- VerticalDefaultOriginY
行為
ResolveFontForCodePoint會先檢查主要字體,再檢查相符的字稿鏈,然後是hfsCommon- 只有在已安裝字體解析該純量而沒有 GDI 字體替代時,結果才為 true
- 重複的家族、字面樣式與純量探查使用有界的 1024 項目快取,會在私人字型登錄後失效
- 明確樣式多載檢查所選的粗體與斜體字面;原本的多載保留標準字面行為
AnalyzeUnresolvedGlyphs會對重複的未解析純量與主要字體配對去除重複GetVerticalGlyphMetrics在可用時傳回已登錄的 OpenType 直書度量,否則公開已設定的預設值SetVerticalDefaultMetrics需要 1000 單位字符空間中的正值前進量