public class PdfType3Font extends PdfSimpleFont<Type3Font>
In Type 3 fonts, glyphs are defined by streams of PDF graphics operators. These streams are associated with character names. A separate encoding entry maps character codes to the appropriate character names for the glyphs.
To be able to be wrapped with this PdfObjectWrapper
the PdfObject
must be indirect.
fontEncoding, forceWidthsOutput, shortTag, toUnicode
DEFAULT_FONT_MATRIX, embedded, EMPTY_BYTES, fontProgram, newFont, notdefGlyphs, subset, subsetRanges
Modifier and Type | Method and Description |
---|---|
protected void |
addFontStream(PdfDictionary fontDescriptor) |
Type3Glyph |
addGlyph(char c, int wx, int llx, int lly, int urx, int ury)
Defines a glyph.
|
boolean |
containsGlyph(int unicode)
Check whether font contains glyph with specified unicode.
|
void |
flush()
To manually flush a PdfObject behind this wrapper, you have to ensure that this object is added to the document, i.e.
|
protected PdfDocument |
getDocument() |
protected PdfDictionary |
getFontDescriptor(String fontName)
Generates the font descriptor for this font or null if it is one of the 14 built in fonts.
|
double[] |
getFontMatrix() |
Glyph |
getGlyph(int unicode)
Get glyph by unicode
|
protected double |
getGlyphWidth(Glyph glyph) |
int |
getNumberOfGlyphs()
Gets count of glyphs in Type 3 font.
|
Type3Glyph |
getType3Glyph(int unicode) |
boolean |
isEmbedded() |
boolean |
isSubset()
Indicates if all the glyphs and widths for that particular encoding should be included in the document.
|
void |
setFontFamily(String fontFamily)
Sets a preferred font family name.
|
void |
setFontMatrix(double[] fontMatrix) |
void |
setFontName(String fontName)
Sets the PostScript name of the font.
|
void |
setFontStretch(String fontWidth)
Sets font width in css notation (font-stretch property)
|
void |
setFontWeight(int fontWeight)
Sets font weight.
|
void |
setItalicAngle(int italicAngle)
Sets the PostScript italic angle.
|
void |
setPdfFontFlags(int flags)
Sets Font descriptor flags.
|
appendAnyGlyph, appendGlyphs, convertToBytes, convertToBytes, convertToBytes, createGlyphLine, decode, decodeIntoGlyphLine, flushFontData, getContentWidth, getFontEncoding, isBuiltInFont, isBuiltWith, isForceWidthsOutput, setFontProgram, setForceWidthsOutput, writeText, writeText
addSubsetRange, compactRanges, getAscent, getAscent, getDescent, getDescent, getFontProgram, getPdfFontStream, getWidth, getWidth, getWidth, getWidth, isWrappedObjectMustBeIndirect, setSubset, splitString, toString, updateSubsetPrefix
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
public void setFontName(String fontName)
fontName
- the PostScript name of the font, shall not be null or empty.
public void setFontFamily(String fontFamily)
fontFamily
- a preferred font family name.
public void setFontWeight(int fontWeight)
fontWeight
- integer form 100 to 900. See FontWeights
.
public void setItalicAngle(int italicAngle)
Italic angle in counter-clockwise degrees from the vertical. Zero for upright text, negative for text that leans to the right (forward).
italicAngle
- in counter-clockwise degrees from the vertical
public void setFontStretch(String fontWidth)
fontWidth
- FontStretches
.
public void setPdfFontFlags(int flags)
flags
- font descriptor flags.
FontDescriptorFlags
public Type3Glyph getType3Glyph(int unicode)
public boolean isSubset()
PdfFont
public boolean isEmbedded()
isEmbedded
in class PdfFont
public double[] getFontMatrix()
getFontMatrix
in class PdfFont
public void setFontMatrix(double[] fontMatrix)
public int getNumberOfGlyphs()
public Type3Glyph addGlyph(char c, int wx, int llx, int lly, int urx, int ury)
c
- the character to match this glyph.
wx
- the advance this character will have
llx
- the X lower left corner of the glyph bounding box. If the colorize
option is true
the value is ignored
lly
- the Y lower left corner of the glyph bounding box. If the colorize
option is true
the value is ignored
urx
- the X upper right corner of the glyph bounding box. If the colorize
option is true
the value is ignored
ury
- the Y upper right corner of the glyph bounding box. If the colorize
option is true
the value is ignored
public Glyph getGlyph(int unicode)
PdfFont
public boolean containsGlyph(int unicode)
PdfFont
containsGlyph
in class PdfFont
unicode
- a unicode code point
public void flush()
PdfFont
PdfObject
behind this wrapper, you have to ensure that this object is added to the document, i.e. it has an indirect reference. Basically this means that before flushing you need to explicitly call PdfObjectWrapper.makeIndirect(PdfDocument)
. For example: wrapperInstance.makeIndirect(document).flush(); Note that not every wrapper require this, only those that have such warning in documentation.
protected PdfDictionary getFontDescriptor(String fontName)
PdfSimpleFont
null
if it is one of the 14 built in fonts.
getFontDescriptor
in class PdfSimpleFont<Type3Font>
null
.
protected void addFontStream(PdfDictionary fontDescriptor)
addFontStream
in class PdfSimpleFont<Type3Font>
protected PdfDocument getDocument()
protected double getGlyphWidth(Glyph glyph)
getGlyphWidth
in class PdfSimpleFont<Type3Font>
Copyright © 1998–2020 iText Group NV. All rights reserved.