foxit.common.Font Class Reference
Inheritance diagram for foxit.common.Font:
foxit.common.Base

Public Types

enum  Charset {
  Charset.e_CharsetANSI = 0, Charset.e_CharsetDefault = 1, Charset.e_CharsetSymbol = 2, Charset.e_CharsetShift_JIS = 128,
  Charset.e_CharsetHangeul = 129, Charset.e_CharsetGB2312 = 134, Charset.e_CharsetChineseBig5 = 136, Charset.e_CharsetThai = 222,
  Charset.e_CharsetEastEurope = 238, Charset.e_CharsetRussian = 204, Charset.e_CharsetGreek = 161, Charset.e_CharsetTurkish = 162,
  Charset.e_CharsetHebrew = 177, Charset.e_CharsetArabic = 178, Charset.e_CharsetBaltic = 186
}
 Enumeration for font charset.
More...
 
enum  StandardID {
  StandardID.e_StdIDCourier = 0, StandardID.e_StdIDCourierB = 1, StandardID.e_StdIDCourierBI = 2, StandardID.e_StdIDCourierI = 3,
  StandardID.e_StdIDHelvetica = 4, StandardID.e_StdIDHelveticaB = 5, StandardID.e_StdIDHelveticaBI = 6, StandardID.e_StdIDHelveticaI = 7,
  StandardID.e_StdIDTimes = 8, StandardID.e_StdIDTimesB = 9, StandardID.e_StdIDTimesBI = 10, StandardID.e_StdIDTimesI = 11,
  StandardID.e_StdIDSymbol = 12, StandardID.e_StdIDZapfDingbats = 13
}
 Enumeration for standard font ID.
More...
 
enum  Styles {
  Styles.e_StyleFixedPitch = 0x0001, Styles.e_StyleSerif = 0x0002, Styles.e_StyleSymbolic = 0x0004, Styles.e_StyleScript = 0x0008,
  Styles.e_StyleNonSymbolic = 0x0020, Styles.e_StyleItalic = 0x0040, Styles.e_StyleAllCap = 0x10000, Styles.e_StylesSmallCap = 0x20000,
  Styles.e_StylesBold = 0x40000
}
 Enumeration for font styles.
More...
 

Public Member Functions

 Font (string name, int styles, Font.Charset charset, int weight)
 Constructor, with given attribute. More...
 
 Font (Font.StandardID font_id)
 Constructor, by a standard font ID. More...
 
 Font (string font_file_path, int face_index, Font.Charset charset)
 Constructor, from a font file. More...
 
 Font (Font arg0)
 Constructor, with another Font object.

 
Font Embed (PDFDoc document)
 Embed current font to the specified PDF document. More...
 
int GetAscent ()
 Get the ascent value, in 1/1000 of em size (PDF units). More...
 
RectI GetCharBBox (int unicode)
 Get the bounding box of a character specified by unicode. More...
 
float GetCharWidth (int unicode)
 Get the width (in 1/1000 of em size (PDF units)) of a character specified by unicode. More...
 
int GetDescent ()
 Get the descent value, in 1/1000 of em size (PDF units). More...
 
string GetName ()
 Retrieve the face name. More...
 
bool IsBold ()
 Judge whether current font is bold or not. More...
 
bool IsEmbedded (PDFDoc document)
 Judge whether current font is embedded in a specified PDF document or not. More...
 
bool IsEmpty ()
 Check whether current object is empty or not. More...
 
bool IsItalic ()
 Judge whether current font object is italic or not. More...
 
bool IsSupportEmbedded (PDFDoc document)
 Check whether current font is supported to be embedded to the specified PDF document or not. More...
 

Detailed Description

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.

Member Enumeration Documentation

◆ Charset

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.

◆ StandardID

Enumeration for standard font ID.

Values of this enumeration should be used alone.

Enumerator
e_StdIDCourier 

Standard font: Courier.

e_StdIDCourierB 

Standard font: Courier-Bold.

e_StdIDCourierBI 

Standard font: Courier-BoldOblique, Bold italic.

e_StdIDCourierI 

Standard font: Courier-Oblique, Italic.

e_StdIDHelvetica 

Standard font: Helvetica.

e_StdIDHelveticaB 

Standard font: Helvetica-Bold.

e_StdIDHelveticaBI 

Standard font: Helvetica-BoldOblique, Bold italic.

e_StdIDHelveticaI 

Standard font: Helvetica-Oblique, Italic.

e_StdIDTimes 

Standard font: Times-Roman.

e_StdIDTimesB 

Standard font: Times-Bold.

e_StdIDTimesBI 

Standard font: Times-BoldItalic.

e_StdIDTimesI 

Standard font: Times-Italic.

e_StdIDSymbol 

Standard font: Symbol.

e_StdIDZapfDingbats 

Standard font: ZapfDingbats.

◆ Styles

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 & Destructor Documentation

◆ Font() [1/3]

foxit.common.Font.Font ( string  name,
int  styles,
Font.Charset  charset,
int  weight 
)
inline

Constructor, with given attribute.

This function is to construct font based on system fonts.

Parameters
nameThe PostScript name of the font to be created.
stylesFont styles. Please refer to e_StyleXXX values and it can be one or a combination of these values.
charsetThe charset of the font to be created. Please refer to e_CharsetXXX values and this should be one of these values.
weightOriginal font weight. 0 means unspecified.

◆ Font() [2/3]

foxit.common.Font.Font ( Font.StandardID  font_id)
inline

Constructor, by a standard font ID.

Parameters
font_idStandard font ID of the font to be created. Please refer to e_StdIDXXX values and it should be one of these values.

◆ Font() [3/3]

foxit.common.Font.Font ( string  font_file_path,
int  face_index,
Font.Charset  charset 
)
inline

Constructor, from a font file.

Parameters
font_file_pathA full path to an existing font file.
face_indexThe zero-based face index. Valid range: from 0 to (face_count-1). Please call the system functions to get the face_count.
charsetThe charset of the font to be created. Please refer to e_CharsetXXX values and this should be one of these values.

Member Function Documentation

◆ Embed()

Font foxit.common.Font.Embed ( PDFDoc  document)
inline

Embed current font to the specified PDF document.

Parameters
documentA valid PDF document object.
Returns
The embedded font.

◆ GetAscent()

int foxit.common.Font.GetAscent ( )
inline

Get the ascent value, in 1/1000 of em size (PDF units).

Returns
The ascent value, in 1/1000 of em size (PDF units).

◆ GetCharBBox()

RectI foxit.common.Font.GetCharBBox ( int  unicode)
inline

Get the bounding box of a character specified by unicode.

Parameters
unicodeA character unicode value.
Returns
The character bounding box.

◆ GetCharWidth()

float foxit.common.Font.GetCharWidth ( int  unicode)
inline

Get the width (in 1/1000 of em size (PDF units)) of a character specified by unicode.

Parameters
unicodeA character unicode value.
Returns
The character width, in 1/1000 of em size (PDF units).

◆ GetDescent()

int foxit.common.Font.GetDescent ( )
inline

Get the descent value, in 1/1000 of em size (PDF units).

Returns
The descent value, in 1/1000 of em size (PDF units).

◆ GetName()

string foxit.common.Font.GetName ( )
inline

Retrieve the face name.

Returns
The face name.

◆ IsBold()

bool foxit.common.Font.IsBold ( )
inline

Judge whether current font is bold or not.

Returns
true means current font is bold, while false means not.

◆ IsEmbedded()

bool foxit.common.Font.IsEmbedded ( PDFDoc  document)
inline

Judge whether current font is embedded in a specified PDF document or not.

Parameters
documentA valid PDF document object.
Returns
true means the font is embedded in the specified PDF document, while false means not.

◆ IsEmpty()

bool foxit.common.Font.IsEmpty ( )
inline

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
true means current object is empty, while false means not.

◆ IsItalic()

bool foxit.common.Font.IsItalic ( )
inline

Judge whether current font object is italic or not.

Returns
true means current font is italic, while false means not.

◆ IsSupportEmbedded()

bool foxit.common.Font.IsSupportEmbedded ( PDFDoc  document)
inline

Check whether current font is supported to be embedded to the specified PDF document or not.

Parameters
documentA valid PDF document object.
Returns
true means current font is supported to be embedded to the specified PDF document, while false means not.

Foxit Software Corporation Logo
@2018 Foxit Software Incorporated. All rights reserved.