Foxit PDF SDK
FSFont Class Reference
Inheritance diagram for FSFont:
FSBase

Instance Methods

(FSFont *) - embed:
 Embed current font to the specified PDF document.
More...
 
(int) - getAscent
 Get the ascent value, in 1/1000 of em size (PDF units).
More...
 
(FSRectI *) - getCharBBox:
 Get the bounding box of a character specified by unicode.
More...
 
(float) - getCharWidth:
 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...
 
(NSString *) - getName
 Retrieve the face name.
More...
 
(id) - initWithFont_file_path:face_index:charset:
 Constructor, from a font file.
More...
 
(id) - initWithFont_id:
 Constructor, by a standard font ID.
More...
 
(id) - initWithName:styles:charset:weight:
 Constructor, with given attribute.
More...
 
(id) - initWithOther:
 Constructor, with another font object.
More...
 
(BOOL) - isBold
 Judge whether current font is bold or not.
More...
 
(BOOL) - isEmbedded:
 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:
 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.

Method Documentation

◆ embed:()

- (FSFont *) embed: (FSPDFDoc*)  document

Embed current font to the specified PDF document.

Parameters
[in]documentA valid PDF document object.
Returns
The embedded font.

◆ getAscent()

- (int) getAscent

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:()

- (FSRectI *) getCharBBox: (unsigned int)  unicode

Get the bounding box of a character specified by unicode.

Parameters
[in]unicodeA character unicode value.
Returns
The character bounding box.

◆ getCharWidth:()

- (float) getCharWidth: (unsigned int)  unicode

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

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

◆ getDescent()

- (int) getDescent

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()

- (NSString *) getName

Retrieve the face name.

Returns
The face name.

◆ initWithFont_file_path:face_index:charset:()

- (id) initWithFont_file_path: (NSString *)  font_file_path
face_index: (int)  face_index
charset: (FSFontCharset charset 

Constructor, from a font file.

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

◆ initWithFont_id:()

- (id) initWithFont_id: (FSFontStandardID font_id

Constructor, by a standard font ID.

Parameters
[in]font_idStandard font ID of the font to be created. Please refer to values starting from FSFontStdIDCourier and this should be one of these values.

◆ initWithName:styles:charset:weight:()

- (id) initWithName: (NSString *)  name
styles: (unsigned int)  styles
charset: (FSFontCharset charset
weight: (int)  weight 

Constructor, with given attribute.

This function is to construct font based on system fonts.

Parameters
[in]nameThe PostScript name of the font to be created.
[in]stylesFont styles. Please refer to values starting from FSFontStyleFixedPitch and this can be one or a combination of these values.
[in]charsetThe charset of the font to be created. Please refer to values starting from FSFontCharsetANSI and this should be one of these values.
[in]weightOriginal font weight. 0 means unspecified.

◆ initWithOther:()

- (id) initWithOther: (FSFont*)  other

Constructor, with another font object.

Parameters
[in]otherAnother font object.

◆ isBold()

- (BOOL) isBold

Judge whether current font is bold or not.

Returns
YES means current font is bold, while NO means not.

◆ isEmbedded:()

- (BOOL) isEmbedded: (FSPDFDoc*)  document

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

Parameters
[in]documentA valid PDF document object.
Returns
YES means the font is embedded in the specified PDF document, while NO means not.

◆ isEmpty()

- (BOOL) isEmpty

Check whether current object is empty or not.

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

Returns
YES means current object is empty, while NO means not.

◆ isItalic()

- (BOOL) isItalic

Judge whether current font object is italic or not.

Returns
YES means current font is italic, while NO means not.

◆ isSupportEmbedded:()

- (BOOL) isSupportEmbedded: (FSPDFDoc*)  document

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

Parameters
[in]documentA valid PDF document object.
Returns
YES means current font is supported to be embedded to the specified PDF document, while NO means not.