THPDFPage.SetFont

THPDFPage

 

Top  Previous  Next

텍스트 출력 메서드가 사용하는 현재 폰트를 설정합니다

 

Delphi syntax:

procedure SetFont ( FontName: AnsiString; FontStyle: TFontStyles; ASize: Single; FontCharset: TFontCharset = DEFAULT_CHARSET; IsVertiacal: Boolean);

TFontStyles Definition

Determines whether the font is normal, italic, underlined, bold, and so on

type

  TFontStyle = (fsBold, fsItalic, fsUnderline, fsStrikeOut);

  TFontStyles = set of TFontStyle;

Description:
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 Definition

TFontCharset represents the character set of a font

type TFontCharSet = 0..255;

Description:
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++ syntax:

void __fastcall SetFont ( AnsiString FontName, Graphics::TFontStyles FontStyle, float ASize, Graphics::TFontCharset FontCharset; IsVertiacal: Boolean);

 

Description:

SetFont 메서드는 텍스트 출력에 사용할 현재 폰트를 설정합니다. FontStyle에는 0개 이상의 스타일 플래그를 지정하고, ASize는 폰트 크기를 정의합니다

 

폰트를 전환하면 HotPDF는 이전 폰트의 캐시된 유니코드 글리프 상태를 초기화하고, 활성 폰트에 대한 글리프 ID와 폭을 다시 확인합니다. Calibri 같은 임베드 폰트와 그 밖의 TrueType 유니코드 폰트에서 중요한 동작입니다

 

For repeatable output across viewers, enable THotPDF.FontEmbedding and disable THotPDF.StandardFontEmulation before calling SetFont.

 

FontEmbedding이 활성화되어 있으면 HotPDF는 임베드된 TrueType 폰트 프로그램의 PostScript 이름을 확인해 일치하는 PDF 폰트 이름을 기록합니다. 그래서 SetFont에 전달한 Windows 페이스 이름이 별칭이거나 대체된 페이스이더라도 /BaseFont와 /FontDescriptor 데이터가 일관되게 유지됩니다

 

Code Example

program TextOut;
{$APPTYPE CONSOLE}
uses
    SysUtils, Graphics, Classes, HPDFDoc;

var
    HPDF: THotPDF;

begin
    HPDF := THotPDF.Create ( nil ) ;
    try
        HPDF.AutoLaunch := true;
        HPDF.FileName := 'TextOut.pdf';
        HPDF.FontEmbedding := true;
        HPDF.StandardFontEmulation := false;
        HPDF.BeginDoc;
        HPDF.CurrentPage.SetFont('Calibri', [fsBold], 24);
        HPDF.CurrentPage.TextOut(10, 10, 0, 'Embedded font output');
        HPDF.EndDoc;
    finally
        HPDF.Free;
    end;
end.

 

See also: TextOut