|
![]() |
||||||||
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
class Type1Font
Reads a Type1 font
Nested Class Summary |
---|
Nested classes/interfaces 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 HashMap |
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[] |
PFB_TYPES
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. |
Constructor Summary | |
---|---|
Type1Font(String afmFile,
String enc,
boolean emb,
byte[] ttfAfm,
byte[] pfb,
boolean forceRead)
Creates a new Type1 font. |
Method Summary | |
---|---|
String[][] |
getAllNameEntries()
Gets all the entries of the names-table. |
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. |
String[][] |
getFullFontName()
Gets the full name of the font. |
PdfStream |
getFullFontStream()
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. |
int |
getKerning(int char1,
int char2)
Gets the kerning between two Unicode characters. |
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 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 |
boolean |
setKerning(int char1,
int char2,
int kern)
Sets the kerning between two Unicode chars. |
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 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 HashMap CharMetrics
Object[4]
with an
Integer, Integer, String and int[]. This is the code, width, name and char bbox.
The key is the name of the char and also an Integer with the char number.
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[] PFB_TYPES
Constructor Detail |
---|
Type1Font(String afmFile, String enc, boolean emb, byte[] ttfAfm, byte[] pfb, boolean forceRead) 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(int char1, int 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 readpublic PdfStream getFullFontStream() 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.
getFullFontStream
in class BaseFont
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[][] getAllNameEntries()
getAllNameEntries
in class BaseFont
public String[][] getFamilyFontName()
getFamilyFontName
in class BaseFont
public boolean hasKernPairs()
hasKernPairs
in class BaseFont
true
if the font has any kerning pairspublic void setPostscriptFontName(String name)
setPostscriptFontName
in class BaseFont
name
- the new font namepublic boolean setKerning(int char1, int char2, int kern)
setKerning
in class BaseFont
char1
- the first charchar2
- the second charkern
- the kerning to apply in normalized 1000 units
true
if the kerning was applied, false
otherwiseprotected int[] getRawCharBBox(int c, String name)
getRawCharBBox
in class BaseFont
|
Hosted by Hostbasket | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |