|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lowagie.text.pdf.BaseFont
com.lowagie.text.pdf.Type1Font
Reads a Type1 font
Nested Class Summary |
Nested classes inherited from class com.lowagie.text.pdf.BaseFont |
BaseFont.StreamFont |
Field Summary | |
private int |
Ascender
A variable. |
private boolean |
builtinFont
true if this font is one of the 14 built in fonts. |
private int |
CapHeight
A variable. |
private String |
CharacterSet
The character set of the font. |
private ArrayList |
CharMetrics
Represents the section CharMetrics in the AFM file. |
private int |
Descender
A variable. |
private String |
EncodingScheme
The font's encoding name. |
private String |
FamilyName
The family name of the font. |
private String |
fileName
The file in use. |
private String |
FontName
The Postscript font name. |
private String |
FullName
The full name of the font. |
private boolean |
IsFixedPitch
true if all the characters have the same
width. |
private float |
ItalicAngle
The italic angle of the font, usually 0.0 or negative. |
private HashMap |
KernPairs
Represents the section KernPairs in the AFM file. |
private int |
llx
The llx of the FontBox. |
private int |
lly
The lly of the FontBox. |
protected byte[] |
pfb
The PFB file if the input was made with a byte array. |
private static int[] |
pfbTypes
Types of records in a PFB file. |
private static FontsResourceAnchor |
resourceAnchor
|
private int |
StdHW
A variable. |
private int |
StdVW
A variable. |
private int |
UnderlinePosition
The underline position. |
private int |
UnderlineThickness
The underline thickness. |
private int |
urx
The lurx of the FontBox. |
private int |
ury
The ury of the FontBox. |
private String |
Weight
The weight of the font: normal, bold, etc. |
private int |
XHeight
A variable. |
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, differences, directTextToByte, embedded, EMBEDDED, encoding, fastWinansi, FONT_TYPE_CJK, FONT_TYPE_DOCUMENT, FONT_TYPE_T1, FONT_TYPE_TT, FONT_TYPE_TTUNI, fontCache, fontSpecific, fontType, forceWidthsOutput, HELVETICA, HELVETICA_BOLD, HELVETICA_BOLDOBLIQUE, HELVETICA_OBLIQUE, IDENTITY_H, IDENTITY_V, ITALICANGLE, MACROMAN, NOT_CACHED, NOT_EMBEDDED, notdef, RESOURCE_PATH, subset, SYMBOL, TIMES_BOLD, TIMES_BOLDITALIC, TIMES_ITALIC, TIMES_ROMAN, unicodeDifferences, widths, WINANSI, ZAPFDINGBATS |
Constructor Summary | |
(package private) |
Type1Font(String afmFile,
String enc,
boolean emb,
byte[] ttfAfm,
byte[] pfb)
Creates a new Type1 font. |
Method Summary | |
String[][] |
getFamilyFontName()
Gets the family name of the font. |
private PdfDictionary |
getFontBaseType(PdfIndirectReference fontDescriptor,
int firstChar,
int lastChar,
byte[] shortTag)
Generates the font dictionary for this font. |
float |
getFontDescriptor(int key,
float fontSize)
Gets the font parameter identified by key . |
private PdfDictionary |
getFontDescriptor(PdfIndirectReference fontStream)
Generates the font descriptor for this font or null if it is
one of the 14 built in fonts. |
private PdfStream |
getFontStream()
If the embedded flag is false or if the font is
one of the 14 built in types, it returns null ,
otherwise the font is read and output in a PdfStream object. |
String[][] |
getFullFontName()
Gets the full name of the font. |
int |
getKerning(char char1,
char char2)
Gets the kerning between two Unicode characters. |
String |
getPostscriptFontName()
Gets the postscript font name. |
(package private) int |
getRawWidth(int c,
String name)
Gets the width from the font according to the name or,
if the name is null, meaning it is a symbolic font,
the char c . |
boolean |
hasKernPairs()
Checks if the font has any kerning pairs. |
void |
process(RandomAccessFileOrArray rf)
Reads the font metrics |
(package private) void |
writeFont(PdfWriter writer,
PdfIndirectReference ref,
Object[] params)
Outputs to the writer the font dictionaries and streams. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static FontsResourceAnchor resourceAnchor
protected byte[] pfb
byte
array.
private String FontName
private String FullName
private String FamilyName
private String Weight
private float ItalicAngle
private boolean IsFixedPitch
true
if all the characters have the same
width.
private String CharacterSet
private int llx
private int lly
private int urx
private int ury
private int UnderlinePosition
private int UnderlineThickness
private String EncodingScheme
private int CapHeight
private int XHeight
private int Ascender
private int Descender
private int StdHW
private int StdVW
private ArrayList CharMetrics
Object[3]
with an
Integer, Integer and String. This is the code, width and name.
private HashMap KernPairs
Object[]
with 2 elements for each kern pair. Position 0 is the name of
the second character and position 1 is the kerning distance. This is
repeated for all the pairs.
private String fileName
private boolean builtinFont
true
if this font is one of the 14 built in fonts.
private static final int[] pfbTypes
Constructor Detail |
Type1Font(String afmFile, String enc, boolean emb, byte[] ttfAfm, byte[] pfb) throws DocumentException, IOException
ttfAfm
- the AFM file if the input is made with a byte
arraypfb
- the PFB file if the input is made with a byte
arrayafmFile
- the name of one of the 14 built-in fonts or the location of an AFM file. The file must end in '.afm'enc
- the encoding to be applied to this fontemb
- true if the font is to be embedded in the PDF
DocumentException
- the AFM file is invalid
IOException
- the AFM file could not be readMethod Detail |
int getRawWidth(int c, String name)
name
or,
if the name
is null, meaning it is a symbolic font,
the char c
.
getRawWidth
in class BaseFont
c
- the char if the font is symbolicname
- the glyph name
public int getKerning(char char1, char char2)
HashMap
KernPairs
.
getKerning
in class BaseFont
char1
- the first charchar2
- the second char
public void process(RandomAccessFileOrArray rf) throws DocumentException, IOException
rf
- the AFM file
DocumentException
- the AFM file is invalid
IOException
- the AFM file could not be readprivate PdfStream getFontStream() throws DocumentException
false
or if the font is
one of the 14 built in types, it returns null
,
otherwise the font is read and output in a PdfStream object.
null
DocumentException
- if there is an error reading the fontprivate PdfDictionary getFontDescriptor(PdfIndirectReference fontStream)
null
if it is
one of the 14 built in fonts.
fontStream
- the indirect reference to a PdfStream containing the font or null
null
private PdfDictionary getFontBaseType(PdfIndirectReference fontDescriptor, int firstChar, int lastChar, byte[] shortTag)
firstChar
- the first valid characterlastChar
- the last valid charactershortTag
- a 256 bytes long byte
array where each unused byte is represented by 0fontDescriptor
- the indirect reference to a PdfDictionary containing the font descriptor or null
void writeFont(PdfWriter writer, PdfIndirectReference ref, Object[] params) throws DocumentException, IOException
writeFont
in class BaseFont
writer
- the writer for this documentref
- the font indirect referenceparams
- several parameters that depend on the font type
IOException
- on error
DocumentException
- error in generating the objectpublic float getFontDescriptor(int key, float fontSize)
key
. Valid values
for key
are ASCENT
, CAPHEIGHT
, DESCENT
,
ITALICANGLE
, BBOXLLX
, BBOXLLY
, BBOXURX
and BBOXURY
.
getFontDescriptor
in class BaseFont
key
- the parameter to be extractedfontSize
- the font size in points
public String getPostscriptFontName()
getPostscriptFontName
in class BaseFont
public String[][] getFullFontName()
getFullFontName
in class BaseFont
public String[][] getFamilyFontName()
getFamilyFontName
in class BaseFont
public boolean hasKernPairs()
hasKernPairs
in class BaseFont
true
if the font has any kerning pairs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |