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...
 
(NSString *) - getBaseFontName:
 Get base font name.
More...
 
(FSRectI *) - getCharBBox:
 Get the bounding box of a character specified by unicode.
More...
 
(FSRectI *) - getCharBBoxWithPDFDoc:document:
 Get the bounding box of a character(specified by unicode) in a PDF document.
More...
 
(float) - getCharWidth:
 Get the width (in 1/1000 of em size (PDF units)) of a character specified by unicode.
More...
 
(float) - getCharWidthWithPDFDoc:document:
 Get the width (in 1/1000 of em size, as PDF units) of a character (specified by unicode) in a PDF document.
More...
 
(FSFontCIDCharset- getCIDCharset:
 Get CID font charset.
More...
 
(int) - getDescent
 Get the descent value, in 1/1000 of em size (PDF units).
More...
 
(NSString *) - getEncoding:
 Get the current font encoding.
More...
 
(NSString *) - getFamilyName
 Retrieve the famliy name.
More...
 
(FSFontFontTypes- getFontType:
 Get font type.
More...
 
(NSString *) - getName
 Retrieve the postscript name.
More...
 
(FSFontStandardID- getStandard14Font:
 Get standard font ID.
More...
 
(unsigned int) - getStyles:
 Get font styles.
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) - isStandardFont:
 Check whether current font is a standard font.
More...
 
(BOOL) - isSupportEmbedded:
 Check whether current font is supported to be embedded to the specified PDF document or not.
More...
 
(BOOL) - isVertWriting:
 Check whether current font is vertical writing.
More...
 
(BOOL) - setEncoding:value:
 Set the current font encoding.
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).

◆ getBaseFontName:()

- (NSString *) getBaseFontName: (FSPDFDoc*)  document

Get base font name.

Parameters
[in]documentA valid PDF document object.
Returns
Base font name.

◆ 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.

◆ getCharBBoxWithPDFDoc:document:()

- (FSRectI *) getCharBBoxWithPDFDoc: (unsigned int)  unicode
document: (FSPDFDoc*)  document 

Get the bounding box of a character(specified by unicode) in a PDF document.

Parameters
[in]unicodeA character unicode value.
[in]documentA valid PDF document object.
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).

◆ getCharWidthWithPDFDoc:document:()

- (float) getCharWidthWithPDFDoc: (unsigned int)  unicode
document: (FSPDFDoc*)  document 

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

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

◆ getCIDCharset:()

- (FSFontCIDCharset) getCIDCharset: (FSPDFDoc*)  document

Get CID font charset.

Applicable for CID based fonts. For rest type of font, exception FSErrUnsupported will be thrown.

Parameters
[in]documentA valid PDF document object.
Returns
Font charset. Please refer to values starting from FSFontCIDCharsetUnknown and this would be one of these values.

◆ 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).

◆ getEncoding:()

- (NSString *) getEncoding: (FSPDFDoc*)  document

Get the current font encoding.

Parameters
[in]documentA valid PDF document object.
Returns
The value of font encoding, please refer to "TABLE 5.15 Predefined CJK CMap names" in <PDF reference 1.7> P442.

◆ getFamilyName()

- (NSString *) getFamilyName

Retrieve the famliy name.

Returns
The famliy name.

◆ getFontType:()

- (FSFontFontTypes) getFontType: (FSPDFDoc*)  document

Get font type.

Parameters
[in]documentA valid PDF document object.
Returns
Font type. Please refer to values starting from FSFontFontTypeType1 and this would be one of these values.

◆ getName()

- (NSString *) getName

Retrieve the postscript name.

Returns
The postscript name.

◆ getStandard14Font:()

- (FSFontStandardID) getStandard14Font: (FSPDFDoc*)  document

Get standard font ID.

Applicable for standard fonts. For rest type of font, exception FSErrUnsupported will be thrown.

Parameters
[in]documentA valid PDF document object.
Returns
Standard font ID. Please refer to values starting from FSFontStdIDCourier and this would be one of these values.

◆ getStyles:()

- (unsigned int) getStyles: (FSPDFDoc*)  document

Get font styles.

Parameters
[in]documentA valid PDF document object.
Returns
Font styles. Please refer to values starting from FSFontStyleFixedPitch and this would be one or a combination of these values.

◆ 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.

◆ isStandardFont:()

- (BOOL) isStandardFont: (FSPDFDoc*)  document

Check whether current font is a standard font.

Parameters
[in]documentA valid PDF document object.
Returns
YES means current font is a standard font, 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.

◆ isVertWriting:()

- (BOOL) isVertWriting: (FSPDFDoc*)  document

Check whether current font is vertical writing.

Parameters
[in]documentA valid PDF document object.
Returns
YES means current font is vertical writing, while NO means current font is not vertical writing.

◆ setEncoding:value:()

- (BOOL) setEncoding: (FSPDFDoc*)  document
value: (NSString *)  value 

Set the current font encoding.

Parameters
[in]documentA valid PDF document object.
[in]valueThe 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.
Returns
YES means success, while NO means failed.