public class MultiByteFont extends CIDFont implements Substitutable, Positionable
Modifier and Type | Field and Description |
---|---|
protected Rectangle[] |
boundingBoxes
Contains the character bounding boxes for all characters in the font
|
protected CIDSet |
cidSet |
additionalEncodings, cmap, svgs, unencodedCharacters
eventListener, NOT_FOUND
Constructor and Description |
---|
MultiByteFont(InternalResourceResolver resourceResolver,
EmbeddingMode embeddingMode)
Default constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
addPrivateUseMapping(int pu,
int gi)
Add a private use mapping {PU,GI} to the existing character map.
|
GlyphSequence |
charSequenceToGlyphSequence(CharSequence charSequence,
List associations) |
int |
findGlyphIndex(int c)
Returns the glyph index for a Unicode character.
|
Rectangle |
getBoundingBox(int glyphIndex,
int size)
Returns the bounding box of the glyph at the given index, for the given font size.
|
protected char[] |
getChars() |
CIDSet |
getCIDSet()
Returns the subset information for this font.
|
CIDFontType |
getCIDType()
Returns the type of the CID font.
|
InputStream |
getCmapStream() |
int |
getDefaultWidth()
Returns the default width for this font.
|
String |
getEmbedFontName()
Returns the font name for font embedding (may include a prefix, Example: "1E28bcArialMT").
|
String |
getEncodingName()
Get the encoding of the font.
|
GlyphDefinitionTable |
getGDEF()
Obtain glyph definition table.
|
int |
getGIDFromChar(char ch)
Gets the original glyph index in the font from a character.
|
protected BitSet |
getGlyphIndices() |
GlyphPositioningTable |
getGPOS()
Obtain glyph positioning table.
|
GlyphSubstitutionTable |
getGSUB()
Obtain glyph substitution table.
|
String |
getOrdering()
Returns a font name for use within a registry.
|
String |
getRegistry()
Returns the name of the issuer of the font.
|
int |
getSupplement()
Returns the supplement number of the character collection.
|
SVGGlyphData |
getSVG(int c) |
String |
getTTCName()
Returns the TrueType Collection Name.
|
char |
getUnicodeFromGID(int glyphIndex)
Returns the character from it's original glyph index in the font
|
protected int[] |
getUnscaledWidths(GlyphSequence gs) |
LinkedHashMap<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.
|
Map<Integer,Integer> |
getWidthsMap() |
boolean |
hasChar(char c)
Determines whether this font contains a particular character/glyph.
|
boolean |
hasCodePoint(int cp)
Determines whether this font contains a particular code point/glyph.
|
boolean |
hasFeature(int tableType,
String script,
String language,
String feature)
Determine if metrics supports specific feature in specified font table.
|
boolean |
isEmbeddable()
Indicates if this font may be embedded.
|
boolean |
isOTFFile() |
boolean |
isSubsetEmbedded()
Indicates whether this font is subset embedded.
|
char |
mapChar(char c)
Map a Unicode character to a code point in the font.
|
int |
mapCodePoint(int cp)
Map a Unicode code point to a code point in the font.
|
void |
mapUsedGlyphName(int gid,
String value) |
int[][] |
performPositioning(CharSequence cs,
String script,
String language)
Perform glyph positioning using an implied font size.
|
int[][] |
performPositioning(CharSequence cs,
String script,
String language,
int fontSize)
Perform glyph positioning.
|
boolean |
performsPositioning()
Determines if font performs glyph positioning.
|
boolean |
performsSubstitution()
Determines if font performs glyph substitution.
|
CharSequence |
performSubstitution(CharSequence charSequence,
String script,
String language,
List associations,
boolean retainControls)
Perform substitutions on characters to effect glyph substitution.
|
CharSequence |
reorderCombiningMarks(CharSequence cs,
int[][] gpa,
String script,
String language,
List associations)
Reorder combining marks in character sequence so that they precede (within the sequence) the base
character to which they are applied.
|
void |
setBBoxArray(Rectangle[] boundingBoxes)
Sets the bounding boxes array.
|
void |
setCIDType(CIDFontType cidType)
Sets the CIDType.
|
void |
setDefaultWidth(int defaultWidth)
Sets the defaultWidth.
|
void |
setGDEF(GlyphDefinitionTable gdef)
Establishes the glyph definition table.
|
void |
setGPOS(GlyphPositioningTable gpos)
Establishes the glyph positioning table.
|
void |
setGSUB(GlyphSubstitutionTable gsub)
Establishes the glyph substitution table.
|
void |
setIsOTFFile(boolean isOTFFile) |
void |
setTTCName(String ttcName)
Sets the the TrueType Collection Name.
|
void |
setWidthArray(int[] wds)
Sets the width array.
|
isMultiByte
addUnencodedCharacter, getAdditionalEncoding, getAdditionalEncodingCount, getAscender, getAscender, getCapHeight, getCapHeight, getCMap, getDescender, getDescender, getEmbeddingMode, getEmbedFileURI, 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, setXHeight
getMaxAscent, hadMappingOperations, isCID, notifyMapOperation, setEventListener, toString, warnMissingGlyph
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getMaxAscent
protected final CIDSet cidSet
protected Rectangle[] boundingBoxes
public MultiByteFont(InternalResourceResolver resourceResolver, EmbeddingMode embeddingMode)
public int getDefaultWidth()
getDefaultWidth
in class CIDFont
public String getRegistry()
getRegistry
in class CIDFont
public String getOrdering()
getOrdering
in class CIDFont
public int getSupplement()
getSupplement
in class CIDFont
public CIDFontType getCIDType()
getCIDType
in class CIDFont
public void setIsOTFFile(boolean isOTFFile)
public boolean isOTFFile()
public void setCIDType(CIDFontType cidType)
cidType
- The cidType to setpublic String getEmbedFontName()
getEmbedFontName
in interface FontMetrics
getEmbedFontName
in class CustomFont
public boolean isEmbeddable()
isEmbeddable
in interface FontDescriptor
public boolean isSubsetEmbedded()
FontDescriptor
isSubsetEmbedded
in interface FontDescriptor
public CIDSet getCIDSet()
public void mapUsedGlyphName(int gid, String value)
public LinkedHashMap<Integer,String> getUsedGlyphNames()
public String getEncodingName()
getEncodingName
in class Typeface
public int getWidth(int i, int size)
getWidth
in interface FontMetrics
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.
getWidths
in interface FontMetrics
public Rectangle getBoundingBox(int glyphIndex, int size)
FontMetrics
getBoundingBox
in interface FontMetrics
glyphIndex
- glyph indexsize
- font sizepublic int findGlyphIndex(int c)
c
- the Unicode character indexprotected void addPrivateUseMapping(int pu, int gi)
protected BitSet getGlyphIndices()
protected char[] getChars()
public char mapChar(char c)
public int mapCodePoint(int cp)
mapCodePoint
in class CIDFont
cp
- code point to mappublic boolean hasChar(char c)
public boolean hasCodePoint(int cp)
hasCodePoint
in class CIDFont
cp
- character to checkpublic void setDefaultWidth(int defaultWidth)
defaultWidth
- The defaultWidth to setpublic String getTTCName()
public void setTTCName(String ttcName)
ttcName
- the TrueType Collection Namepublic void setWidthArray(int[] wds)
wds
- array of widths.public void setBBoxArray(Rectangle[] boundingBoxes)
boundingBoxes
- array of bounding boxes.public Map<Integer,Integer> getUsedGlyphs()
getUsedGlyphs
in class CustomFont
public char getUnicodeFromGID(int glyphIndex)
getUnicodeFromGID
in class CustomFont
glyphIndex
- The original index of the characterpublic int getGIDFromChar(char ch)
ch
- The characterpublic void setGDEF(GlyphDefinitionTable gdef)
gdef
- the glyph definition table to be used by this fontpublic GlyphDefinitionTable getGDEF()
public void setGSUB(GlyphSubstitutionTable gsub)
gsub
- the glyph substitution table to be used by this fontpublic GlyphSubstitutionTable getGSUB()
public void setGPOS(GlyphPositioningTable gpos)
gpos
- the glyph positioning table to be used by this fontpublic GlyphPositioningTable getGPOS()
public boolean performsSubstitution()
performsSubstitution
in interface Substitutable
public CharSequence performSubstitution(CharSequence charSequence, String script, String language, List associations, boolean retainControls)
performSubstitution
in interface Substitutable
charSequence
- character sequence to map to output font encoding character sequencescript
- a script identifierlanguage
- a language identifierassociations
- optional list to receive list of character associationsretainControls
- if true, then retain control characters and their glyph mappings, otherwise removepublic GlyphSequence charSequenceToGlyphSequence(CharSequence charSequence, List associations)
public CharSequence reorderCombiningMarks(CharSequence cs, int[][] gpa, String script, String language, List associations)
reorderCombiningMarks
in interface Substitutable
cs
- character sequence within which combining marks to be reorderedgpa
- associated glyph position adjustments (also reordered)script
- a script identifierlanguage
- a language identifierassociations
- optional list of associations to be reorderedprotected int[] getUnscaledWidths(GlyphSequence gs)
public boolean performsPositioning()
performsPositioning
in interface Positionable
public int[][] performPositioning(CharSequence cs, String script, String language, int fontSize)
performPositioning
in interface Positionable
cs
- character sequence to map to position offsets (advancement adjustments)script
- a script identifierlanguage
- a language identifierfontSize
- font sizepublic int[][] performPositioning(CharSequence cs, String script, String language)
performPositioning
in interface Positionable
cs
- character sequence to map to position offsets (advancement adjustments)script
- a script identifierlanguage
- a language identifierpublic boolean hasFeature(int tableType, String script, String language, String feature)
Typeface
hasFeature
in interface FontMetrics
hasFeature
in class Typeface
tableType
- type of table (GSUB, GPOS, ...), see GlyphTable.GLYPH_TABLE_TYPE_*script
- to qualify feature lookuplanguage
- to qualify feature lookupfeature
- to testpublic InputStream getCmapStream()
public SVGGlyphData getSVG(int c)
Copyright © 2025 Apache Software Foundation. All rights reserved.