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 字体替换的情况下解析该标量时,结果才为真
- 重复的字族、字型样式和标量探测使用一个有界的 1024 项缓存,该缓存在私有字体注册之后失效
- 显式样式重载检查所选的粗体或斜体字型;原重载保持常规字型行为
AnalyzeUnresolvedGlyphs对重复的未解析标量和主字体对进行去重GetVerticalGlyphMetrics在可用时返回已注册的 OpenType 竖直度量,否则公开已配置的默认值SetVerticalDefaultMetrics要求在 1000 单位字形空间中使用正的推进量