public abstract class PdfSimpleFontFontProgram> extends PdfFont
Modifier and Type | Field and Description |
---|---|
protected FontEncoding |
fontEncoding |
protected boolean |
forceWidthsOutput
Forces the output of the width array.
|
protected byte[] |
shortTag
The array used with single byte encodings.
|
protected CMapToUnicode |
toUnicode
Currently only exists for the fonts that are parsed from the document.
|
DEFAULT_FONT_MATRIX, embedded, EMPTY_BYTES, fontProgram, newFont, notdefGlyphs, subset, subsetRanges
Modifier | Constructor and Description |
---|---|
protected |
PdfSimpleFont() |
protected |
PdfSimpleFont(PdfDictionary fontDictionary) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addFontStream(PdfDictionary fontDescriptor) |
int |
appendAnyGlyph(String text, int from, List<Glyph> glyphs)
Append any single glyph, even notdef.
|
int |
appendGlyphs(String text, int from, int to, List<Glyph> glyphs)
Append all supported glyphs and return number of processed chars.
|
byte[] |
convertToBytes(Glyph glyph) |
byte[] |
convertToBytes(GlyphLine glyphLine) |
byte[] |
convertToBytes(String text)
Converts the text into bytes to be placed in the document.
|
GlyphLine |
createGlyphLine(String content) |
String |
decode(PdfString content) |
GlyphLine |
decodeIntoGlyphLine(PdfString content)
Decodes a given PdfString containing encoded string (e.g.
|
protected void |
flushFontData(String fontName, PdfName subtype) |
float |
getContentWidth(PdfString content) |
protected PdfDictionary |
getFontDescriptor(String fontName)
Generates the font descriptor for this font or null if it is one of the 14 built in fonts.
|
FontEncoding |
getFontEncoding() |
protected double |
getGlyphWidth(Glyph glyph) |
protected boolean |
isBuiltInFont() |
boolean |
isBuiltWith(String fontProgram, String encoding)
Checks whether the PdfFont was built with corresponding fontProgram and encoding or CMAP.
|
boolean |
isForceWidthsOutput()
Gets the state of the property.
|
protected void |
setFontProgram(T fontProgram) |
void |
setForceWidthsOutput(boolean forceWidthsOutput)
Set to true to force the generation of the widths array.
|
void |
writeText(GlyphLine text, int from, int to, PdfOutputStream stream) |
void |
writeText(String text, PdfOutputStream stream) |
addSubsetRange, compactRanges, containsGlyph, flush, getAscent, getAscent, getDescent, getDescent, getFontMatrix, getFontProgram, getGlyph, getPdfFontStream, getWidth, getWidth, getWidth, getWidth, isEmbedded, isSubset, isWrappedObjectMustBeIndirect, setSubset, splitString, toString, updateSubsetPrefix
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
protected FontEncoding fontEncoding
protected boolean forceWidthsOutput
protected byte[] shortTag
protected CMapToUnicode toUnicode
protected PdfSimpleFont(PdfDictionary fontDictionary)
protected PdfSimpleFont()
public boolean isBuiltWith(String fontProgram, String encoding)
PdfFont
PdfFont
was built with corresponding fontProgram and encoding or CMAP. Default value is false unless overridden.
isBuiltWith
in class PdfFont
fontProgram
- a font name or path to a font program
encoding
- an encoding or CMAP
PdfDocument.findFont(String, String)
, FontProgram.isBuiltWith(String)
, FontEncoding.isBuiltWith(String)
, CMapEncoding.isBuiltWith(String)
public GlyphLine createGlyphLine(String content)
createGlyphLine
in class PdfFont
public int appendGlyphs(String text, int from, int to, List<Glyph> glyphs)
PdfFont
appendGlyphs
in class PdfFont
text
- String to convert to glyphs.
from
- from index of the text.
to
- to index of the text.
glyphs
- array for a new glyphs, shall not be null.
public int appendAnyGlyph(String text, int from, List<Glyph> glyphs)
PdfFont
appendAnyGlyph
in class PdfFont
text
- String to convert to glyphs.
from
- from index of the text.
glyphs
- array for a new glyph, shall not be null.
public FontEncoding getFontEncoding()
public byte[] convertToBytes(String text)
PdfFont
convertToBytes
in class PdfFont
text
- the text to convert
public byte[] convertToBytes(GlyphLine glyphLine)
convertToBytes
in class PdfFont
public byte[] convertToBytes(Glyph glyph)
convertToBytes
in class PdfFont
public void writeText(GlyphLine text, int from, int to, PdfOutputStream stream)
public void writeText(String text, PdfOutputStream stream)
public GlyphLine decodeIntoGlyphLine(PdfString content)
decodeIntoGlyphLine
in class PdfFont
content
- the encoded string
GlyphLine
containing the glyphs encoded by the passed string
public float getContentWidth(PdfString content)
getContentWidth
in class PdfFont
public boolean isForceWidthsOutput()
public void setForceWidthsOutput(boolean forceWidthsOutput)
true
to force the generation of the widths array.
forceWidthsOutput
- true
to force the generation of the widths array
protected boolean isBuiltInFont()
protected PdfDictionary getFontDescriptor(String fontName)
null
if it is one of the 14 built in fonts.
getFontDescriptor
in class PdfFont
null
.
protected abstract void addFontStream(PdfDictionary fontDescriptor)
protected void setFontProgram(T fontProgram)
protected double getGlyphWidth(Glyph glyph)
Copyright © 1998–2020 iText Group NV. All rights reserved.