|
THPDFPage.SetFont
|
顶部 上一页 下一页 |
|
Sets the current font used by text output methods.
Delphi 语法: procedure SetFont ( FontName: AnsiString; FontStyle: TFontStyles; ASize: Single; FontCharset: TFontCharset = DEFAULT_CHARSET; IsVertiacal: Boolean); TFontStyles DefinitionDetermines whether the font is normal, italic, underlined, bold, and so on type TFontStyle = (fsBold, fsItalic, fsUnderline, fsStrikeOut); TFontStyles = set of TFontStyle; 说明: Use Style to add special characteristics to characters that use the font. Style is a set containing zero or more values from the following: Value Meaning fsBold The font is boldfaced fsItalic The font is italicized fsUnderline The font is underlined fsStrikeOut The font is displayed with a horizontal line through it. TFontCharset DefinitionTFontCharset represents the character set of a font type TFontCharSet = 0..255; 说明: Each Windows typeface supports one or more character sets, which indicate what characters can be written using the font. For example, most fonts that can represent japanese characters use a particular multi-byte character set Each font supports its own, unique set of character sets. Check with the font vendor to determine which character sets are supported The following table lists the predefined constants provided for standard character sets: Constant Value Description ANSI_CHARSET 0 ANSI characters DEFAULT_CHARSET 1 Font is chosen based solely on Name and Size SYMBOL_CHARSET 2 Standard symbol set MAC_CHARSET 77 Macintosh characters. Not available on NT 3.51 SHIFTJIS_CHARSET 128 Japanese shift-JIS characters HANGEUL_CHARSET 129 Korean characters (Wansung) JOHAB_CHARSET 130 Korean characters (Johab). Not available on NT 3.51 GB2312_CHARSET 134 Simplified Chinese characters (mainland china) CHINESEBIG5_CHARSET 136 Traditional Chinese characters (Taiwanese) GREEK_CHARSET 161 Greek characters. Not available on NT 3.51 TURKISH_CHARSET 162 Turkish characters. Not available on NT 3.51 VIETNAMESE_CHARSET 163 Vietnamese characters. Not available on NT 3.51 HEBREW_CHARSET 177 Hebrew characters. Not available on NT 3.51 ARABIC_CHARSET 178 Arabic characters. Not available on NT 3.51 BALTIC_CHARSET 186 Baltic characters. Not available on NT 3.51 RUSSIAN_CHARSET 204 Cyrillic characters. Not available on NT 3.51 THAI_CHARSET 222 Thai characters. Not available on NT 3.51 EASTEUROPE_CHARSET 238 Includes diacritical marks for eastern european countries. Not available on NT 3.51 OEM_CHARSET 255 Depends on the codepage of the operating system.
C++ 语法: void __fastcall SetFont ( AnsiString FontName, Graphics::TFontStyles FontStyle, float ASize, Graphics::TFontCharset FontCharset; IsVertiacal: Boolean);
说明: SetFont 方法设置文本输出的当前字体。FontStyle 包含零个或多个 style flags,ASize 定义字体大小
在不同字体之间切换时,HotPDF 会重置前一个字体的 cached Unicode glyph state,并解析活动字体的 glyph IDs 和 widths。这对于 Calibri 等嵌入字体以及其他 TrueType Unicode 字体很重要
为了在不同阅读器之间获得可重复输出,请在调用 SetFont 前启用 THotPDF.FontEmbedding 并禁用 THotPDF.StandardFontEmulation
启用 FontEmbedding 时,HotPDF 会解析嵌入 TrueType 字体程序的 PostScript name,并写入匹配的 PDF font names。即使传给 SetFont 的 Windows face name 是别名或替代 face,也能保持 /BaseFont 与 /FontDescriptor 数据一致
代码示例
另请参阅: TextOut |