public class SingleByteFont extends CustomFont
| Modifier and Type | Class and Description |
|---|---|
protected static class |
SingleByteFont.UnencodedCharacter |
| Modifier and Type | Field and Description |
|---|---|
protected SingleByteEncoding |
mapping |
protected int[] |
width |
additionalEncodings, cmap, svgs, unencodedCharacterseventListener, NOT_FOUND| Constructor and Description |
|---|
SingleByteFont(InternalResourceResolver resourceResolver) |
SingleByteFont(InternalResourceResolver resourceResolver,
EmbeddingMode embeddingMode) |
| Modifier and Type | Method and Description |
|---|---|
void |
addUnencodedCharacter(NamedCharacter ch,
int width,
Rectangle bbox)
Adds an unencoded character (one that is not supported by the primary encoding).
|
void |
encodeAllUnencodedCharacters()
Makes all unencoded characters available through additional encodings.
|
int[] |
getAdditionalWidths(int index)
Returns an array with the widths for an additional encoding.
|
Rectangle |
getBoundingBox(int glyphIndex,
int size)
Returns the bounding box of the glyph at the given index, for the given font size.
|
SingleByteEncoding |
getEncoding()
Returns the code point mapping (encoding) of this font.
|
String |
getEncodingName()
Get the encoding of the font.
|
int |
getGIDFromChar(char ch) |
String |
getGlyphName(int idx) |
OpenFont.PostScriptVersion |
getTrueTypePostScriptVersion()
Returns the version of the PostScript table stored in the TrueType font represented by
this instance.
|
char |
getUnicodeFromGID(int glyphIndex)
Returns the character from it's original glyph index in the font
|
char |
getUnicodeFromSelector(int selector) |
Map<Integer,String> |
getUsedGlyphNames() |
Map<Integer,Integer> |
getUsedGlyphs()
Returns a Map of used Glyphs.
|
int |
getWidth(int i,
int size)
Return the width (in 1/1000ths of point size) of the character at
code point i.
|
int[] |
getWidths()
Return the array of widths.
|
boolean |
hasChar(char c)
Determines whether this font contains a particular character/glyph.
|
boolean |
isEmbeddable()
Indicates if this font may be embedded.
|
boolean |
isSubsetEmbedded()
Indicates whether this font is subset embedded.
|
boolean |
isUsingNativeEncoding()
Indicates whether this font is configured to use its native encoding.
|
char |
mapChar(char c)
Map a Unicode character to a code point in the font.
|
void |
mapUsedGlyphName(int gid,
String value) |
void |
setBoundingBox(int index,
Rectangle bbox) |
void |
setEncoding(CodePointMapping encoding)
Sets the encoding of the font.
|
void |
setEncoding(String encoding)
Sets the encoding of the font.
|
void |
setTrueTypePostScriptVersion(OpenFont.PostScriptVersion version)
Sets the version of the PostScript table stored in the TrueType font represented by
this instance.
|
void |
setUseNativeEncoding(boolean value)
Controls whether the font is configured to use its native encoding or if it
may need to be re-encoded for the target format.
|
void |
setWidth(int index,
int w)
Sets a width for a character.
|
protected void |
updateMapping(String encoding)
Updates the mapping variable based on the encoding.
|
getAdditionalEncoding, getAdditionalEncodingCount, getAscender, getAscender, getCapHeight, getCapHeight, getCMap, getDescender, getDescender, getEmbeddingMode, getEmbedFileURI, getEmbedFontName, getEmbedResourceName, getFamilyNames, getFirstChar, getFlags, getFontBBox, getFontName, getFontSubName, getFontType, getFontURI, getFullName, getInputStream, getItalicAngle, getKerningInfo, getLastChar, getMissingWidth, getSimulateStyle, getStemV, getStrikeoutPosition, getStrikeoutThickness, getStrippedFontName, getUnderlinePosition, getUnderlineThickness, getWeight, getXHeight, hasAdditionalEncodings, hasKerningInfo, hasSVG, isAdvancedEnabled, isKerningEnabled, isSymbolicFont, mapUnencodedChar, putKerningEntry, replaceKerningMap, setAdvancedEnabled, setAscender, setCapHeight, setCMap, setDescender, setEmbeddingMode, setEmbedResourceName, setEmbedURI, setFamilyNames, setFirstChar, setFlags, setFontBBox, setFontName, setFontSubFamilyName, setFontType, setFontURI, setFullName, setItalicAngle, setKerningEnabled, setLastChar, setMissingWidth, setSimulateStyle, setStemV, setStrikeoutPosition, setStrikeoutThickness, setSVG, setUnderlinePosition, setUnderlineThickness, setWeight, setXHeightgetMaxAscent, hadMappingOperations, hasFeature, isCID, isMultiByte, notifyMapOperation, setEventListener, toString, warnMissingGlyphclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetMaxAscent, hasFeature, isMultiByteprotected SingleByteEncoding mapping
protected int[] width
public SingleByteFont(InternalResourceResolver resourceResolver)
public SingleByteFont(InternalResourceResolver resourceResolver, EmbeddingMode embeddingMode)
public boolean isEmbeddable()
public boolean isSubsetEmbedded()
public String getEncodingName()
getEncodingName in class Typefacepublic SingleByteEncoding getEncoding()
public int getWidth(int i,
int size)
i - code point indexsize - font sizepublic int[] getWidths()
This is used to get an array for inserting in an output format. It should not be used for lookup.
public Rectangle getBoundingBox(int glyphIndex, int size)
FontMetricsglyphIndex - glyph indexsize - font sizepublic char mapChar(char c)
public boolean hasChar(char c)
protected void updateMapping(String encoding)
encoding - the name of the encodingpublic void setEncoding(String encoding)
encoding - the encoding (ex. "WinAnsiEncoding" or "SymbolEncoding")public void setEncoding(CodePointMapping encoding)
encoding - the encoding informationpublic void setUseNativeEncoding(boolean value)
value - true indicates that the configured encoding is the font's native encodingpublic boolean isUsingNativeEncoding()
public void setWidth(int index,
int w)
index - index of the characterw - the width of the characterpublic void setBoundingBox(int index,
Rectangle bbox)
public void addUnencodedCharacter(NamedCharacter ch, int width, Rectangle bbox)
addUnencodedCharacter in class CustomFontch - the named characterwidth - the width of the characterpublic void encodeAllUnencodedCharacters()
public int[] getAdditionalWidths(int index)
index - the index of the additional encodingpublic void setTrueTypePostScriptVersion(OpenFont.PostScriptVersion version)
version - version of the post tablepublic OpenFont.PostScriptVersion getTrueTypePostScriptVersion()
public Map<Integer,Integer> getUsedGlyphs()
getUsedGlyphs in class CustomFontpublic char getUnicodeFromSelector(int selector)
public int getGIDFromChar(char ch)
public char getUnicodeFromGID(int glyphIndex)
CustomFontgetUnicodeFromGID in class CustomFontglyphIndex - The original index of the characterpublic void mapUsedGlyphName(int gid,
String value)
public String getGlyphName(int idx)
Copyright © 2025 Apache Software Foundation. All rights reserved.