Top Description Fields Constructors Methods
org.apache.fontbox.ttf

public Class NamingTable

extends TTFTable
Class Inheritance
Imports
java.io.IOException, java.nio.charset.Charset, .StandardCharsets, java.util.ArrayList, .HashMap, .List, .Map

This 'name'-table is a required table in a TrueType font.
Author
Ben Litchfield

Field Summary

Modifier and TypeField and Description
private String
private String
private Map<Integer, Map<Integer, Map<Integer, Map<Integer, String>>>>
private List<NameRecord>
private String
public static final String
TAG

A tag that identifies this table type.

Inherited from org.apache.fontbox.ttf.TTFTable:
initialized

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private void
private Charset
private String
getEnglishName(int nameId)

Helper to get English names by best effort.

public String

Returns:

the font family name, in English
getFontFamily
()

Returns the font family name, in English.

public String

Returns:

the font sub family name, in English
getFontSubFamily
()

Returns the font sub family name, in English.

public String

Returns:

name, or null
getName
(int
Name ID from NameRecord constants.
nameId
,
int
Platform ID from NameRecord constants.
platformId
,
int
Platform Encoding ID from NameRecord constants.
encodingId
,
int
Language ID from NameRecord constants.
languageId
)

Returns a name from the table, or null it it does not exist.

public List<NameRecord>

Returns:

A list of NameRecord objects.
getNameRecords
()

This will get the name records for this naming table.

public String

Returns:

the PostScript name
getPostScriptName
()

Returns the PostScript name.

private static boolean
pack-priv void
read(TrueTypeFont
The font that is being read.
ttf
,
TTFDataStream
The stream to read the data from.
data
)

Overrides org.apache.fontbox.ttf.TTFTable.read.

This will read the required data from the stream.

private void
read(TrueTypeFont ttf, TTFDataStream data, boolean onlyHeaders)

pack-priv void
readHeaders(TrueTypeFont
The font that is being read.
ttf
,
TTFDataStream
The stream to read the data from.
data
,
FontHeaders
The class to write the data to.
outHeaders
)

Overrides org.apache.fontbox.ttf.TTFTable.readHeaders.

This will read required headers from the stream into outHeaders.

private void
Inherited from org.apache.fontbox.ttf.TTFTable:
getCheckSumgetInitializedgetLengthgetOffsetgetTagsetCheckSumsetLengthsetOffsetsetTag

Field Detail

fontFamilyback to summary
private String fontFamily
fontSubFamilyback to summary
private String fontSubFamily
lookupTableback to summary
private Map<Integer, Map<Integer, Map<Integer, Map<Integer, String>>>> lookupTable
nameRecordsback to summary
private List<NameRecord> nameRecords
psNameback to summary
private String psName
TAGback to summary
public static final String TAG

A tag that identifies this table type.

Constructor Detail

NamingTableback to summary
pack-priv NamingTable()

Method Detail

fillLookupTableback to summary
private void fillLookupTable()
getCharsetback to summary
private Charset getCharset(NameRecord nr)
getEnglishNameback to summary
private String getEnglishName(int nameId)

Helper to get English names by best effort.

getFontFamilyback to summary
public String getFontFamily()

Returns the font family name, in English.

Returns:String

the font family name, in English

getFontSubFamilyback to summary
public String getFontSubFamily()

Returns the font sub family name, in English.

Returns:String

the font sub family name, in English

getNameback to summary
public String getName(int nameId, int platformId, int encodingId, int languageId)

Returns a name from the table, or null it it does not exist.

Parameters
nameId:int

Name ID from NameRecord constants.

platformId:int

Platform ID from NameRecord constants.

encodingId:int

Platform Encoding ID from NameRecord constants.

languageId:int

Language ID from NameRecord constants.

Returns:String

name, or null

getNameRecordsback to summary
public List<NameRecord> getNameRecords()

This will get the name records for this naming table.

Returns:List<NameRecord>

A list of NameRecord objects.

getPostScriptNameback to summary
public String getPostScriptName()

Returns the PostScript name.

Returns:String

the PostScript name

isUsefulForOnlyHeadersback to summary
private static boolean isUsefulForOnlyHeaders(NameRecord nr)
readback to summary
pack-priv void read(TrueTypeFont ttf, TTFDataStream data) throws IOException

Overrides org.apache.fontbox.ttf.TTFTable.read.

This will read the required data from the stream.

Parameters
ttf:TrueTypeFont

The font that is being read.

data:TTFDataStream

The stream to read the data from.

Annotations
@Override
Exceptions
IOException:
If there is an error reading the data.
readback to summary
private void read(TrueTypeFont ttf, TTFDataStream data, boolean onlyHeaders) throws IOException
readHeadersback to summary
pack-priv void readHeaders(TrueTypeFont ttf, TTFDataStream data, FontHeaders outHeaders) throws IOException

Overrides org.apache.fontbox.ttf.TTFTable.readHeaders.

Doc from org.apache.fontbox.ttf.TTFTable.readHeaders.

This will read required headers from the stream into outHeaders.

Parameters
ttf:TrueTypeFont

The font that is being read.

data:TTFDataStream

The stream to read the data from.

outHeaders:FontHeaders

The class to write the data to.

Annotations
@Override
Exceptions
IOException:
If there is an error reading the data.
readInterestingStringsback to summary
private void readInterestingStrings()