Package com.itextpdf.kernel.font
Class Type3Font
- java.lang.Object
-
- com.itextpdf.io.font.FontProgram
-
- com.itextpdf.kernel.font.Type3Font
-
public class Type3Font extends FontProgram
FontProgram class for Type 3 font. Contains map ofType3Glyph. Type3Glyphs belong to a particular pdf document. Note, an instance of Type3Font can not be reused for multiple pdf documents.
-
-
Field Summary
Fields Modifier and Type Field Description private booleancolorizedprivate intflagsprivate java.util.Map<java.lang.Integer,Type3Glyph>type3Glyphsprivate java.util.Map<java.lang.Integer,Type3Glyph>type3GlyphsWithoutUnicodeStores glyphs without associated unicode.-
Fields inherited from class com.itextpdf.io.font.FontProgram
avgWidth, codeToGlyph, DEFAULT_WIDTH, encodingScheme, fontIdentification, fontMetrics, fontNames, HORIZONTAL_SCALING_FACTOR, isFontSpecific, registry, unicodeToGlyph, UNITS_NORMALIZATION
-
-
Constructor Summary
Constructors Constructor Description Type3Font(boolean colorized)Creates a Type 3 font program.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddGlyph(int code, int unicode, int width, int[] bbox, Type3Glyph type3Glyph)intgetKerning(Glyph glyph1, Glyph glyph2)Gets the kerning between two glyphs.intgetNumberOfGlyphs()Returns number of glyphs for this font.intgetPdfFontFlags()Type3GlyphgetType3Glyph(int unicode)Returns a glyph by unicode.Type3GlyphgetType3GlyphByCode(int code)Returns a glyph by its code.booleanisColorized()booleanisFontSpecific()private voidrecalculateAverageWidth()private voidremoveGlyphFromMappings(int glyphCode)protected voidsetCapHeight(int capHeight)Sets the capital letters height.protected voidsetFontFamily(java.lang.String fontFamily)Sets a preferred font family name.protected voidsetFontName(java.lang.String fontName)Sets the PostScript name of the font.protected voidsetFontStretch(java.lang.String fontWidth)Sets font width in css notation (font-stretch property)protected voidsetFontWeight(int fontWeight)Sets font weight.protected voidsetItalicAngle(int italicAngle)Sets the PostScript italic angle.(package private) voidsetPdfFontFlags(int flags)Sets Font descriptor flags.protected voidsetTypoAscender(int ascender)Sets typo ascender.protected voidsetTypoDescender(int descender)Sets typo descender.-
Methods inherited from class com.itextpdf.io.font.FontProgram
convertGlyphSpaceToTextSpace, convertGlyphSpaceToTextSpace, convertGlyphSpaceToTextSpace, convertTextSpaceToGlyphSpace, countOfGlyphs, fixSpaceIssue, getAvgWidth, getCharBBox, getFontIdentification, getFontMetrics, getFontNames, getGlyph, getGlyphByCode, getKerning, getRegistry, getWidth, hasKernPairs, isBuiltWith, setBbox, setBold, setFixedPitch, setRegistry, setStemH, setStemV, setXHeight, toString
-
-
-
-
Field Detail
-
type3Glyphs
private final java.util.Map<java.lang.Integer,Type3Glyph> type3Glyphs
-
type3GlyphsWithoutUnicode
private final java.util.Map<java.lang.Integer,Type3Glyph> type3GlyphsWithoutUnicode
Stores glyphs without associated unicode.
-
colorized
private boolean colorized
-
flags
private int flags
-
-
Method Detail
-
getType3Glyph
public Type3Glyph getType3Glyph(int unicode)
Returns a glyph by unicode.- Parameters:
unicode- glyph unicode- Returns:
Type3Glyphglyph, ornullif this font does not contain glyph for the unicode
-
getType3GlyphByCode
public Type3Glyph getType3GlyphByCode(int code)
Returns a glyph by its code. These glyphs may not have unicode.- Parameters:
code- glyph code- Returns:
Type3Glyphglyph, ornullif this font does not contain glyph for the code
-
getPdfFontFlags
public int getPdfFontFlags()
- Specified by:
getPdfFontFlagsin classFontProgram
-
isFontSpecific
public boolean isFontSpecific()
- Overrides:
isFontSpecificin classFontProgram
-
isColorized
public boolean isColorized()
-
getKerning
public int getKerning(Glyph glyph1, Glyph glyph2)
Description copied from class:FontProgramGets the kerning between two glyphs.- Specified by:
getKerningin classFontProgram- Parameters:
glyph1- the first glyphglyph2- the second glyph- Returns:
- the kerning to be applied
-
getNumberOfGlyphs
public int getNumberOfGlyphs()
Returns number of glyphs for this font. Its also count glyphs without unicode. Seetype3GlyphsWithoutUnicode.- Returns:
intnumber off all glyphs
-
setFontName
protected void setFontName(java.lang.String fontName)
Sets the PostScript name of the font.If full name is null, it will be set as well.
- Overrides:
setFontNamein classFontProgram- Parameters:
fontName- the PostScript name of the font, shall not be null or empty.
-
setFontFamily
protected void setFontFamily(java.lang.String fontFamily)
Sets a preferred font family name.- Overrides:
setFontFamilyin classFontProgram- Parameters:
fontFamily- a preferred font family name.
-
setFontWeight
protected void setFontWeight(int fontWeight)
Sets font weight.- Overrides:
setFontWeightin classFontProgram- Parameters:
fontWeight- integer form 100 to 900. SeeFontWeights.
-
setFontStretch
protected void setFontStretch(java.lang.String fontWidth)
Sets font width in css notation (font-stretch property)- Overrides:
setFontStretchin classFontProgram- Parameters:
fontWidth-FontStretches.
-
setCapHeight
protected void setCapHeight(int capHeight)
Sets the capital letters height. See alsoFontMetrics.setCapHeight(int).- Overrides:
setCapHeightin classFontProgram- Parameters:
capHeight- cap height in 1000-units
-
setItalicAngle
protected void setItalicAngle(int italicAngle)
Sets the PostScript italic angle.Italic angle in counter-clockwise degrees from the vertical. Zero for upright text, negative for text that leans to the right (forward).
- Overrides:
setItalicAnglein classFontProgram- Parameters:
italicAngle- in counter-clockwise degrees from the vertical
-
setTypoAscender
protected void setTypoAscender(int ascender)
Sets typo ascender. See alsoFontMetrics.setTypoAscender(int).- Overrides:
setTypoAscenderin classFontProgram- Parameters:
ascender- typo ascender value in 1000-units
-
setTypoDescender
protected void setTypoDescender(int descender)
Sets typo descender. See alsoFontMetrics.setTypoDescender(int).- Overrides:
setTypoDescenderin classFontProgram- Parameters:
descender- typo descender value in 1000-units
-
setPdfFontFlags
void setPdfFontFlags(int flags)
Sets Font descriptor flags.- Parameters:
flags-FontDescriptorFlags.- See Also:
FontDescriptorFlags
-
addGlyph
void addGlyph(int code, int unicode, int width, int[] bbox, Type3Glyph type3Glyph)
-
removeGlyphFromMappings
private void removeGlyphFromMappings(int glyphCode)
-
recalculateAverageWidth
private void recalculateAverageWidth()
-
-