Foxit PDF SDK
|
Public Member Functions | |
Font (Font other) | |
Constructor, with another font object. More... | |
Font (int font_id) throws com.foxit.sdk.PDFException | |
Constructor, by a standard font ID. More... | |
Font (String font_file_path, int face_index, int charset) throws com.foxit.sdk.PDFException | |
Constructor, from a font file. More... | |
Font (String name, int styles, int charset, int weight) throws com.foxit.sdk.PDFException | |
Constructor, with given attribute. More... | |
UInt32Array | addUnicodes (PDFDoc document, UInt32Array unicode_array) throws com.foxit.sdk.PDFException |
Add unicodes to current embedded font. More... | |
synchronized void | delete () |
Clean up related resources immediately. More... | |
Font | embed (PDFDoc document, boolean is_add_all_unicodes) throws com.foxit.sdk.PDFException |
Embed current font to the specified PDF document. More... | |
int | getAscent () throws com.foxit.sdk.PDFException |
Get the ascent value, in 1/1000 of em size (PDF units). More... | |
String | getBaseFontName (PDFDoc document) throws com.foxit.sdk.PDFException |
Get base font name. More... | |
RectI | getCharBBox (int unicode) throws com.foxit.sdk.PDFException |
Get the bounding box of a character specified by unicode. More... | |
RectI | getCharBBox (int unicode, PDFDoc document) throws com.foxit.sdk.PDFException |
Get the bounding box of a character(specified by unicode) in a PDF document. More... | |
float | getCharWidth (int unicode) throws com.foxit.sdk.PDFException |
Get the width (in 1/1000 of em size (PDF units)) of a character specified by unicode. More... | |
float | getCharWidth (int unicode, PDFDoc document) throws com.foxit.sdk.PDFException |
Get the width (in 1/1000 of em size, as PDF units) of a character (specified by unicode) in a PDF document. More... | |
int | getCIDCharset (PDFDoc document) throws com.foxit.sdk.PDFException |
Get CID font charset. More... | |
int | getDescent () throws com.foxit.sdk.PDFException |
Get the descent value, in 1/1000 of em size (PDF units). More... | |
String | getEncoding (PDFDoc document) throws com.foxit.sdk.PDFException |
Get the current font encoding. More... | |
String | getFamilyName () throws com.foxit.sdk.PDFException |
Retrieve the famliy name. More... | |
int | getFontType (PDFDoc document) throws com.foxit.sdk.PDFException |
Get font type. More... | |
String | getName () throws com.foxit.sdk.PDFException |
Retrieve the postscript name. More... | |
int | getStandard14Font (PDFDoc document) throws com.foxit.sdk.PDFException |
Get standard font ID. More... | |
int | getStyles (PDFDoc document) throws com.foxit.sdk.PDFException |
Get font styles. More... | |
boolean | isBold () throws com.foxit.sdk.PDFException |
Judge whether current font is bold or not. More... | |
boolean | isEmbedded (PDFDoc document) throws com.foxit.sdk.PDFException |
Judge whether current font is embedded in a specified PDF document or not. More... | |
boolean | isEmpty () |
Check whether current object is empty or not. More... | |
boolean | isItalic () throws com.foxit.sdk.PDFException |
Judge whether current font object is italic or not. More... | |
boolean | isStandardFont (PDFDoc document) throws com.foxit.sdk.PDFException |
Check whether current font is a standard font. More... | |
boolean | isSupportEmbedded (PDFDoc document) throws com.foxit.sdk.PDFException |
Check whether current font is supported to be embedded to the specified PDF document or not. More... | |
boolean | isVertWriting (PDFDoc document) throws com.foxit.sdk.PDFException |
Check whether current font is vertical writing. More... | |
boolean | setEncoding (PDFDoc document, String value) throws com.foxit.sdk.PDFException |
Set the current font encoding. More... | |
Static Public Attributes | |
static final int | e_CharsetANSI = 0 |
Font charset: ANSI (United States, Western Europe). | |
static final int | e_CharsetArabic = 178 |
Font charset: Arabic. | |
static final int | e_CharsetBaltic = 186 |
Font charset: Baltic. | |
static final int | e_CharsetChineseBig5 = 136 |
Font charset: Traditional Chinese. | |
static final int | e_CharsetDefault = 1 |
Font charset: System default, for unknown or mapping purpose. | |
static final int | e_CharsetEastEurope = 238 |
Font charset: Eastern European. | |
static final int | e_CharsetGB2312 = 134 |
Font charset: Simplified Chinese. | |
static final int | e_CharsetGreek = 161 |
Font charset: Greek. | |
static final int | e_CharsetHangeul = 129 |
Font charset: Korean (Wansung). | |
static final int | e_CharsetHebrew = 177 |
Font charset: Hebrew. | |
static final int | e_CharsetRussian = 204 |
Font charset: Russian. | |
static final int | e_CharsetShift_JIS = 128 |
Font charset: Japanese (Shift-JIS). | |
static final int | e_CharsetSymbol = 2 |
Font charset: Standard symbols. | |
static final int | e_CharsetThai = 222 |
Font charset: Thai. | |
static final int | e_CharsetTurkish = 162 |
Font charset: Turkish. | |
static final int | e_CIDCharsetCNS1 = 2 |
CID Font charset: Adobe-CNS1. | |
static final int | e_CIDCharsetGB1 = 1 |
CID Font charset: Adobe-GB1. | |
static final int | e_CIDCharsetJAPAN1 = 3 |
CID Font charset: Adobe-Japan1. | |
static final int | e_CIDCharsetKOREA1 = 4 |
CID Font charset: Adobe-Korea1. | |
static final int | e_CIDCharsetUNICODE = 5 |
CID Font charset: Unicode. | |
static final int | e_CIDCharsetUnknown = 0 |
CID Font charset: Unknown. | |
static final int | e_FontTypeCIDFont = 4 |
Font type: CID font. | |
static final int | e_FontTypeTrueType = 2 |
Font type: TrueType. | |
static final int | e_FontTypeType1 = 1 |
Font type: Type1. | |
static final int | e_FontTypeType3 = 3 |
Font type: Type3. | |
static final int | e_StdIDCourier = 0 |
Standard font: Courier. | |
static final int | e_StdIDCourierB = 1 |
Standard font: Courier-Bold. | |
static final int | e_StdIDCourierBI = 2 |
Standard font: Courier-BoldOblique, Bold italic. | |
static final int | e_StdIDCourierI = 3 |
Standard font: Courier-Oblique, Italic. | |
static final int | e_StdIDHelvetica = 4 |
Standard font: Helvetica. | |
static final int | e_StdIDHelveticaB = 5 |
Standard font: Helvetica-Bold. | |
static final int | e_StdIDHelveticaBI = 6 |
Standard font: Helvetica-BoldOblique, Bold italic. | |
static final int | e_StdIDHelveticaI = 7 |
Standard font: Helvetica-Oblique, Italic. | |
static final int | e_StdIDSymbol = 12 |
Standard font: Symbol. | |
static final int | e_StdIDTimes = 8 |
Standard font: Times-Roman. | |
static final int | e_StdIDTimesB = 9 |
Standard font: Times-Bold. | |
static final int | e_StdIDTimesBI = 10 |
Standard font: Times-BoldItalic. | |
static final int | e_StdIDTimesI = 11 |
Standard font: Times-Italic. | |
static final int | e_StdIDZapfDingbats = 13 |
Standard font: ZapfDingbats. | |
static final int | e_StyleAllCap = 0x10000 |
Font style: all cap. | |
static final int | e_StyleFixedPitch = 0x0001 |
Font style: fixed pitch. | |
static final int | e_StyleItalic = 0x0040 |
Font style: italic. | |
static final int | e_StyleNonSymbolic = 0x0020 |
Font style: non-symbolic. | |
static final int | e_StylesBold = 0x40000 |
Font style: force bold. | |
static final int | e_StyleScript = 0x0008 |
Font style: script. | |
static final int | e_StyleSerif = 0x0002 |
Font style: serif. | |
static final int | e_StylesSmallCap = 0x20000 |
Font style: small cap. | |
static final int | e_StyleSymbolic = 0x0004 |
Font style: symbolic. | |
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.
com.foxit.sdk.common.Font.Font | ( | String | name, |
int | styles, | ||
int | charset, | ||
int | weight | ||
) | throws com.foxit.sdk.PDFException |
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 com.foxit.sdk.common.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 com.foxit.sdk.common.Font.e_CharsetANSI and this should be one of these values. |
[in] | weight | Original font weight. 0 means unspecified. |
com.foxit.sdk.common.Font.Font | ( | int | font_id | ) | throws com.foxit.sdk.PDFException |
Constructor, by a standard font ID.
[in] | font_id | Standard font ID of the font to be created. Please refer to values starting from com.foxit.sdk.common.Font.e_StdIDCourier and this should be one of these values. |
com.foxit.sdk.common.Font.Font | ( | String | font_file_path, |
int | face_index, | ||
int | charset | ||
) | throws com.foxit.sdk.PDFException |
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 com.foxit.sdk.common.Font.e_CharsetANSI and this should be one of these values. |
com.foxit.sdk.common.Font.Font | ( | Font | other | ) |
Constructor, with another font object.
[in] | other | Another font object. |
UInt32Array com.foxit.sdk.common.Font.addUnicodes | ( | PDFDoc | document, |
UInt32Array | unicode_array | ||
) | throws com.foxit.sdk.PDFException |
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. |
synchronized void com.foxit.sdk.common.Font.delete | ( | ) |
Clean up related resources immediately.
Reimplemented from com.foxit.sdk.common.Base.
Font com.foxit.sdk.common.Font.embed | ( | PDFDoc | document, |
boolean | is_add_all_unicodes | ||
) | throws com.foxit.sdk.PDFException |
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 com.foxit.sdk.common.Font.getAscent | ( | ) | throws com.foxit.sdk.PDFException |
Get the ascent value, in 1/1000 of em size (PDF units).
String com.foxit.sdk.common.Font.getBaseFontName | ( | PDFDoc | document | ) | throws com.foxit.sdk.PDFException |
Get base font name.
[in] | document | A valid PDF document object. |
RectI com.foxit.sdk.common.Font.getCharBBox | ( | int | unicode | ) | throws com.foxit.sdk.PDFException |
Get the bounding box of a character specified by unicode.
[in] | unicode | A character unicode value. |
RectI com.foxit.sdk.common.Font.getCharBBox | ( | int | unicode, |
PDFDoc | document | ||
) | throws com.foxit.sdk.PDFException |
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. |
float com.foxit.sdk.common.Font.getCharWidth | ( | int | unicode | ) | throws com.foxit.sdk.PDFException |
Get the width (in 1/1000 of em size (PDF units)) of a character specified by unicode.
[in] | unicode | A character unicode value. |
float com.foxit.sdk.common.Font.getCharWidth | ( | int | unicode, |
PDFDoc | document | ||
) | throws com.foxit.sdk.PDFException |
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. |
int com.foxit.sdk.common.Font.getCIDCharset | ( | PDFDoc | document | ) | throws com.foxit.sdk.PDFException |
Get CID font charset.
Applicable for CID based fonts. For rest type of font, exception com.foxit.sdk.common.Constants.e_ErrUnsupported will be thrown.
[in] | document | A valid PDF document object. |
int com.foxit.sdk.common.Font.getDescent | ( | ) | throws com.foxit.sdk.PDFException |
Get the descent value, in 1/1000 of em size (PDF units).
String com.foxit.sdk.common.Font.getEncoding | ( | PDFDoc | document | ) | throws com.foxit.sdk.PDFException |
Get the current font encoding.
[in] | document | A valid PDF document object. |
String com.foxit.sdk.common.Font.getFamilyName | ( | ) | throws com.foxit.sdk.PDFException |
Retrieve the famliy name.
int com.foxit.sdk.common.Font.getFontType | ( | PDFDoc | document | ) | throws com.foxit.sdk.PDFException |
Get font type.
[in] | document | A valid PDF document object. |
String com.foxit.sdk.common.Font.getName | ( | ) | throws com.foxit.sdk.PDFException |
Retrieve the postscript name.
int com.foxit.sdk.common.Font.getStandard14Font | ( | PDFDoc | document | ) | throws com.foxit.sdk.PDFException |
Get standard font ID.
Applicable for standard fonts. For rest type of font, exception com.foxit.sdk.common.Constants.e_ErrUnsupported will be thrown.
[in] | document | A valid PDF document object. |
int com.foxit.sdk.common.Font.getStyles | ( | PDFDoc | document | ) | throws com.foxit.sdk.PDFException |
Get font styles.
[in] | document | A valid PDF document object. |
boolean com.foxit.sdk.common.Font.isBold | ( | ) | throws com.foxit.sdk.PDFException |
Judge whether current font is bold or not.
boolean com.foxit.sdk.common.Font.isEmbedded | ( | PDFDoc | document | ) | throws com.foxit.sdk.PDFException |
Judge whether current font is embedded in a specified PDF document or not.
[in] | document | A valid PDF document object. |
boolean com.foxit.sdk.common.Font.isEmpty | ( | ) |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
boolean com.foxit.sdk.common.Font.isItalic | ( | ) | throws com.foxit.sdk.PDFException |
Judge whether current font object is italic or not.
boolean com.foxit.sdk.common.Font.isStandardFont | ( | PDFDoc | document | ) | throws com.foxit.sdk.PDFException |
Check whether current font is a standard font.
[in] | document | A valid PDF document object. |
boolean com.foxit.sdk.common.Font.isSupportEmbedded | ( | PDFDoc | document | ) | throws com.foxit.sdk.PDFException |
Check whether current font is supported to be embedded to the specified PDF document or not.
[in] | document | A valid PDF document object. |
boolean com.foxit.sdk.common.Font.isVertWriting | ( | PDFDoc | document | ) | throws com.foxit.sdk.PDFException |
Check whether current font is vertical writing.
[in] | document | A valid PDF document object. |
boolean com.foxit.sdk.common.Font.setEncoding | ( | PDFDoc | document, |
String | value | ||
) | throws com.foxit.sdk.PDFException |
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. |