Foxit PDF SDK
|
Public Member Functions | |
Font (const char *font_file_path, int face_index, Charset charset) | |
Constructor, from a font file. More... | |
Font (const Font &other) | |
Constructor, with another font object. More... | |
Font (const wchar_t *font_file_path, int face_index, Charset charset) | |
Constructor, from a font file. More... | |
Font (const wchar_t *name, uint32 styles, Charset charset, int weight) | |
Constructor, with given attribute. More... | |
Font (StandardID font_id) | |
Constructor, by a standard font ID. More... | |
~Font () | |
Destructor. | |
UInt32Array | AddUnicodes (const pdf::PDFDoc &document, const UInt32Array &unicode_array) |
Add unicodes to current embedded font. More... | |
Font | Embed (pdf::PDFDoc document, bool is_add_all_unicodes=true) |
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... | |
String | GetBaseFontName (const pdf::PDFDoc &document) |
Get base font name. More... | |
RectI | GetCharBBox (foxit::uint32 unicode, const foxit::pdf::PDFDoc &document) |
Get the bounding box of a character(specified by unicode) in a PDF document. More... | |
RectI | GetCharBBox (uint32 unicode) const |
Get the bounding box of a character specified by unicode. More... | |
float | GetCharWidth (foxit::uint32 unicode, const foxit::pdf::PDFDoc &document) |
Get the width (in 1/1000 of em size, as PDF units) of a character (specified by unicode) in a PDF document. More... | |
float | GetCharWidth (uint32 unicode) const |
Get the width (in 1/1000 of em size (PDF units)) of a character specified by unicode. More... | |
CIDCharset | GetCIDCharset (const pdf::PDFDoc &document) |
Get CID font charset. More... | |
int | GetDescent () const |
Get the descent value, in 1/1000 of em size (PDF units). More... | |
String | GetEncoding (const pdf::PDFDoc &document) |
Get the current font encoding. More... | |
String | GetFamilyName () |
Retrieve the famliy name. More... | |
FontTypes | GetFontType (const pdf::PDFDoc &document) |
Get font type. More... | |
WString | GetName () |
Retrieve the postscript name. More... | |
StandardID | GetStandard14Font (const pdf::PDFDoc &document) |
Get standard font ID. More... | |
foxit::uint32 | GetStyles (const pdf::PDFDoc &document) |
Get font styles. 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 | IsStandardFont (const pdf::PDFDoc &document) |
Check whether current font is a standard font. 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 | IsVertWriting (const pdf::PDFDoc &document) |
Check whether current font is vertical writing. 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... | |
bool | SetEncoding (const pdf::PDFDoc &document, const char *value) |
Set the current font encoding. 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.
Enumeration for CID font charset.
Values of this enumeration should be used alone.
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.
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 Font::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. |
|
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. |
foxit::common::Font::Font | ( | const Font & | other | ) |
Constructor, with another font object.
[in] | other | Another font object. |
UInt32Array foxit::common::Font::AddUnicodes | ( | const pdf::PDFDoc & | document, |
const UInt32Array & | unicode_array | ||
) |
Add unicodes to current embedded font.
This function only support newly embedded font.
[in] | document | A valid PDF document object. |
[in] | unicode_array | The unicode array to be embedded. |
Font foxit::common::Font::Embed | ( | pdf::PDFDoc | document, |
bool | is_add_all_unicodes = true |
||
) |
Embed current font to the specified PDF document.
[in] | document | A valid PDF document object. |
[in] | is_add_all_unicodes | Whether to add unicodes that are from 0x0 to 0xFFFF to current embedded font if no unicodes which are in document are added. true means embeded unicodes that are from 0x0 to 0xFFFF, while false means that just embeded one unicode. Default: true. Users can add unicodes via Font::AddUnicodes. |
int foxit::common::Font::GetAscent | ( | ) | const |
Get the ascent value, in 1/1000 of em size (PDF units).
String foxit::common::Font::GetBaseFontName | ( | const pdf::PDFDoc & | document | ) |
Get base font name.
[in] | document | A valid PDF document object. |
RectI foxit::common::Font::GetCharBBox | ( | foxit::uint32 | unicode, |
const foxit::pdf::PDFDoc & | document | ||
) |
Get the bounding box of a character(specified by unicode) in a PDF document.
[in] | unicode | A character unicode value. |
[in] | document | A valid PDF document object. |
Get the bounding box of a character specified by unicode.
[in] | unicode | A character unicode value. |
float foxit::common::Font::GetCharWidth | ( | foxit::uint32 | unicode, |
const foxit::pdf::PDFDoc & | document | ||
) |
Get the width (in 1/1000 of em size, as PDF units) of a character (specified by unicode) in a PDF document.
[in] | unicode | A character unicode value. |
[in] | document | A valid PDF document object. |
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. |
CIDCharset foxit::common::Font::GetCIDCharset | ( | const pdf::PDFDoc & | document | ) |
Get CID font charset.
Applicable for CID based fonts. For rest type of font, exception foxit::e_ErrUnsupported will be thrown.
[in] | document | A valid PDF document object. |
int foxit::common::Font::GetDescent | ( | ) | const |
Get the descent value, in 1/1000 of em size (PDF units).
String foxit::common::Font::GetEncoding | ( | const pdf::PDFDoc & | document | ) |
Get the current font encoding.
[in] | document | A valid PDF document object. |
String foxit::common::Font::GetFamilyName | ( | ) |
Retrieve the famliy name.
FontTypes foxit::common::Font::GetFontType | ( | const pdf::PDFDoc & | document | ) |
Get font type.
[in] | document | A valid PDF document object. |
WString foxit::common::Font::GetName | ( | ) |
Retrieve the postscript name.
StandardID foxit::common::Font::GetStandard14Font | ( | const pdf::PDFDoc & | document | ) |
Get standard font ID.
Applicable for standard fonts. For rest type of font, exception foxit::e_ErrUnsupported will be thrown.
[in] | document | A valid PDF document object. |
foxit::uint32 foxit::common::Font::GetStyles | ( | const pdf::PDFDoc & | document | ) |
Get font styles.
[in] | document | A valid PDF document object. |
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::IsStandardFont | ( | const pdf::PDFDoc & | document | ) |
Check whether current font is a standard font.
[in] | document | A valid PDF document object. |
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::IsVertWriting | ( | const pdf::PDFDoc & | document | ) |
Check whether current font is vertical writing.
[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. |
bool foxit::common::Font::operator== | ( | const Font & | other | ) | const |
Equal operator.
[in] | other | Another font object. This function will check if current object is equal to this one. |
bool foxit::common::Font::SetEncoding | ( | const pdf::PDFDoc & | document, |
const char * | value | ||
) |
Set the current font encoding.
[in] | document | A valid PDF document object. |
[in] | value | The font encoding to be set. For encoding values, please refer to "TABLE 5.15 Predefined CJK CMap names" in <PDF reference 1.7> P442. This parameter should not be an empty string. |