Public Member Functions | |
Font (const wchar_t *name, uint32 styles, Charset charset, int weight=0) | |
Constructor, with given attribute. More... | |
Font (StandardID font_id) | |
Constructor, by a standard font ID. More... | |
Font (const char *font_file_path, int face_index, Charset charset) | |
Constructor, from a font file. More... | |
Font (const wchar_t *font_file_path, int face_index, Charset charset) | |
Constructor, from a font file. More... | |
Font (const Font &) | |
Constructor, with another Font object. | |
~Font () | |
Destructor. | |
Font | Embed (pdf::PDFDoc document) |
Embed current font to the specified PDF document. More... | |
int | GetAscent () const |
Get the ascent value, in 1/1000 of em size (PDF units). More... | |
RectI | GetCharBBox (uint32 unicode) const |
Get the bounding box of a character specified by unicode. More... | |
float | GetCharWidth (uint32 unicode) const |
Get the width (in 1/1000 of em size (PDF units)) of a character specified by unicode. More... | |
int | GetDescent () const |
Get the descent value, in 1/1000 of em size (PDF units). More... | |
WString | GetName () |
Retrieve the face name. More... | |
bool | IsBold () const |
Judge whether current font is bold or not. More... | |
bool | IsEmbedded (const pdf::PDFDoc &document) |
Judge whether current font is embedded in a specified PDF document or not. More... | |
bool | IsEmpty () const |
Check whether current object is empty or not. More... | |
bool | IsItalic () const |
Judge whether current font object is italic or not. More... | |
bool | IsSupportEmbedded (const pdf::PDFDoc &document) |
Check whether current font is supported to be embedded to the specified PDF document or not. More... | |
bool | operator!= (const Font &other) const |
Not equal operator. More... | |
Font & | operator= (const Font &other) |
Assign operator. More... | |
bool | operator== (const Font &other) const |
Equal operator. More... | |
![]() | |
FS_HANDLE | Handle () const |
Get the handle of current object. More... | |
In PDF document, font is used for drawing text in PDF page.
This class represents font used in Foxit PDF SDK. This class offers different constructor for user to construct a new Font object, by specified parameters, by standard font ID, or from a font file path. A Font object can also be retrieved directly from other object (such as free text annotation, a text graphics object, etc) in a PDF document. This class also offers some functions to get some basic information from a font.
Enumeration for font charset.
Values of this enumeration should be used alone.
Enumerator | |
---|---|
e_CharsetANSI | Font charset: ANSI (United States, Western Europe). |
e_CharsetDefault | Font charset: System default, for unknown or mapping purpose. |
e_CharsetSymbol | Font charset: Standard symbols. |
e_CharsetShift_JIS | Font charset: Japanese (Shift-JIS). |
e_CharsetHangeul | Font charset: Korean (Wansung). |
e_CharsetGB2312 | Font charset: Simplified Chinese. |
e_CharsetChineseBig5 | Font charset: Traditional Chinese. |
e_CharsetThai | Font charset: Thai. |
e_CharsetEastEurope | Font charset: Eastern European. |
e_CharsetRussian | Font charset: Russian. |
e_CharsetGreek | Font charset: Greek. |
e_CharsetTurkish | Font charset: Turkish. |
e_CharsetHebrew | Font charset: Hebrew. |
e_CharsetArabic | Font charset: Arabic. |
e_CharsetBaltic | Font charset: Baltic. |
Enumeration for standard font ID.
Values of this enumeration should be used alone.
Enumeration for font styles.
Values of this enumeration can be used alone or in combination.
Enumerator | |
---|---|
e_StyleFixedPitch | Font style: fixed pitch. |
e_StyleSerif | Font style: serif. |
e_StyleSymbolic | Font style: symbolic. |
e_StyleScript | Font style: script. |
e_StyleNonSymbolic | Font style: non-symbolic. |
e_StyleItalic | Font style: italic. |
e_StyleAllCap | Font style: all cap. |
e_StylesSmallCap | Font style: small cap. |
e_StylesBold | Font style: force bold. |
Constructor, with given attribute.
This function is to construct font based on system fonts.
[in] | name | The PostScript name of the font to be created. |
[in] | styles | Font styles. Please refer to values starting from e_StyleFixedPitch and this can be one or a combination of these values. |
[in] | charset | The charset of the font to be created. Please refer to values starting from Font::e_CharsetANSI and this should be one of these values. |
[in] | weight | Original font weight. 0 means unspecified. Default value: 0. |
|
explicit |
Constructor, by a standard font ID.
[in] | font_id | Standard font ID of the font to be created. Please refer to values starting from Font::e_StdIDCourier and this should be one of these values. |
foxit::common::Font::Font | ( | const char * | font_file_path, |
int | face_index, | ||
Charset | charset | ||
) |
Constructor, from a font file.
[in] | font_file_path | A full path to an existing font file. |
[in] | face_index | The zero-based face index. Valid range: from 0 to (face_count-1). Please call the system functions to get the face_count. |
[in] | charset | The charset of the font to be created. Please refer to values starting from Font::e_CharsetANSI and this should be one of these values. |
foxit::common::Font::Font | ( | const wchar_t * | font_file_path, |
int | face_index, | ||
Charset | charset | ||
) |
Constructor, from a font file.
[in] | font_file_path | A full path to an existing font file. |
[in] | face_index | The zero-based face index. Valid range: from 0 to (face_count-1). Please call the system functions to get the face_count. |
[in] | charset | The charset of the font to be created. Please refer to values starting from Font::e_CharsetANSI and this should be one of these values. |
Font foxit::common::Font::Embed | ( | pdf::PDFDoc | document | ) |
Embed current font to the specified PDF document.
[in] | document | A valid PDF document object. |
int foxit::common::Font::GetAscent | ( | ) | const |
Get the ascent value, in 1/1000 of em size (PDF units).
Get the bounding box of a character specified by unicode.
[in] | unicode | A character unicode value. |
float foxit::common::Font::GetCharWidth | ( | uint32 | unicode | ) | const |
Get the width (in 1/1000 of em size (PDF units)) of a character specified by unicode.
[in] | unicode | A character unicode value. |
int foxit::common::Font::GetDescent | ( | ) | const |
Get the descent value, in 1/1000 of em size (PDF units).
WString foxit::common::Font::GetName | ( | ) |
Retrieve the face name.
bool foxit::common::Font::IsBold | ( | ) | const |
Judge whether current font is bold or not.
bool foxit::common::Font::IsEmbedded | ( | const pdf::PDFDoc & | document | ) |
Judge whether current font is embedded in a specified PDF document or not.
[in] | document | A valid PDF document object. |
bool foxit::common::Font::IsEmpty | ( | ) | const |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
bool foxit::common::Font::IsItalic | ( | ) | const |
Judge whether current font object is italic or not.
bool foxit::common::Font::IsSupportEmbedded | ( | const pdf::PDFDoc & | document | ) |
Check whether current font is supported to be embedded to the specified PDF document or not.
[in] | document | A valid PDF document object. |
bool foxit::common::Font::operator!= | ( | const Font & | other | ) | const |
Not equal operator.
[in] | other | Another Font object. This function will check if current object is not equal to this one. |
Assign operator.
[in] | other | Another Font object, whose value would be assigned to current object. |