Package org.apache.fop.fonts
Class SingleByteFont
java.lang.Object
org.apache.fop.fonts.Typeface
org.apache.fop.fonts.CustomFont
org.apache.fop.fonts.SingleByteFont
- All Implemented Interfaces:
FontDescriptor,FontMetrics,MutableFont
Generic SingleByte font
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class org.apache.fop.fonts.CustomFont
additionalEncodings, cmap, svgs, unencodedCharactersFields inherited from class org.apache.fop.fonts.Typeface
eventListener, NOT_FOUND -
Constructor Summary
ConstructorsConstructorDescriptionSingleByteFont(InternalResourceResolver resourceResolver) SingleByteFont(InternalResourceResolver resourceResolver, EmbeddingMode embeddingMode) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddUnencodedCharacter(NamedCharacter ch, int width, Rectangle bbox) Adds an unencoded character (one that is not supported by the primary encoding).voidMakes all unencoded characters available through additional encodings.int[]getAdditionalWidths(int index) Returns an array with the widths for an additional encoding.getBoundingBox(int glyphIndex, int size) Returns the bounding box of the glyph at the given index, for the given font size.Returns the code point mapping (encoding) of this font.Get the encoding of the font.intgetGIDFromChar(char ch) getGlyphName(int idx) Returns the version of the PostScript table stored in the TrueType font represented by this instance.chargetUnicodeFromGID(int glyphIndex) Returns the character from it's original glyph index in the fontchargetUnicodeFromSelector(int selector) Returns a Map of used Glyphs.intgetWidth(int i, int size) Return the width (in 1/1000ths of point size) of the character at code point i.int[]Return the array of widths.booleanhasChar(char c) Determines whether this font contains a particular character/glyph.booleanIndicates if this font may be embedded.booleanIndicates whether this font is subset embedded.booleanIndicates whether this font is configured to use its native encoding.charmapChar(char c) Map a Unicode character to a code point in the font.voidmapUsedGlyphName(int gid, String value) voidsetBoundingBox(int index, Rectangle bbox) voidsetEncoding(String encoding) Sets the encoding of the font.voidsetEncoding(CodePointMapping encoding) Sets the encoding of the font.voidSets the version of the PostScript table stored in the TrueType font represented by this instance.voidsetUseNativeEncoding(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.voidsetWidth(int index, int w) Sets a width for a character.protected voidupdateMapping(String encoding) Updates the mapping variable based on the encoding.Methods inherited from class org.apache.fop.fonts.CustomFont
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, setXHeightMethods inherited from class org.apache.fop.fonts.Typeface
getMaxAscent, hadMappingOperations, hasFeature, isCID, isMultiByte, notifyMapOperation, setEventListener, toString, warnMissingGlyphMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.fop.fonts.FontMetrics
getMaxAscent, hasFeature, isMultiByte
-
Field Details
-
mapping
-
width
protected int[] width
-
-
Constructor Details
-
SingleByteFont
-
SingleByteFont
-
-
Method Details
-
isEmbeddable
public boolean isEmbeddable()Indicates if this font may be embedded.- Returns:
- True, if embedding is possible/permitted
-
isSubsetEmbedded
public boolean isSubsetEmbedded()Indicates whether this font is subset embedded.- Returns:
- true if this font is subset embedded
-
getEncodingName
Get the encoding of the font.- Specified by:
getEncodingNamein classTypeface- Returns:
- the encoding
-
getEncoding
Returns the code point mapping (encoding) of this font.- Returns:
- the code point mapping
-
getWidth
public int getWidth(int i, int size) Return the width (in 1/1000ths of point size) of the character at code point i.- Parameters:
i- code point indexsize- font size- Returns:
- the width of the character
-
getWidths
public int[] getWidths()Return the array of widths.This is used to get an array for inserting in an output format. It should not be used for lookup.
- Returns:
- an array of widths
-
getBoundingBox
Description copied from interface:FontMetricsReturns the bounding box of the glyph at the given index, for the given font size.- Parameters:
glyphIndex- glyph indexsize- font size- Returns:
- the scaled bounding box scaled in 1/1000ths of the given size
-
mapChar
public char mapChar(char c) Map a Unicode character to a code point in the font. -
hasChar
public boolean hasChar(char c) Determines whether this font contains a particular character/glyph. -
updateMapping
Updates the mapping variable based on the encoding.- Parameters:
encoding- the name of the encoding
-
setEncoding
Sets the encoding of the font.- Parameters:
encoding- the encoding (ex. "WinAnsiEncoding" or "SymbolEncoding")
-
setEncoding
Sets the encoding of the font.- Parameters:
encoding- the encoding information
-
setUseNativeEncoding
public 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.- Parameters:
value- true indicates that the configured encoding is the font's native encoding
-
isUsingNativeEncoding
public boolean isUsingNativeEncoding()Indicates whether this font is configured to use its native encoding. This method is used to determine whether the font needs to be re-encoded.- Returns:
- true if the font uses its native encoding.
-
setWidth
public void setWidth(int index, int w) Sets a width for a character.- Parameters:
index- index of the characterw- the width of the character
-
setBoundingBox
-
addUnencodedCharacter
Adds an unencoded character (one that is not supported by the primary encoding).- Overrides:
addUnencodedCharacterin classCustomFont- Parameters:
ch- the named characterwidth- the width of the character
-
encodeAllUnencodedCharacters
public void encodeAllUnencodedCharacters()Makes all unencoded characters available through additional encodings. This method is used in cases where the fonts need to be encoded in the target format before all text of the document is processed (for example in PostScript when resource optimization is disabled). -
getAdditionalWidths
public int[] getAdditionalWidths(int index) Returns an array with the widths for an additional encoding.- Parameters:
index- the index of the additional encoding- Returns:
- the width array
-
setTrueTypePostScriptVersion
Sets the version of the PostScript table stored in the TrueType font represented by this instance.- Parameters:
version- version of the post table
-
getTrueTypePostScriptVersion
Returns the version of the PostScript table stored in the TrueType font represented by this instance.- Returns:
- the version of the post table
-
getUsedGlyphs
Returns a Map of used Glyphs.- Specified by:
getUsedGlyphsin classCustomFont- Returns:
- Map Map of used Glyphs
-
getUnicodeFromSelector
public char getUnicodeFromSelector(int selector) -
getGIDFromChar
public int getGIDFromChar(char ch) -
getUnicodeFromGID
public char getUnicodeFromGID(int glyphIndex) Description copied from class:CustomFontReturns the character from it's original glyph index in the font- Specified by:
getUnicodeFromGIDin classCustomFont- Parameters:
glyphIndex- The original index of the character- Returns:
- The character
-
mapUsedGlyphName
-
getUsedGlyphNames
-
getGlyphName
-