Gnostice PDFOne
Pro. Ed. v5.0.0


com.gnostice.pdfone.fonts
Class PdfFont

java.lang.Object
  extended bycom.gnostice.pdfone.fonts.PdfFont
All Implemented Interfaces:
Cloneable, Usable

public abstract class PdfFont
extends Object
implements Usable, Cloneable

This class represents a font that can be used in a PDF document.

There are several types of fonts such as Standard Type 1 and TrueType. Standard Type-1 fonts are:

The plain, bold, italic, and bold-italic versions of these fonts are expected to be supported by all PDF applications. When non-standard fonts are used in a PDF document, then those fonts need to be available on the operating system to enable applications to correctly render text using the font. To ensure that a font is displayed correctly even when the font is not installed, the font needs to be embedded in the document. Fonts can either be full embedded or subset embedded. When a font is "full embedded," all font information is placed inside the document. With "subset embedding" information regarding only those glyphs that are actually used in the document are placed in the document.

Since:
1.0
Version:
1.0

Field Summary
static int BOLD
          Style for bold type.
static int CID_TYPE_0
           
static int CID_TYPE_2
           
static int CJK_TYPE
           
static byte EMBED_FULL
          Constant for embedding entire font in the document.
static byte EMBED_SUBSET
          Constant for embedding font subset in the document.
static int FLAG_ALLCAP
          Font contains no lowercase letters; typically used for display purposes, such as for titles or headlines.
static int FLAG_FIXEDPITCH
          All glyphs have the same width (as opposed to proportional or variable-pitch fonts, which have different widths).
static int FLAG_FORCEBOLD
          The ForceBold flag determines whether bold glyphs are painted with extra pixels even at very small text sizes.
static int FLAG_ITALIC
          Glyphs have dominant vertical strokes that are slanted.
static int FLAG_NONSYMBOLIC
          Font uses the Adobe standard Latin character set or a subset of it (see below).
static int FLAG_SCRIPT
          Glyphs resemble cursive handwriting.
static int FLAG_SERIF
          Glyphs have serifs, which are short strokes drawn at an angle on the top and bottom of glyph stems.
static int FLAG_SMALLCAP
          Font contains both uppercase and lowercase letters.
static int FLAG_SYMBOLIC
          Font contains glyphs outside the Adobe standard Latin character set.
static PdfName FONT_DESCRIPTOR
           
static int ITALIC
          Style for italic type.
static int PLAIN
          Style for normal type.
static int STROKE
          Style for stroked text rendering.
static int STROKE_AND_FILL
          Style for stroked and filled text rendering.
static int TRUE_TYPE
           
static int TYPE_1
           
static int UNDERLINE
          Style for underline decoration.
 
Fields inherited from interface com.gnostice.pdfone.Usable
INCHES_TO_POINTS, MM_TO_INCHES, MM_TO_POINTS, PDF_A, PDF_AA, PDF_AC, PDF_ACROFORM, PDF_ACTION, PDF_ALTERNATEPRESENTATIONS, PDF_ANNOT, PDF_ANNOT_DEFAULT_TITLE, PDF_ANNOT_NAME, PDF_ANNOT_SUBJECT, PDF_ANNOTS, PDF_AP, PDF_ARRAYEND, PDF_ARRAYSTART, PDF_ARTBOX, PDF_AS, PDF_ASCENT, PDF_ASCII85, PDF_ASCII85_NEW, PDF_ASCIIHEX, PDF_ASCIIHEX_NEW, PDF_AuthEvent, PDF_AUTHOR, PDF_AVGWIDTH, PDF_B, PDF_BASEFONT, PDF_BBOX, PDF_BC, PDF_BE, PDF_BEFOREFORMAT, PDF_BEGINTEXT, PDF_BG, PDF_BINARYDATA, PDF_BITS_PER_COMPONENT, PDF_BL, PDF_BLEEDBOX, PDF_BLINDS, PDF_BMC, PDF_BORDER, PDF_BOX, PDF_BS, PDF_BTN, PDF_BYTERANGE, PDF_C, PDF_CA, PDF_CA_SMALL, PDF_CAPHEIGHT, PDF_CARETANNOT, PDF_CARRIAGE, PDF_CATALOG, PDF_CENTER_WINDOW, PDF_CF, PDF_CFM, PDF_CH, PDF_CID_TO_GID_MAP, PDF_CIDFONT_TYPE1, PDF_CIDFONT_TYPE2, PDF_CIDSYSTEM_INFO, PDF_CIRCLEANNOT, PDF_CL, PDF_CM, PDF_COLOMNS, PDF_COLOR, PDF_COLORSPACE, PDF_COLORSPACE_CALGRAY, PDF_COLORSPACE_CALRGB, PDF_COLORSPACE_DEVICEN, PDF_COLORSPACE_ICCBASED, PDF_COLORSPACE_LAB, PDF_COLORSPACE_SEPARATION, PDF_CONTACTINFO, PDF_CONTENTS, PDF_COUNT, PDF_COVER, PDF_CREATIONDATE, PDF_CREATOR, PDF_CROPBOX, PDF_CS, PDF_CSP, PDF_D, PDF_DA, PDF_DATE, PDF_DATE_FORMAT, PDF_DCTDECODE, PDF_DCTDECODE_NEW, PDF_DECODEPARMS, PDF_DESC, PDF_DESCENDANT, PDF_DESCENDANT_FONTS, PDF_DESCENDENTFONTS, PDF_DESCENT, PDF_DESTINATION, PDF_DESTS, PDF_DEVICE_CMYK, PDF_DEVICE_GRAY, PDF_DEVICE_RGB, PDF_DI, PDF_DICTEND, PDF_DICTSTART, PDF_DIFFERENCES, PDF_DIRECTION, PDF_DISPLAY_DOCTITLE, PDF_DISPLAY_DURATION, PDF_DISSOLVE, PDF_DM, PDF_DOC_SUBJECT, PDF_DOCMDP, PDF_DOS, PDF_DP, PDF_DR, PDF_DS, PDF_DV, PDF_DW, PDF_E, PDF_EF, PDF_EMBEDDEDFILE, PDF_EMBEDDEDFILES, PDF_EMC, PDF_ENCODING, PDF_ENCRYPT, PDF_ENCRYPTMETADATA, PDF_ENDOBJ, PDF_ENDPATH, PDF_ENDSTREAM, PDF_ENDTEXT, PDF_EOCLIP, PDF_EOF, PDF_EXTGSTATE, PDF_F, PDF_FADE, PDF_FALSE, PDF_FDESCRIPTOR, PDF_FIELD_FLAG, PDF_FIELDS, PDF_FILEATTACHMENTANNOT, PDF_FILESPEC, PDF_FILTER, PDF_FIRST, PDF_FIRST_PAGE, PDF_FIRSTCHAR, PDF_FIT, PDF_FIT_WINDOW, PDF_FITB, PDF_FITBH, PDF_FITBV, PDF_FITH, PDF_FITR, PDF_FITV, PDF_FIXEDPRINT, PDF_FLAGS, PDF_FLATE, PDF_FLATE_NEW, PDF_FLY, PDF_FO, PDF_FONT, PDF_FONTBBOX, PDF_FONTDESCRIPTOR, PDF_FONTFILE, PDF_FONTFILE_2, PDF_FontFile_3, PDF_FONTFILE2, PDF_FONTNAME, PDF_FONTNAMEPREFIX, PDF_FORM, PDF_FORMFEED, PDF_FORMFONTPREFIX, PDF_FREE_TEXT_CALLOUT, PDF_FREE_TEXT_TYPEWRITER, PDF_FREETEXTANNOT, PDF_FS, PDF_FT, PDF_FULLSCREEN, PDF_GLITTER, PDF_GOTO_ACTION, PDF_GROUP, PDF_GS, PDF_H, PDF_HEADER, PDF_HEIGHT, PDF_HEXSTRINGEND, PDF_HEXSTRINGSTART, PDF_HIDE_MENUBAR, PDF_HIDE_TOOLBAR, PDF_HIDE_WINDOWUI, PDF_HIGHLIGHT, PDF_HORIZ_STEM, PDF_HORIZONTAL, PDF_I, PDF_IC, PDF_ID, PDF_IDS, PDF_IF, PDF_IMAGE, PDF_IMAGEB, PDF_IMAGEC, PDF_IMAGEI, PDF_IMPORTDATA, PDF_INDEX, PDF_INDEXED, PDF_INFO, PDF_INK, PDF_INKLIST, PDF_INWARD, PDF_IT, PDF_ITALANGLE, PDF_IX, PDF_JAVASCRIPT, PDF_JAVASCRIPT_ACTION, PDF_JS, PDF_KEYSTROKE, PDF_KEYWORDS, PDF_KIDS, PDF_L, PDF_L2R, PDF_LANG, PDF_LAST, PDF_LAST_PAGE, PDF_LASTCHAR, PDF_LAUNCH_ACTION, PDF_LE, PDF_LEGAL, PDF_LENGTH, PDF_LENGTH_1, PDF_LENGTH_2, PDF_LENGTH_3, PDF_LF, PDF_LINEANNOT, PDF_LINKANNOT, PDF_LITERALSTRINGEND, PDF_LITERALSTRINGSTART, PDF_LOCATION, PDF_LZWDECODE, PDF_M, PDF_MAC, PDF_MARKINFO, PDF_MATRIX, PDF_MAXLEN, PDF_MAXWIDTH, PDF_MEDIABOX, PDF_METADATA, PDF_MISSINGWIDTH, PDF_MK, PDF_MODDATE, PDF_N, PDF_NAME, PDF_NAMED, PDF_NAMED_ACT_FIND, PDF_NAMED_ACT_OPEN, PDF_NAMED_ACT_PRINT, PDF_NAMED_ACT_SEARCH, PDF_NAMES, PDF_NAMESTART, PDF_NEEDAPPEARANCES, PDF_NEWLINE, PDF_NEWWINDOW, PDF_NEXT, PDF_NEXT_PAGE, PDF_NO_COMP_OBJ, PDF_NONFULLSCREEN_PAGEMODE, PDF_NULL, PDF_O, PDF_OBJ, PDF_OBJSTREAM, PDF_OCPROPERTIES, PDF_OFF, PDF_ONECOLUMN, PDF_OPEN, PDF_OPEN_ACTION, PDF_OPT, PDF_OUTLINES, PDF_OUTPUTINTENTS, PDF_OUTWARD, PDF_P, PDF_PAGE, PDF_PAGECLOSE, PDF_PAGEINVISIBLE, PDF_PAGELABELS, PDF_PAGELAYOUT, PDF_PAGEMODE, PDF_PAGEOPEN, PDF_PAGES, PDF_PAGEVISIBLE, PDF_PAINT_TYPE, PDF_PARAMS, PDF_PARENT, PDF_PATTERN, PDF_PATTERN_TYPE, PDF_PBD, PDF_PC, PDF_PDC, PDF_PDF, PDF_PERMS, PDF_PFD, PDF_PH, PDF_PIECEINFO, PDF_POLYGONANNOT, PDF_POLYLINEANNOT, PDF_POPUP, PDF_PREDICTOR, PDF_PREV, PDF_PREV_PAGE, PDF_PROCSET, PDF_PRODUCER, PDF_PROPERTIES, PDF_PUSH, PDF_PV, PDF_Q, PDF_QUADPOINTS, PDF_R, PDF_R2L, PDF_RC, PDF_RD, PDF_RE, PDF_REASON, PDF_RECALCULATE, PDF_RECT, PDF_REMOTEGOTO_ACTION, PDF_RENDITIONS, PDF_REPLACE, PDF_RESET_FORM, PDF_RESOURCES, PDF_RESTORE_GS, PDF_RI, PDF_ROOT, PDF_ROTATE, PDF_RUNLENGTH, PDF_RUNLENGTH_NEW, PDF_S, PDF_SCN, PDF_SHADING, PDF_SHOWIMG, PDF_SHOWTEXT, PDF_SHOWTEXT_TJ, PDF_SIG, PDF_SIG_FILTER_ADOBE_PPKLITE, PDF_SIG_FILTER_ADOBE_PPKMS, PDF_SIG_SUBFILTER_ADBE_PKCS7_DETACHED, PDF_SIG_SUBFILTER_ADBE_PKCS7_SHA1, PDF_SINGLE_QUOTES, PDF_SINGLEPAGE, PDF_SIZE, PDF_SP, PDF_SPIDERINFO, PDF_SPLIT, PDF_SQUAREANNOT, PDF_SQUIGGLY, PDF_SS, PDF_STAMPANNOT, PDF_STARTXREF, PDF_StmF, PDF_STORE_GS, PDF_STREAM, PDF_StrF, PDF_STRIKEOUT, PDF_STRUCT_TREE, PDF_SUBFILTER, PDF_SUBMIT_FORM, PDF_SUBTYPE, PDF_T, PDF_TAB, PDF_TEMPLATES, PDF_TEXT, PDF_TEXTANNOT, PDF_TEXTDIMENSION, PDF_TEXTFONT, PDF_TEXTLEAD, PDF_TEXTMATRIX, PDF_TEXTNEWLINESTART, PDF_TEXTRENDER, PDF_TEXTWIDTH, PDF_THREADS, PDF_THUMB, PDF_TILING_TYPE, PDF_TITLE, PDF_TJ_OPERAND_END, PDF_TJ_OPERAND_START, PDF_TM, PDF_TOUNICODE, PDF_TP, PDF_TRAILER, PDF_TRANSITION, PDF_TRIMBOX, PDF_TRUE, PDF_TRUETYPE, PDF_TU, PDF_TWOCOLUMN_LEFT, PDF_TWOCOLUMN_RIGHT, PDF_TWOPAGE_LEFT, PDF_TWOPAGE_RIGHT, PDF_TX, PDF_TYPE, PDF_TYPE0, PDF_TYPE1, PDF_U, PDF_UNCOVER, PDF_UNDERLINE, PDF_UNIX, PDF_URI_ACTION, PDF_URL, PDF_URLS, PDF_USEATTACHMENTS, PDF_USENONE, PDF_USEOC, PDF_USEOUTLINES, PDF_USETHUMBS, PDF_V, PDF_VALUECHANGE, PDF_VERSION, PDF_VERT_STEM, PDF_VERTICAL, PDF_VERTICES, PDF_VIEWER_PREFERENCES, PDF_W, PDF_WATERMARKANNOT, PDF_WIDGET, PDF_WIDTH, PDF_WIDTHS, PDF_WINANSIENCODING, PDF_WIPE, PDF_X, PDF_XOBJECT, PDF_XREF, PDF_XREFSTMOFFSET, PDF_XREFSTREAM, PDF_XSTEP, PDF_XYZ, PDF_YES, PDF_YSTEP, PIXEL_PER_INCH, RUBICON_EMBEDDED, SITE, TEXT, TWIPS_TO_POINTS
 
Method Summary
static void adjustFontSize(PdfFont font, PdfRect rect, String value)
           
 Object clone()
           
static PdfFont create(String name, int size, int encoding)
          Returns a new PdfFont object created for the specified font with specified size and character encoding.
static PdfFont create(String name, int size, int encoding, byte embedType)
          Returns a new PdfFont object created for the specified font with specified size, character encoding, and embedding method.
static PdfFont create(String name, int style, int size, int encoding)
          Returns a new PdfFont object created for the specified font with specified style, size, and character encoding.
static PdfFont create(String name, int style, int size, int encoding, byte embedType)
          Returns a new PdfFont object created for the specified font with specified style, size, character encoding, and embedding method.
abstract  void dispose()
           
 int getAscent()
           
 int getAvgWidth()
           
abstract  String getBaseFontName()
           
 int getCapHeight()
           
 Color getColor()
          Returns color of this font.
abstract  void getData(HashMap hm)
           
 int getDescent()
           
 byte getEmbedType()
          Returns constant representing this font's embedding method.
 int getEncoding()
          Returns constant representing this font's character encoding.
 int getFirstChar()
           
 int getFlags()
          Returns text formatting style used by this font.
 PdfArray getFontBBox()
           
abstract  double getHeight()
          Returns height of this font as specified in its font file.
 int getItalicangle()
          Returns slope of the dominant vertical strokes of this font.
 int getLastChar()
           
 int getMaxWidth()
           
 String getName()
          Returns name of this font.
 String getPDFName()
           
 int getSize()
          Returns user-defined size for this font.
 int getStemH()
          Returns thickness of the dominant horizontal stem of glyphs of the font.
 int getStemV()
          Returns thickness of the dominant vertical stem of glyphs of the font.
 Color getStrokeColor()
          Returns color used to stroke this font's characters.
 int getStrokeWidth()
          Returns width of strokes used by this font's characters.
 int getStyle()
          Returns constant or combined value of constants representing this font's styles.
 int getType()
          Returns font type.
abstract  int getUnderlinePosition()
           
abstract  int getUnderlineThickness()
           
abstract  int getWidth(char c)
          Returns width of character c, as mentioned in this font's file.
abstract  double getWidth(char c, int mu)
          Returns width of character c in this font in specified measurement unit.
abstract  int getWidth(String text)
          Returns sum of widths of all characters in text, as mentioned in this font's file.
abstract  double getWidth(String text, int mu)
          Returns width of text in the font in specified measurement unit.
 double getWidth(String text, int mu, boolean excludeEndSpaces)
          Excludes trailing white space characters in specified text based on excludeEndSpaces and returns width of resultant text in this font in specified measurement unit.
abstract  int[] getWidths()
          Returns an array of glyph widths of all characters in this font, arranged in the order of their character codes.
 void setColor(Color color)
          Specifies color for this font.
 void setFirstChar(int firstChar)
           
 void setLastChar(int lastChar)
           
 void setSize(int size)
          Specifies a size for this font.
 void setStrokeColor(Color strokeColor)
          Specifies color that needs to be used to stroke this font's characters.
 void setStrokeWidth(int strokeWidth)
          Specifies width of strokes that need to be used by this font's characters.
abstract  void setStyle(int style)
          Specifies this font's styles.
 void updateGlyphList()
           
 void updateGlyphList(PdfStream toUniCodeStream, PdfDict descendantFontDict)
           
 byte[] updateGlyphList(String text)
          Ensures that only glyphs required to render specified text will be embedded in the document by the font.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FONT_DESCRIPTOR

public static final PdfName FONT_DESCRIPTOR

TYPE_1

public static final int TYPE_1
See Also:
Constant Field Values

TRUE_TYPE

public static final int TRUE_TYPE
See Also:
Constant Field Values

CJK_TYPE

public static final int CJK_TYPE
See Also:
Constant Field Values

CID_TYPE_2

public static final int CID_TYPE_2
See Also:
Constant Field Values

CID_TYPE_0

public static final int CID_TYPE_0
See Also:
Constant Field Values

PLAIN

public static final int PLAIN
Style for normal type.

See Also:
Constant Field Values

BOLD

public static final int BOLD
Style for bold type.

See Also:
Constant Field Values

ITALIC

public static final int ITALIC
Style for italic type.

See Also:
Constant Field Values

UNDERLINE

public static final int UNDERLINE
Style for underline decoration.

See Also:
Constant Field Values

STROKE

public static final int STROKE
Style for stroked text rendering.

See Also:
Constant Field Values

STROKE_AND_FILL

public static final int STROKE_AND_FILL
Style for stroked and filled text rendering.

See Also:
Constant Field Values

EMBED_FULL

public static final byte EMBED_FULL
Constant for embedding entire font in the document.

See Also:
Constant Field Values

EMBED_SUBSET

public static final byte EMBED_SUBSET
Constant for embedding font subset in the document.

See Also:
Constant Field Values

FLAG_FIXEDPITCH

public static final int FLAG_FIXEDPITCH
All glyphs have the same width (as opposed to proportional or variable-pitch fonts, which have different widths).

See Also:
Constant Field Values

FLAG_SERIF

public static final int FLAG_SERIF
Glyphs have serifs, which are short strokes drawn at an angle on the top and bottom of glyph stems. (Sans serif fonts do not have serifs.)

See Also:
Constant Field Values

FLAG_SYMBOLIC

public static final int FLAG_SYMBOLIC
Font contains glyphs outside the Adobe standard Latin character set. This flag and the Nonsymbolic flag cannot both be set or both be clear (see below).

See Also:
Constant Field Values

FLAG_SCRIPT

public static final int FLAG_SCRIPT
Glyphs resemble cursive handwriting.

See Also:
Constant Field Values

FLAG_NONSYMBOLIC

public static final int FLAG_NONSYMBOLIC
Font uses the Adobe standard Latin character set or a subset of it (see below).

See Also:
Constant Field Values

FLAG_ITALIC

public static final int FLAG_ITALIC
Glyphs have dominant vertical strokes that are slanted.

See Also:
Constant Field Values

FLAG_ALLCAP

public static final int FLAG_ALLCAP
Font contains no lowercase letters; typically used for display purposes, such as for titles or headlines.

See Also:
Constant Field Values

FLAG_SMALLCAP

public static final int FLAG_SMALLCAP
Font contains both uppercase and lowercase letters. The uppercase letters are similar to those in the regular version of the same typeface family. The glyphs for the lowercase letters have the same shapes as the corresponding uppercase letters, but they are sized and their proportions adjusted so that they have the same size and stroke weight as lowercase glyphs in the same typeface family.

See Also:
Constant Field Values

FLAG_FORCEBOLD

public static final int FLAG_FORCEBOLD
The ForceBold flag determines whether bold glyphs are painted with extra pixels even at very small text sizes.

See Also:
Constant Field Values
Method Detail

adjustFontSize

public static void adjustFontSize(PdfFont font,
                                  PdfRect rect,
                                  String value)

clone

public Object clone()

create

public static PdfFont create(String name,
                             int size,
                             int encoding)
                      throws IOException,
                             PdfException
Returns a new PdfFont object created for the specified font with specified size and character encoding.

Parameters:
name - name of the standard font or the pathname of the font file
size - (expressed in page measurement units) size of the font
encoding - constant specifying the font's character encoding
Returns:
a new PdfFont object
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.
Since:
1.0
See Also:
PdfEncodings
Sample Code
See example.

create

public static PdfFont create(String name,
                             int style,
                             int size,
                             int encoding)
                      throws IOException,
                             PdfException
Returns a new PdfFont object created for the specified font with specified style, size, and character encoding.

Parameters:
name - name of the standard font or the pathname of the font file
style - constant or combined value of constants specifying the style of the font
size - (expressed in page measurement units) size of the font
encoding - constant specifying the font's character encoding
Returns:
a new PdfFont object
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.
Since:
1.0
See Also:
PdfEncodings
Sample Code
See example.

create

public static PdfFont create(String name,
                             int size,
                             int encoding,
                             byte embedType)
                      throws IOException,
                             PdfException
Returns a new PdfFont object created for the specified font with specified size, character encoding, and embedding method.

Parameters:
name - name of the built-in font or pathname of the font file
size - size of the font
encoding - constant specifying the font's character encoding
embedType - constant specifying how the font needs to be embedded
Returns:
a new PdfFont object
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.
Since:
1.0
See Also:
PdfEncodings
Sample Code
See example.

create

public static PdfFont create(String name,
                             int style,
                             int size,
                             int encoding,
                             byte embedType)
                      throws IOException,
                             PdfException
Returns a new PdfFont object created for the specified font with specified style, size, character encoding, and embedding method.

Parameters:
name - name of the standard font or the pathname of the font file
style - constant or combined value of constants specifying the style of the font
size - (expressed in page measurement units) size of the font
encoding - constant specifying the font's character encoding
embedType - constant specifying how the font needs to be embedded
Returns:
1.0
Throws:
IOException - if an I/O error occurs.
PdfException - if an illegal argument is supplied.
Since:
1.0
See Also:
PdfEncodings
Sample Code
See example.

getColor

public Color getColor()
Returns color of this font.

Returns:
color of the font.
Since:
1.0
See Also:
setColor(Color)
Sample Code
See example.

setColor

public void setColor(Color color)
Specifies color for this font.

Parameters:
color - color for the font
Since:
1.0
Sample Code
See example.

getStrokeColor

public Color getStrokeColor()
Returns color used to stroke this font's characters.

Returns:
color used to stroke the font's characters
Since:
1.0
See Also:
setStrokeColor(Color)
Sample Code
See example.

setStrokeColor

public void setStrokeColor(Color strokeColor)
Specifies color that needs to be used to stroke this font's characters.

Parameters:
strokeColor - color that needs to be used to stroke the font's characters
Since:
1.0
See Also:
getStrokeColor()
Sample Code
See example.

getName

public String getName()
Returns name of this font.

Returns:
name of the font
Since:
1.0
Sample Code
See example.

getPDFName

public String getPDFName()

getSize

public int getSize()
Returns user-defined size for this font.

Returns:
user-defined size for the font
Since:
1.0
See Also:
setSize(int)

setSize

public void setSize(int size)
Specifies a size for this font.

Parameters:
size - size for the font
Since:
1.0
See Also:
getSize()
Sample Code
See example.

getType

public int getType()
Returns font type.

Returns:
constant specifying font type

getStyle

public int getStyle()
Returns constant or combined value of constants representing this font's styles.

Returns:
constant or combined value of constants representing the font's styles
Since:
1.0
See Also:
setStyle(int)
Sample Code
See example.

getStrokeWidth

public int getStrokeWidth()
Returns width of strokes used by this font's characters.

Returns:
width of strokes used by the font's characters
Since:
1.0
See Also:
setStrokeWidth(int)
Sample Code
See example.

setStrokeWidth

public void setStrokeWidth(int strokeWidth)
Specifies width of strokes that need to be used by this font's characters.

Parameters:
strokeWidth - width of strokes that need to be used by the font's characters
Since:
1.0
See Also:
getStrokeWidth()
Sample Code
See example.

getEncoding

public int getEncoding()
Returns constant representing this font's character encoding.

Returns:
constant representing the font's character encoding
Since:
1.0
See Also:
PdfEncodings
Sample Code
See example.

getAscent

public int getAscent()

getAvgWidth

public int getAvgWidth()

getCapHeight

public int getCapHeight()

getDescent

public int getDescent()

getFlags

public int getFlags()
Returns text formatting style used by this font.

Returns:
constant or combined value of constants representing styles used by the font
Since:
1.0
Sample Code
See example.

getFontBBox

public PdfArray getFontBBox()

getItalicangle

public int getItalicangle()
Returns slope of the dominant vertical strokes of this font.

Returns:
(expressed in degrees and measured counterclockwise) slope of the dominant vertical strokes of the font
Since:
1.0
Sample Code
See example.

getMaxWidth

public int getMaxWidth()

getStemH

public int getStemH()
Returns thickness of the dominant horizontal stem of glyphs of the font. A stem is an important stroke in a glyph.

Returns:
thickness of the dominant horizontal stem of glyphs of the font
See Also:
getStemV()

getStemV

public int getStemV()
Returns thickness of the dominant vertical stem of glyphs of the font. A stem is an important stroke in a glyph.

Returns:
thickness of the dominant vertical stem of glyphs of the font
See Also:
getStemH()

getEmbedType

public byte getEmbedType()
Returns constant representing this font's embedding method.

Returns:
constant representing the font's embedding method
Since:
1.0
Sample Code
See example.

getFirstChar

public int getFirstChar()

getLastChar

public int getLastChar()

updateGlyphList

public byte[] updateGlyphList(String text)
                       throws PdfException,
                              IOException
Ensures that only glyphs required to render specified text will be embedded in the document by the font.

Parameters:
text - text for which glyphs need to be embedded
Throws:
PdfException - if an illegal argument is supplied.
IOException - if an I/O error occurs.

setFirstChar

public void setFirstChar(int firstChar)

setLastChar

public void setLastChar(int lastChar)

updateGlyphList

public void updateGlyphList()

updateGlyphList

public void updateGlyphList(PdfStream toUniCodeStream,
                            PdfDict descendantFontDict)

getWidth

public double getWidth(String text,
                       int mu,
                       boolean excludeEndSpaces)
Excludes trailing white space characters in specified text based on excludeEndSpaces and returns width of resultant text in this font in specified measurement unit.

Parameters:
text - piece of text
mu - measurement unit in which the width is to be expressed
excludeEndSpaces - whether to exclude trailing white space characters
Returns:
(expressed in specified measurement unit) width of the resultant text
Since:
1.0
Sample Code
See example.

setStyle

public abstract void setStyle(int style)
Specifies this font's styles.

Parameters:
style - constant or combined value of constants specifying this font's styles.
Since:
1.0
See Also:
getStyle()
Sample Code
See example.

getHeight

public abstract double getHeight()
Returns height of this font as specified in its font file.

Returns:
height of the font as specified in its font file
Since:
1.0
Sample Code
See example.

getWidths

public abstract int[] getWidths()
Returns an array of glyph widths of all characters in this font, arranged in the order of their character codes.

Returns:
an array of glyph widths of all characters in the font, arranged in the order of their character codes
Since:
1.0

getWidth

public abstract int getWidth(char c)
Returns width of character c, as mentioned in this font's file.

Parameters:
c - single character
Returns:
width of this character as mentioned in the font's file
Since:
1.0
Sample Code
See example.

getWidth

public abstract int getWidth(String text)
Returns sum of widths of all characters in text, as mentioned in this font's file.

Parameters:
text - piece of text
Returns:
sum of widths of all characters text, as mentioned in this font's file
Since:
1.0
Sample Code
See example.

getWidth

public abstract double getWidth(char c,
                                int mu)
Returns width of character c in this font in specified measurement unit.

Parameters:
c - single character
mu - measurement unit in which the width needs to be expressed
Returns:
(expressed in specified measurement unit) width of the character in the font
Since:
1.0
Sample Code
See example.

getWidth

public abstract double getWidth(String text,
                                int mu)
Returns width of text in the font in specified measurement unit.

Parameters:
text - piece of text
mu - measurement unit in which the width needs to be expressed
Returns:
(expressed in specified measurement unit) width of the text in the font
Since:
1.0
Sample Code
See example.

getUnderlinePosition

public abstract int getUnderlinePosition()

getUnderlineThickness

public abstract int getUnderlineThickness()

getData

public abstract void getData(HashMap hm)
                      throws IOException,
                             PdfException
Throws:
IOException
PdfException

getBaseFontName

public abstract String getBaseFontName()

dispose

public abstract void dispose()
                      throws IOException
Throws:
IOException

Gnostice PDFOne
Pro. Ed. v5.0.0

To contact our support team, send an e-mail to support@gnostice.com.
 
© 2010 Gnostice Information Technologies Private Limited. All rights reserved.
www.gnostice.com