com.lowagie.text.pdf

Class DocumentFont


public class DocumentFont
extends BaseFont

Author:
psoares

Nested Class Summary

Nested classes/interfaces inherited from class com.lowagie.text.pdf.BaseFont

BaseFont.StreamFont

Field Summary

(package private) float
Ascender
(package private) float
CapHeight
(package private) float
Descender
(package private) float
ItalicAngle
(package private) String[]
cjkEncs
(package private) BaseFont
cjkMirror
(package private) String[]
cjkNames
(package private) PdfDictionary
font
(package private) String
fontName
(package private) float
llx
(package private) float
lly
(package private) PRIndirectReference
refFont
(package private) static int[]
stdEnc
(package private) IntHashtable
uni2byte
(package private) float
urx
(package private) float
ury

Fields inherited from class com.lowagie.text.pdf.BaseFont

ASCENT, AWT_ASCENT, AWT_DESCENT, AWT_LEADING, AWT_MAXADVANCE, BBOXLLX, BBOXLLY, BBOXURX, BBOXURY, BuiltinFonts14, CACHED, CAPHEIGHT, CID_NEWLINE, COURIER, COURIER_BOLD, COURIER_BOLDOBLIQUE, COURIER_OBLIQUE, CP1250, CP1252, CP1257, DESCENT, EMBEDDED, FONT_TYPE_CJK, FONT_TYPE_DOCUMENT, FONT_TYPE_T1, FONT_TYPE_TT, FONT_TYPE_TTUNI, HELVETICA, HELVETICA_BOLD, HELVETICA_BOLDOBLIQUE, HELVETICA_OBLIQUE, IDENTITY_H, IDENTITY_V, ITALICANGLE, MACROMAN, NOT_CACHED, NOT_EMBEDDED, RESOURCE_PATH, SYMBOL, TIMES_BOLD, TIMES_BOLDITALIC, TIMES_ITALIC, TIMES_ROMAN, WINANSI, ZAPFDINGBATS, charBBoxes, differences, directTextToByte, embedded, encoding, fastWinansi, fontCache, fontSpecific, fontType, forceWidthsOutput, notdef, subset, unicodeDifferences, widths

Constructor Summary

DocumentFont(PRIndirectReference refFont)
Creates a new instance of DocumentFont

Method Summary

boolean
charExists(char c)
(package private) byte[]
convertToBytes(String text)
void
doType1TT()
(package private) void
fillEncoding(PdfName encoding)
(package private) void
fillFontDesc()
int[]
getCharBBox(char c)
String[][]
getFamilyFontName()
Gets the family name of the font.
float
getFontDescriptor(int key, float fontSize)
Gets the font parameter identified by key.
String[][]
getFullFontName()
Gets the full name of the font.
(package private) PdfIndirectReference
getIndirectReference()
int
getKerning(char char1, char char2)
Gets the kerning between two Unicode chars.
String
getPostscriptFontName()
Gets the postscript font name.
protected int[]
getRawCharBBox(int c, String name)
(package private) int
getRawWidth(int c, String name)
Gets the width from the font according to the Unicode char c or the name.
int
getWidth(String text)
boolean
hasKernPairs()
Checks if the font has any kerning pairs.
boolean
setKerning(char char1, char char2, int kern)
void
setPostscriptFontName(String name)
Sets the font name that will appear in the pdf font dictionary.
(package private) void
writeFont(PdfWriter writer, PdfIndirectReference ref, Object[] params)
Outputs to the writer the font dictionaries and streams.

Methods inherited from class com.lowagie.text.pdf.BaseFont

addFont, charExists, convertToBytes, createEncoding, createFont, createFont, createFont, createSubsetPrefix, enumerateTTCNames, enumerateTTCNames, getAllFontNames, getAscent, getAscentPoint, getBaseName, getCharBBox, getCidCode, getCodePagesSupported, getDescent, getDescentPoint, getDifferences, getDocumentFonts, getDocumentFonts, getEncoding, getFamilyFontName, getFontDescriptor, getFontType, getFullFontName, getFullFontName, getKerning, getPostscriptFontName, getRawCharBBox, getRawWidth, getResourceStream, getResourceStream, getUnicodeDifferences, getUnicodeDifferences, getUnicodeEquivalent, getWidth, getWidth, getWidthPoint, getWidthPoint, getWidthPointKerned, getWidths, hasKernPairs, isDirectTextToByte, isEmbedded, isFontSpecific, isForceWidthsOutput, isSubset, normalizeEncoding, recourseFonts, setCharAdvance, setDirectTextToByte, setForceWidthsOutput, setKerning, setPostscriptFontName, setSubset, writeFont

Field Details

Ascender

(package private)  float Ascender

CapHeight

(package private)  float CapHeight

Descender

(package private)  float Descender

ItalicAngle

(package private)  float ItalicAngle

cjkEncs

(package private)  String[] cjkEncs

cjkMirror

(package private)  BaseFont cjkMirror

cjkNames

(package private)  String[] cjkNames

font

(package private)  PdfDictionary font

fontName

(package private)  String fontName

llx

(package private)  float llx

lly

(package private)  float lly

refFont

(package private)  PRIndirectReference refFont

stdEnc

(package private) static final int[] stdEnc

uni2byte

(package private)  IntHashtable uni2byte

urx

(package private)  float urx

ury

(package private)  float ury

Constructor Details

DocumentFont

(package private)  DocumentFont(PRIndirectReference refFont)
Creates a new instance of DocumentFont

Method Details

charExists

public boolean charExists(char c)
Overrides:
charExists in interface BaseFont

convertToBytes

(package private)  byte[] convertToBytes(String text)
Overrides:
convertToBytes in interface BaseFont

doType1TT

public void doType1TT()

fillEncoding

(package private)  void fillEncoding(PdfName encoding)

fillFontDesc

(package private)  void fillFontDesc()

getCharBBox

public int[] getCharBBox(char c)
Overrides:
getCharBBox in interface BaseFont

getFamilyFontName

public String[][] getFamilyFontName()
Gets the family name of the font. If it is a True Type font each array element will have {Platform ID, Platform Encoding ID, Language ID, font name}. The interpretation of this values can be found in the Open Type specification, chapter 2, in the 'name' table.
For the other fonts the array has a single element with {"", "", "", font name}.
Overrides:
getFamilyFontName in interface BaseFont
Returns:
the family name of the font

getFontDescriptor

public float getFontDescriptor(int key,
                               float fontSize)
Gets the font parameter identified by key. Valid values for key are ASCENT, CAPHEIGHT, DESCENT, ITALICANGLE, BBOXLLX, BBOXLLY, BBOXURX and BBOXURY.
Overrides:
getFontDescriptor in interface BaseFont
Parameters:
key - the parameter to be extracted
fontSize - the font size in points
Returns:
the parameter in points

getFullFontName

public String[][] getFullFontName()
Gets the full name of the font. If it is a True Type font each array element will have {Platform ID, Platform Encoding ID, Language ID, font name}. The interpretation of this values can be found in the Open Type specification, chapter 2, in the 'name' table.
For the other fonts the array has a single element with {"", "", "", font name}.
Overrides:
getFullFontName in interface BaseFont
Returns:
the full name of the font

getIndirectReference

(package private)  PdfIndirectReference getIndirectReference()

getKerning

public int getKerning(char char1,
                      char char2)
Gets the kerning between two Unicode chars.
Overrides:
getKerning in interface BaseFont
Parameters:
char1 - the first char
char2 - the second char
Returns:
the kerning to be applied

getPostscriptFontName

public String getPostscriptFontName()
Gets the postscript font name.
Overrides:
getPostscriptFontName in interface BaseFont
Returns:
the postscript font name

getRawCharBBox

protected int[] getRawCharBBox(int c,
                               String name)
Overrides:
getRawCharBBox in interface BaseFont

getRawWidth

(package private)  int getRawWidth(int c,
                                   String name)
Gets the width from the font according to the Unicode char c or the name. If the name is null it's a symbolic font.
Overrides:
getRawWidth in interface BaseFont
Parameters:
c - the unicode char
name - the glyph name
Returns:
the width of the char

getWidth

public int getWidth(String text)
Overrides:
getWidth in interface BaseFont

hasKernPairs

public boolean hasKernPairs()
Checks if the font has any kerning pairs.
Overrides:
hasKernPairs in interface BaseFont
Returns:
true if the font has any kerning pairs

setKerning

public boolean setKerning(char char1,
                          char char2,
                          int kern)
Overrides:
setKerning in interface BaseFont

setPostscriptFontName

public void setPostscriptFontName(String name)
Sets the font name that will appear in the pdf font dictionary. It does nothing in this case as the font is already in the document.
Overrides:
setPostscriptFontName in interface BaseFont
Parameters:
name - the new font name

writeFont

(package private)  void writeFont(PdfWriter writer,
                                  PdfIndirectReference ref,
                                  Object[] params)
            throws DocumentException,
                   IOException
Outputs to the writer the font dictionaries and streams.
Parameters:
writer - the writer for this document
ref - the font indirect reference
params - several parameters that depend on the font type
Throws:
DocumentException - error in generating the object