Class Type1Font
java.lang.Object
com.itextpdf.io.font.FontProgram
com.itextpdf.io.font.Type1Font
- Direct Known Subclasses:
DocType1Font
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate Type1Parserprivate byte[]private int[]Represents the section KernPairs in the AFM file.private static final int[]Types of records in a PFB file.Fields inherited from class FontProgram
avgWidth, codeToGlyph, DEFAULT_WIDTH, encodingScheme, fontIdentification, fontMetrics, fontNames, HORIZONTAL_SCALING_FACTOR, isFontSpecific, registry, unicodeToGlyph, UNITS_NORMALIZATION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static Type1FontcreateStandardFont(String name) byte[]int[]Find glyph by glyph name.intgetKerning(Glyph first, Glyph second) Gets the kerning between two glyphs.intbooleanChecks if the font has any kerning pairs.voidinitializeGlyphs(FontEncoding fontEncoding) Fills missing character codes incodeToGlyphmap.booleanbooleanisBuiltWith(String fontProgram) Checks whether theFontProgramwas built with corresponding fontName.protected voidprocess()booleansetKerning(int first, int second, int kern) Sets the kerning between two Unicode chars.Methods inherited from class FontProgram
convertGlyphSpaceToTextSpace, convertGlyphSpaceToTextSpace, convertGlyphSpaceToTextSpace, convertTextSpaceToGlyphSpace, countOfGlyphs, fixSpaceIssue, getAvgWidth, getCharBBox, getFontIdentification, getFontMetrics, getFontNames, getGlyph, getGlyphByCode, getKerning, getRegistry, getWidth, isFontSpecific, setBbox, setBold, setCapHeight, setFixedPitch, setFontFamily, setFontName, setFontStretch, setFontWeight, setItalicAngle, setRegistry, setStemH, setStemV, setTypoAscender, setTypoDescender, setXHeight, toString, trimFontStyle
-
Field Details
-
fontParser
-
characterSet
-
kernPairs
-
PFB_TYPES
private static final int[] PFB_TYPESTypes of records in a PFB file. ASCII is 1 and BINARY is 2. They have to appear in the PFB file in this sequence. -
fontStreamBytes
private byte[] fontStreamBytes -
fontStreamLengths
private int[] fontStreamLengths
-
-
Constructor Details
-
Type1Font
protected Type1Font() -
Type1Font
protected Type1Font(String metricsPath, String binaryPath, byte[] afm, byte[] pfb) throws IOException - Throws:
IOException
-
Type1Font
-
-
Method Details
-
createStandardFont
- Throws:
IOException
-
initializeGlyphs
Fills missing character codes incodeToGlyphmap.- Parameters:
fontEncoding- to be used to map unicode values to character codes.
-
isBuiltInFont
public boolean isBuiltInFont() -
getPdfFontFlags
public int getPdfFontFlags()- Specified by:
getPdfFontFlagsin classFontProgram
-
getCharacterSet
-
hasKernPairs
public boolean hasKernPairs()Checks if the font has any kerning pairs.- Overrides:
hasKernPairsin classFontProgram- Returns:
trueif the font has any kerning pairs.
-
getKerning
Description copied from class:FontProgramGets the kerning between two glyphs.- Specified by:
getKerningin classFontProgram- Parameters:
first- the first glyphsecond- the second glyph- Returns:
- the kerning to be applied
-
setKerning
public boolean setKerning(int first, int second, int kern) Sets the kerning between two Unicode chars.- Parameters:
first- the first unicode char.second- the second unicode char.kern- the kerning to apply in normalized 1000 units.- Returns:
trueif the kerning was applied,falseotherwise.
-
getGlyph
-
getFontStreamBytes
public byte[] getFontStreamBytes() -
getFontStreamLengths
public int[] getFontStreamLengths() -
isBuiltWith
Description copied from class:FontProgramChecks whether theFontProgramwas built with corresponding fontName. Default value is false unless overridden.- Overrides:
isBuiltWithin classFontProgram- Parameters:
fontProgram- a font name or path to a font program- Returns:
- true, if the FontProgram was built with the fontProgram. Otherwise false.
-
process
- Throws:
IOException
-