Package org.apache.fontbox.ttf
Class NamingTable
java.lang.Object
org.apache.fontbox.ttf.TTFTable
org.apache.fontbox.ttf.NamingTable
This 'name'-table is a required table in a TrueType font.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate Stringprivate List<NameRecord> private Stringstatic final StringA tag that identifies this table type.Fields inherited from class org.apache.fontbox.ttf.TTFTable
initialized -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate CharsetgetCharset(NameRecord nr) private StringgetEnglishName(int nameId) Helper to get English names by best effort.Returns the font family name, in English.Returns the font sub family name, in English.getName(int nameId, int platformId, int encodingId, int languageId) Returns a name from the table, or null it it does not exist.This will get the name records for this naming table.Returns the PostScript name.private static boolean(package private) voidread(TrueTypeFont ttf, TTFDataStream data) This will read the required data from the stream.private voidread(TrueTypeFont ttf, TTFDataStream data, boolean onlyHeaders) (package private) voidreadHeaders(TrueTypeFont ttf, TTFDataStream data, FontHeaders outHeaders) This will read required headers from the stream into outHeaders.private voidMethods inherited from class org.apache.fontbox.ttf.TTFTable
getCheckSum, getInitialized, getLength, getOffset, getTag, setCheckSum, setLength, setOffset, setTag
-
Field Details
-
TAG
A tag that identifies this table type.- See Also:
-
nameRecords
-
lookupTable
-
fontFamily
-
fontSubFamily
-
psName
-
-
Constructor Details
-
NamingTable
NamingTable()
-
-
Method Details
-
read
This will read the required data from the stream.- Overrides:
readin classTTFTable- Parameters:
ttf- The font that is being read.data- The stream to read the data from.- Throws:
IOException- If there is an error reading the data.
-
readHeaders
This will read required headers from the stream into outHeaders.- Overrides:
readHeadersin classTTFTable- Parameters:
ttf- The font that is being read.data- The stream to read the data from.outHeaders- The class to write the data to.- Throws:
IOException- If there is an error reading the data.
-
read
- Throws:
IOException
-
getCharset
-
fillLookupTable
private void fillLookupTable() -
readInterestingStrings
private void readInterestingStrings() -
isUsefulForOnlyHeaders
-
getEnglishName
Helper to get English names by best effort. -
getName
Returns a name from the table, or null it it does not exist.- Parameters:
nameId- Name ID from NameRecord constants.platformId- Platform ID from NameRecord constants.encodingId- Platform Encoding ID from NameRecord constants.languageId- Language ID from NameRecord constants.- Returns:
- name, or null
-
getNameRecords
This will get the name records for this naming table.- Returns:
- A list of NameRecord objects.
-
getFontFamily
Returns the font family name, in English.- Returns:
- the font family name, in English
-
getFontSubFamily
Returns the font sub family name, in English.- Returns:
- the font sub family name, in English
-
getPostScriptName
Returns the PostScript name.- Returns:
- the PostScript name
-