public class PdfType0Font extends PdfFont
Modifier and Type | Field and Description |
---|---|
protected static int |
CID_FONT_TYPE_0
CIDFont Type0 (Type1 outlines).
|
protected static int |
CID_FONT_TYPE_2
CIDFont Type2 (TrueType outlines).
|
protected int |
cidFontType |
protected CMapEncoding |
cmapEncoding |
protected char[] |
specificUnicodeDifferences |
protected Set<Integer> |
usedGlyphs |
protected boolean |
vertical |
embedded, EMPTY_BYTES, fontProgram, newFont, notdefGlyphs, SIMPLE_FONT_MAX_CHAR_CODE_VALUE, subset, subsetRanges
Modifier and Type | Method and Description |
---|---|
int |
appendAnyGlyph(String text, int from, List<Glyph> glyphs)
Append any single glyph, even notdef.
|
boolean |
appendDecodedCodesToGlyphsList(List<Glyph> list, PdfString characterCodes)
Decodes sequence of character codes (e.g.
|
int |
appendGlyphs(String text, int from, int to, List<Glyph> glyphs)
Append all supported glyphs and return number of processed chars.
|
boolean |
containsGlyph(int unicode)
Check whether font contains glyph with specified unicode.
|
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 characterCodes)
Decodes sequence of character codes (e.g.
|
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 PdfDictionary |
getCidFont(PdfDictionary fontDescriptor, String fontName, boolean isType2)
Generates the CIDFontType2 dictionary.
|
CMapEncoding |
getCmap()
Gets CMAP associated with the Pdf Font.
|
float |
getContentWidth(PdfString content) |
protected PdfDictionary |
getFontDescriptor(String fontName) |
Glyph |
getGlyph(int unicode)
Get glyph by unicode
|
PdfStream |
getToUnicode()
Creates a ToUnicode CMap to allow copy and paste from Acrobat.
|
static String |
getUniMapFromOrdering(String ordering)
Deprecated.
Replaced by
getUniMapFromOrdering(String, boolean) for proper handling of IDENTITY_V encoding.
|
static String |
getUniMapFromOrdering(String ordering, boolean horizontal)
Get Unicode mapping name from ordering.
|
boolean |
isBuiltWith(String fontProgram, String encoding)
Checks whether the PdfFont was built with corresponding fontProgram and encoding or CMAP.
|
void |
writeText(GlyphLine text, int from, int to, PdfOutputStream stream) |
void |
writeText(String text, PdfOutputStream stream) |
addSubsetRange, getAscent, getAscent, getDescent, getDescent, getFontProgram, getPdfFontStream, getWidth, getWidth, getWidth, getWidth, isEmbedded, isSubset, isWrappedObjectMustBeIndirect, setSubset, splitString, toString, updateSubsetPrefix
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
protected static final int CID_FONT_TYPE_0
protected static final int CID_FONT_TYPE_2
protected boolean vertical
protected CMapEncoding cmapEncoding
protected int cidFontType
protected char[] specificUnicodeDifferences
public static String getUniMapFromOrdering(String ordering, boolean horizontal)
ordering
- the text ordering to base to unicode mapping on
horizontal
- identifies whether the encoding is horizontal or vertical
@Deprecated public static String getUniMapFromOrdering(String ordering)
getUniMapFromOrdering(String, boolean)
for proper handling of IDENTITY_V encoding.
ordering
- the text ordering to base to unicode mapping on
public Glyph getGlyph(int unicode)
PdfFont
public boolean containsGlyph(int unicode)
PdfFont
containsGlyph
in class PdfFont
unicode
- a unicode code point
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 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 GlyphLine decodeIntoGlyphLine(PdfString characterCodes)
GlyphLine
decodeIntoGlyphLine
in class PdfFont
characterCodes
- the string which is interpreted as a sequence of character codes. Note, that PdfString
acts as a storage for char code values specific to given font, therefore individual character codes must not be interpreted as code units of the UTF-16 encoding
GlyphLine
containing the glyphs encoded by the passed string
public boolean appendDecodedCodesToGlyphsList(List<Glyph> list, PdfString characterCodes)
appendDecodedCodesToGlyphsList
in class PdfFont
list
- the list to the end of which decoded glyphs are to be added
characterCodes
- the string which is interpreted as a sequence of character codes. Note, that PdfString
acts as a storage for char code values specific to given font, therefore individual character codes must not be interpreted as code units of the UTF-16 encoding
public float getContentWidth(PdfString content)
getContentWidth
in class PdfFont
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 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.
public CMapEncoding getCmap()
CMapEncoding
protected PdfDictionary getFontDescriptor(String fontName)
getFontDescriptor
in class PdfFont
protected PdfDictionary getCidFont(PdfDictionary fontDescriptor, String fontName, boolean isType2)
fontDescriptor
- the font descriptor dictionary
fontName
- a name of the font
isType2
- true, if the font is CIDFontType2 (TrueType glyphs), otherwise false, i.e. CIDFontType0 (Type1/CFF glyphs)
public PdfStream getToUnicode()
null
Copyright © 1998–2022 iText Group NV. All rights reserved.