Package org.apache.fop.fonts.truetype
Class OpenFont
- java.lang.Object
-
- org.apache.fop.fonts.truetype.OpenFont
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OpenFont.PostScriptVersion
Version of the PostScript table (post) contained in this font.(package private) static class
OpenFont.UnicodeMapping
Key-value helper class.
-
Field Summary
Fields Modifier and Type Field Description protected OTFAdvancedTypographicTableReader
advancedTableReader
private java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>>
ansiIndex
private java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>>
ansiKerningTab
private int[]
ansiWidth
private int
ascender
private int
capHeight
protected boolean
cid
private java.util.List<CMapSegment>
cmaps
private int
descender
protected java.util.Map<OFTableName,OFDirTabEntry>
dirTabs
Table directoryprotected java.lang.String
embedFontName
(package private) static int
ENC_BUF_SIZE
private static java.lang.String
ENCODING
protected java.util.Set<java.lang.String>
familyNames
private static short
FIRST_CHAR
private int
fontBBox1
private int
fontBBox2
private int
fontBBox3
private int
fontBBox4
protected FontFileReader
fontFile
The FontFileReader used to read this TrueType font.protected java.lang.String
fullName
private java.util.Map<java.lang.Integer,java.lang.Integer>
glyphToUnicodeMap
private boolean
hasSerifs
private int
hheaAscender
private int
hheaDescender
private boolean
isCFF
private boolean
isEmbeddable
private long
isFixedPitch
private long
italicAngle
private java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>>
kerningTab
private short
lastChar
protected long
lastLoca
Offset to last locaprotected int
locaFormat
protected org.apache.commons.logging.Log
log
logging instanceprivate static java.lang.String[]
MAC_GLYPH_ORDERING
(package private) static int
MAX_CHAR_CODE
protected OFMtxEntry[]
mtxTab
Contains glyph dataprotected int
nhmtx
protected java.lang.String
notice
(package private) static byte
NTABS
protected int
numberOfGlyphs
private int
os2Ascender
private int
os2CapHeight
private int
os2Descender
private int
os2xHeight
protected java.lang.String
postScriptName
private OpenFont.PostScriptVersion
postScriptVersion
private int
strikeoutPosition
private int
strikeoutThickness
protected java.lang.String
subFamilyName
protected java.util.Map<java.lang.Integer,SVGGlyphData>
svgs
static boolean
TRACE_ENABLED
Set to true to get even more debug output than with level DEBUGprivate int
underlinePosition
private int
underlineThickness
protected java.util.List<OpenFont.UnicodeMapping>
unicodeMappings
private java.util.Map<java.lang.Integer,java.lang.Integer>
unicodeToGlyphMap
private int
upem
protected boolean
useAdvanced
protected boolean
useKerning
private int
usWeightClass
private int
xHeight
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
checkTTC(java.lang.String tag, java.lang.String name)
Check if this is a TrueType collection and that the given name exists in the collection.int
convertTTFUnit2PDFUnit(int n)
Convert from truetype unit to pdf unit based on the unitsPerEm field in the "head" tableprotected void
createCMaps()
protected void
determineAscDesc()
Determines the right source for the ascender and descender values.private java.lang.String
formatUnitsForDebug(int units)
java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>>
getAnsiKerning()
Returns the ANSI kerning table.int[]
getBBox(int glyphIndex)
Returns an array (xMin, yMin, xMax, yMax) for a glyph.int[]
getBBoxRaw()
Returns the original bounding box values from the HEAD tablejava.awt.Rectangle[]
getBoundingBoxes()
int
getCapHeight()
Returns the CapHeight attribute of the font.java.lang.String
getCharSetName()
Returns the name of the character set used.int
getCharWidth(int idx)
Returns the width of a given character.int
getCharWidthRaw(int idx)
Returns the width of a given character in raw unitsjava.util.List<CMapSegment>
getCMaps()
Returns this font's character to glyph mapping.java.lang.String
getCopyrightNotice()
OFDirTabEntry
getDirectoryEntry(OFTableName name)
Obtain directory table entry.java.lang.String
getEmbedFontName()
java.util.Set<java.lang.String>
getFamilyNames()
Returns the font family names of the font.short
getFirstChar()
Returns the index of the first character.int
getFlags()
Returns the Flags attribute of the font.int[]
getFontBBox()
java.lang.String
getFullName()
Returns the full name of the font.GlyphDefinitionTable
getGDEF()
Returns the GDEF table or null if none present.(package private) java.lang.String
getGlyphName(int glyphIndex)
GlyphPositioningTable
getGPOS()
Returns the GPOS table or null if none present.GlyphSubstitutionTable
getGSUB()
Returns the GSUB table or null if none present.java.lang.String
getItalicAngle()
Returns the ItalicAngle attribute of the font.java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>>
getKerning()
Returns the kerning table.short
getLastChar()
Returns the index of the last character, but this is for WinAnsiEncoding only, so the last char is < 256.int
getLowerCaseAscent()
Returns the LowerCaseAscent attribute of the font.int
getLowerCaseDescent()
Returns the LowerCaseDescent attribute of the font.java.util.List<OFMtxEntry>
getMtx()
protected void
getNumGlyphs()
Read the number of glyphs from the "maxp" tableprotected int
getPadSize(int currentPosition)
Returns the number of bytes necessary to pad the currentPosition so that a table begins on a 4-byte boundary.java.lang.String
getPostScriptName()
Returns the PostScript name of the font.(package private) OpenFont.PostScriptVersion
getPostScriptVersion()
java.lang.String
getStemV()
Returns the StemV attribute of the font.int
getStrikeoutPosition()
int
getStrikeoutThickness()
java.lang.String
getSubFamilyName()
Returns the font sub family name of the font.java.util.List<java.lang.String>
getTTCnames(FontFileReader in)
Return TTC font namesint
getUnderlinePosition()
int
getUnderlineThickness()
int
getWeightClass()
Returns the weight class of this font.int[]
getWidths()
Returns an array of character widths.int
getXHeight()
Returns the XHeight attribute of the font.private java.lang.Integer
glyphToUnicode(int glyphIndex)
Map a glyph index to the corresponding unicode code pointprotected void
guessVerticalMetricsFromGlyphBBox()
protected void
handleCharacterSpacing(FontFileReader in)
boolean
hasAdvancedTable()
Determine if advanced (typographic) table is present.protected void
initAnsiWidths()
initialize the ansiWidths array (for winAnsiEncoding) and fill with the missingwidthprotected abstract void
initializeFont(FontFileReader in)
boolean
isCFF()
Indicates whether or not the font is an OpenType CFF font (rather than a TrueType font).boolean
isEmbeddable()
Indicates if the font may be embedded.private boolean
isInPrivateUseArea(int unicode)
private boolean
isInPrivateUseArea(int start, int end)
static void
main(java.lang.String[] args)
Static main method to get info about a TrueType font.private void
mapSymbol(int encodingID, int unicodeIndex, java.util.BitSet eightBitGlyphs, int glyphIdx)
void
printStuff()
Dumps a few informational values to System.out.protected boolean
readCMAP()
Read the cmap table, return false if the table is not present or only unsupported tables are present.protected void
readDirTabs()
Read Table Directory from the current position in the FontFileReader and fill the global HashMap dirTabs with the table name (String) as key and a TTFDirTabEntry as value.void
readFont(FontFileReader in, java.lang.String header)
Reads the font using a FontFileReader.boolean
readFont(FontFileReader in, java.lang.String header, java.lang.String name)
Read the font data.void
readFont(FontFileReader in, java.lang.String header, MultiByteFont mbfont)
Reads a font.protected void
readFontHeader()
Read the "head" table, this reads the bounding box and sets the upem (unitsPerEM) variableprotected void
readHorizontalHeader()
Read the "hhea" table to find the ascender and descender and size of "hmtx" table, as a fixed size font might have only one width.protected void
readHorizontalMetrics()
Read "hmtx" table and put the horizontal metrics in the mtxTab array.protected void
readKerning()
Read the kerning table, create a table for both CIDs and winAnsiEncoding.protected abstract void
readName()
protected void
readOS2()
Read the "OS/2" tableprotected boolean
readPCLT()
Read the "PCLT" table to find xHeight and capHeight.protected void
readPostScript()
Read the "post" table containing the PostScript names of the glyphs.private void
readSVG()
private boolean
readUnicodeCmap(long cmapUniOffset, int encodingID)
boolean
seekTab(FontFileReader in, OFTableName tableName, long offset)
Position inputstream to position indicated in the dirtab offset + offset(package private) java.util.SortedSet<java.util.Map.Entry<OFTableName,OFDirTabEntry>>
sortDirTabMap(java.util.Map<OFTableName,OFDirTabEntry> directoryTabs)
Returns the order in which the tables in a TrueType font should be written to file.void
stream(TTFOutputStream ttfOut)
Streams a font.private void
streamGlyf(TTFGlyphOutputStream glyphOut, byte[] fontFile, int tableOffset, int tableLength)
private java.lang.Integer
unicodeToGlyph(int unicodeIndex)
Map a unicode code point to the corresponding glyph indexprivate java.lang.Integer[]
unicodeToWinAnsi(int unicode)
protected abstract void
updateBBoxAndOffset()
-
-
-
Field Detail
-
NTABS
static final byte NTABS
- See Also:
- Constant Field Values
-
MAX_CHAR_CODE
static final int MAX_CHAR_CODE
- See Also:
- Constant Field Values
-
ENC_BUF_SIZE
static final int ENC_BUF_SIZE
- See Also:
- Constant Field Values
-
MAC_GLYPH_ORDERING
private static final java.lang.String[] MAC_GLYPH_ORDERING
-
fontFile
protected FontFileReader fontFile
The FontFileReader used to read this TrueType font.
-
TRACE_ENABLED
public static final boolean TRACE_ENABLED
Set to true to get even more debug output than with level DEBUG- See Also:
- Constant Field Values
-
ENCODING
private static final java.lang.String ENCODING
- See Also:
- Constant Field Values
-
FIRST_CHAR
private static final short FIRST_CHAR
- See Also:
- Constant Field Values
-
useKerning
protected boolean useKerning
-
isEmbeddable
private boolean isEmbeddable
-
hasSerifs
private boolean hasSerifs
-
dirTabs
protected java.util.Map<OFTableName,OFDirTabEntry> dirTabs
Table directory
-
kerningTab
private java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>> kerningTab
-
ansiKerningTab
private java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>> ansiKerningTab
-
cmaps
private java.util.List<CMapSegment> cmaps
-
unicodeMappings
protected java.util.List<OpenFont.UnicodeMapping> unicodeMappings
-
upem
private int upem
-
nhmtx
protected int nhmtx
-
postScriptVersion
private OpenFont.PostScriptVersion postScriptVersion
-
locaFormat
protected int locaFormat
-
lastLoca
protected long lastLoca
Offset to last loca
-
numberOfGlyphs
protected int numberOfGlyphs
-
mtxTab
protected OFMtxEntry[] mtxTab
Contains glyph data
-
postScriptName
protected java.lang.String postScriptName
-
fullName
protected java.lang.String fullName
-
embedFontName
protected java.lang.String embedFontName
-
notice
protected java.lang.String notice
-
familyNames
protected final java.util.Set<java.lang.String> familyNames
-
subFamilyName
protected java.lang.String subFamilyName
-
cid
protected boolean cid
-
italicAngle
private long italicAngle
-
isFixedPitch
private long isFixedPitch
-
fontBBox1
private int fontBBox1
-
fontBBox2
private int fontBBox2
-
fontBBox3
private int fontBBox3
-
fontBBox4
private int fontBBox4
-
capHeight
private int capHeight
-
os2CapHeight
private int os2CapHeight
-
underlinePosition
private int underlinePosition
-
underlineThickness
private int underlineThickness
-
strikeoutPosition
private int strikeoutPosition
-
strikeoutThickness
private int strikeoutThickness
-
xHeight
private int xHeight
-
os2xHeight
private int os2xHeight
-
ascender
private int ascender
-
descender
private int descender
-
hheaAscender
private int hheaAscender
-
hheaDescender
private int hheaDescender
-
os2Ascender
private int os2Ascender
-
os2Descender
private int os2Descender
-
usWeightClass
private int usWeightClass
-
lastChar
private short lastChar
-
ansiWidth
private int[] ansiWidth
-
ansiIndex
private java.util.Map<java.lang.Integer,java.util.List<java.lang.Integer>> ansiIndex
-
svgs
protected java.util.Map<java.lang.Integer,SVGGlyphData> svgs
-
glyphToUnicodeMap
private final java.util.Map<java.lang.Integer,java.lang.Integer> glyphToUnicodeMap
-
unicodeToGlyphMap
private final java.util.Map<java.lang.Integer,java.lang.Integer> unicodeToGlyphMap
-
isCFF
private boolean isCFF
-
useAdvanced
protected boolean useAdvanced
-
advancedTableReader
protected OTFAdvancedTypographicTableReader advancedTableReader
-
log
protected org.apache.commons.logging.Log log
logging instance
-
-
Method Detail
-
getDirectoryEntry
public OFDirTabEntry getDirectoryEntry(OFTableName name)
Obtain directory table entry.- Parameters:
name
- (tag) of entry- Returns:
- a directory table entry or null if none found
-
seekTab
public boolean seekTab(FontFileReader in, OFTableName tableName, long offset) throws java.io.IOException
Position inputstream to position indicated in the dirtab offset + offset- Parameters:
in
- font file readertableName
- (tag) of tableoffset
- from start of table- Returns:
- true if seek succeeded
- Throws:
java.io.IOException
- if I/O exception occurs during seek
-
convertTTFUnit2PDFUnit
public int convertTTFUnit2PDFUnit(int n)
Convert from truetype unit to pdf unit based on the unitsPerEm field in the "head" table- Parameters:
n
- truetype unit- Returns:
- pdf unit
-
readCMAP
protected boolean readCMAP() throws java.io.IOException
Read the cmap table, return false if the table is not present or only unsupported tables are present. Currently only unicode cmaps are supported. Set the unicodeIndex in the TTFMtxEntries and fills in the cmaps vector.- Throws:
java.io.IOException
- See Also:
- TrueType-Reference-Manual
-
readUnicodeCmap
private boolean readUnicodeCmap(long cmapUniOffset, int encodingID) throws java.io.IOException
- Throws:
java.io.IOException
-
mapSymbol
private void mapSymbol(int encodingID, int unicodeIndex, java.util.BitSet eightBitGlyphs, int glyphIdx)
-
isInPrivateUseArea
private boolean isInPrivateUseArea(int start, int end)
-
isInPrivateUseArea
private boolean isInPrivateUseArea(int unicode)
-
getMtx
public java.util.List<OFMtxEntry> getMtx()
- Returns:
- mmtx data
-
readFont
public void readFont(FontFileReader in, java.lang.String header) throws java.io.IOException
Reads the font using a FontFileReader.- Parameters:
in
- The FontFileReader to use- Throws:
java.io.IOException
- In case of an I/O problem
-
initAnsiWidths
protected void initAnsiWidths()
initialize the ansiWidths array (for winAnsiEncoding) and fill with the missingwidth
-
readFont
public boolean readFont(FontFileReader in, java.lang.String header, java.lang.String name) throws java.io.IOException
Read the font data. If the fontfile is a TrueType Collection (.ttc file) the name of the font to read data for must be supplied, else the name is ignored.- Parameters:
in
- The FontFileReader to usename
- The name of the font- Returns:
- boolean Returns true if the font is valid
- Throws:
java.io.IOException
- In case of an I/O problem
-
readFont
public void readFont(FontFileReader in, java.lang.String header, MultiByteFont mbfont) throws java.io.IOException
Reads a font.- Parameters:
in
- FontFileReader to read from- Throws:
java.io.IOException
- in case of an I/O problem
-
updateBBoxAndOffset
protected abstract void updateBBoxAndOffset() throws java.io.IOException
- Throws:
java.io.IOException
-
readName
protected abstract void readName() throws java.io.IOException
- Throws:
java.io.IOException
-
initializeFont
protected abstract void initializeFont(FontFileReader in) throws java.io.IOException
- Throws:
java.io.IOException
-
handleCharacterSpacing
protected void handleCharacterSpacing(FontFileReader in) throws java.io.IOException
- Throws:
java.io.IOException
-
createCMaps
protected void createCMaps()
-
getPostScriptName
public java.lang.String getPostScriptName()
Returns the PostScript name of the font.- Returns:
- String The PostScript name
-
getPostScriptVersion
OpenFont.PostScriptVersion getPostScriptVersion()
-
getFamilyNames
public java.util.Set<java.lang.String> getFamilyNames()
Returns the font family names of the font.- Returns:
- Set The family names (a Set of Strings)
-
getSubFamilyName
public java.lang.String getSubFamilyName()
Returns the font sub family name of the font.- Returns:
- String The sub family name
-
getFullName
public java.lang.String getFullName()
Returns the full name of the font.- Returns:
- String The full name
-
getCharSetName
public java.lang.String getCharSetName()
Returns the name of the character set used.- Returns:
- String The caracter set
-
getCapHeight
public int getCapHeight()
Returns the CapHeight attribute of the font.- Returns:
- int The CapHeight
-
getXHeight
public int getXHeight()
Returns the XHeight attribute of the font.- Returns:
- int The XHeight
-
getPadSize
protected int getPadSize(int currentPosition)
Returns the number of bytes necessary to pad the currentPosition so that a table begins on a 4-byte boundary.- Parameters:
currentPosition
- the position to pad.- Returns:
- int the number of bytes to pad.
-
getFlags
public int getFlags()
Returns the Flags attribute of the font.- Returns:
- int The Flags
-
getWeightClass
public int getWeightClass()
Returns the weight class of this font. Valid values are 100, 200....,800, 900.- Returns:
- the weight class value (or 0 if there was no OS/2 table in the font)
-
getStemV
public java.lang.String getStemV()
Returns the StemV attribute of the font.- Returns:
- String The StemV
-
getItalicAngle
public java.lang.String getItalicAngle()
Returns the ItalicAngle attribute of the font.- Returns:
- String The ItalicAngle
-
getFontBBox
public int[] getFontBBox()
- Returns:
- int[] The font bbox
-
getBBoxRaw
public int[] getBBoxRaw()
Returns the original bounding box values from the HEAD table- Returns:
- An array of bounding box values
-
getLowerCaseAscent
public int getLowerCaseAscent()
Returns the LowerCaseAscent attribute of the font.- Returns:
- int The LowerCaseAscent
-
getLowerCaseDescent
public int getLowerCaseDescent()
Returns the LowerCaseDescent attribute of the font.- Returns:
- int The LowerCaseDescent
-
getLastChar
public short getLastChar()
Returns the index of the last character, but this is for WinAnsiEncoding only, so the last char is < 256.- Returns:
- short Index of the last character (<256)
-
getFirstChar
public short getFirstChar()
Returns the index of the first character.- Returns:
- short Index of the first character
-
getWidths
public int[] getWidths()
Returns an array of character widths.- Returns:
- int[] The character widths
-
getBoundingBoxes
public java.awt.Rectangle[] getBoundingBoxes()
-
getBBox
public int[] getBBox(int glyphIndex)
Returns an array (xMin, yMin, xMax, yMax) for a glyph.- Parameters:
glyphIndex
- the index of the glyph- Returns:
- int[] Array defining bounding box.
-
getCharWidth
public int getCharWidth(int idx)
Returns the width of a given character.- Parameters:
idx
- Index of the character- Returns:
- int Standard width
-
getCharWidthRaw
public int getCharWidthRaw(int idx)
Returns the width of a given character in raw units- Parameters:
idx
- Index of the character- Returns:
- int Width in it's raw form stored in the font
-
getKerning
public java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>> getKerning()
Returns the kerning table.- Returns:
- Map The kerning table
-
getAnsiKerning
public java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>> getAnsiKerning()
Returns the ANSI kerning table.- Returns:
- Map The ANSI kerning table
-
getUnderlinePosition
public int getUnderlinePosition()
-
getUnderlineThickness
public int getUnderlineThickness()
-
getStrikeoutPosition
public int getStrikeoutPosition()
-
getStrikeoutThickness
public int getStrikeoutThickness()
-
isEmbeddable
public boolean isEmbeddable()
Indicates if the font may be embedded.- Returns:
- boolean True if it may be embedded
-
isCFF
public boolean isCFF()
Indicates whether or not the font is an OpenType CFF font (rather than a TrueType font).- Returns:
- true if the font is in OpenType CFF format.
-
readDirTabs
protected void readDirTabs() throws java.io.IOException
Read Table Directory from the current position in the FontFileReader and fill the global HashMap dirTabs with the table name (String) as key and a TTFDirTabEntry as value.- Throws:
java.io.IOException
- in case of an I/O problem
-
readFontHeader
protected void readFontHeader() throws java.io.IOException
Read the "head" table, this reads the bounding box and sets the upem (unitsPerEM) variable- Throws:
java.io.IOException
- in case of an I/O problem
-
getNumGlyphs
protected void getNumGlyphs() throws java.io.IOException
Read the number of glyphs from the "maxp" table- Throws:
java.io.IOException
- in case of an I/O problem
-
readHorizontalHeader
protected void readHorizontalHeader() throws java.io.IOException
Read the "hhea" table to find the ascender and descender and size of "hmtx" table, as a fixed size font might have only one width.- Throws:
java.io.IOException
- in case of an I/O problem
-
readSVG
private void readSVG() throws java.io.IOException
- Throws:
java.io.IOException
-
readHorizontalMetrics
protected void readHorizontalMetrics() throws java.io.IOException
Read "hmtx" table and put the horizontal metrics in the mtxTab array. If the number of metrics is less than the number of glyphs (eg fixed size fonts), extend the mtxTab array and fill in the missing widths- Throws:
java.io.IOException
- in case of an I/O problem
-
readPostScript
protected void readPostScript() throws java.io.IOException
Read the "post" table containing the PostScript names of the glyphs.- Throws:
java.io.IOException
-
readOS2
protected void readOS2() throws java.io.IOException
Read the "OS/2" table- Throws:
java.io.IOException
-
readPCLT
protected boolean readPCLT() throws java.io.IOException
Read the "PCLT" table to find xHeight and capHeight.- Throws:
java.io.IOException
- In case of a I/O problem
-
determineAscDesc
protected void determineAscDesc()
Determines the right source for the ascender and descender values. The problem here is that the interpretation of these values is not the same for every font. There doesn't seem to be a uniform definition of an ascender and a descender. In some fonts the hhea values are defined after the Apple interpretation, but not in every font. The same problem is in the OS/2 table. FOP needs the ascender and descender to determine the baseline so we need values which add up more or less to the "em box". However, due to accent modifiers a character can grow beyond the em box.
-
guessVerticalMetricsFromGlyphBBox
protected void guessVerticalMetricsFromGlyphBBox()
-
readKerning
protected void readKerning() throws java.io.IOException
Read the kerning table, create a table for both CIDs and winAnsiEncoding.- Throws:
java.io.IOException
- In case of a I/O problem
-
stream
public void stream(TTFOutputStream ttfOut) throws java.io.IOException
Streams a font.- Parameters:
ttfOut
- The interface for streaming TrueType tables.- Throws:
java.io.IOException
- file write error
-
streamGlyf
private void streamGlyf(TTFGlyphOutputStream glyphOut, byte[] fontFile, int tableOffset, int tableLength) throws java.io.IOException
- Throws:
java.io.IOException
-
sortDirTabMap
java.util.SortedSet<java.util.Map.Entry<OFTableName,OFDirTabEntry>> sortDirTabMap(java.util.Map<OFTableName,OFDirTabEntry> directoryTabs)
Returns the order in which the tables in a TrueType font should be written to file.- Parameters:
directoryTabs
- the map that is to be sorted.- Returns:
- TTFTablesNames[] an array of table names sorted in the order they should appear in the TTF file.
-
getCMaps
public java.util.List<CMapSegment> getCMaps()
Returns this font's character to glyph mapping.- Returns:
- the font's cmap
-
checkTTC
protected final boolean checkTTC(java.lang.String tag, java.lang.String name) throws java.io.IOException
Check if this is a TrueType collection and that the given name exists in the collection. If it does, set offset in fontfile to the beginning of the Table Directory for that font.- Parameters:
name
- The name to check- Returns:
- True if not collection or font name present, false otherwise
- Throws:
java.io.IOException
- In case of an I/O problem
-
getTTCnames
public final java.util.List<java.lang.String> getTTCnames(FontFileReader in) throws java.io.IOException
Return TTC font names- Parameters:
in
- FontFileReader to read from- Returns:
- True if not collection or font name present, false otherwise
- Throws:
java.io.IOException
- In case of an I/O problem
-
unicodeToWinAnsi
private java.lang.Integer[] unicodeToWinAnsi(int unicode)
-
printStuff
public void printStuff()
Dumps a few informational values to System.out.
-
formatUnitsForDebug
private java.lang.String formatUnitsForDebug(int units)
-
glyphToUnicode
private java.lang.Integer glyphToUnicode(int glyphIndex)
Map a glyph index to the corresponding unicode code point- Parameters:
glyphIndex
-- Returns:
- unicode code point
-
unicodeToGlyph
private java.lang.Integer unicodeToGlyph(int unicodeIndex) throws java.io.IOException
Map a unicode code point to the corresponding glyph index- Parameters:
unicodeIndex
- unicode code point- Returns:
- glyph index
- Throws:
java.io.IOException
-
getGlyphName
java.lang.String getGlyphName(int glyphIndex)
-
hasAdvancedTable
public boolean hasAdvancedTable()
Determine if advanced (typographic) table is present.- Returns:
- true if advanced (typographic) table is present
-
getGDEF
public GlyphDefinitionTable getGDEF()
Returns the GDEF table or null if none present.- Returns:
- the GDEF table
-
getGSUB
public GlyphSubstitutionTable getGSUB()
Returns the GSUB table or null if none present.- Returns:
- the GSUB table
-
getGPOS
public GlyphPositioningTable getGPOS()
Returns the GPOS table or null if none present.- Returns:
- the GPOS table
-
main
public static void main(java.lang.String[] args)
Static main method to get info about a TrueType font.- Parameters:
args
- The command line arguments
-
getEmbedFontName
public java.lang.String getEmbedFontName()
-
getCopyrightNotice
public java.lang.String getCopyrightNotice()
-
-