类 Font
java.lang.Object
com.google.typography.font.sfntly.Font
An sfnt container font object. This object is immutable and thread safe. To
construct one use an instance of
Font.Builder
.- 作者:
- Stuart Gill
-
嵌套类概要
嵌套类修饰符和类型类说明static final class
A builder for a font object.static enum
Macintosh encoding ids.private static enum
Offsets to specific elements in the underlying data.static enum
Platform ids.static enum
Unicode encoding ids.static enum
Windows encoding ids. -
字段概要
字段修饰符和类型字段说明Ordering of tables for different font types.private long
private final byte[]
private static final Logger
private final int
static final int
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明buildTableHeadersForSerialization
(List<Integer> tableOrdering) Build the table headers to be used for serialization.long
checksum()
Get the checksum for this font.Get the default table ordering based on the type of the font.byte[]
digest()
Gets a copy of the fonts digest that was created when the font was read.generateTableOrdering
(List<Integer> defaultTableOrdering) Generate the full table ordering to used for serialization.<T extends Table>
TgetTable
(int tag) Get the table in this font with the specified id.boolean
hasTable
(int tag) Does the font have a particular table.iterator()
Get an iterator over all the tables in the font.int
Get the number of tables in this font.(专用程序包) void
serialize
(OutputStream os, List<Integer> tableOrdering) Serialize the font to the output stream.private void
serializeHeader
(FontOutputStream fos, List<Header> tableHeaders) Searialize the headers.private void
serializeTables
(FontOutputStream fos, List<Header> tableHeaders) Serialize the tables.int
Gets the sfnt version set in the sfnt wrapper of the font.tableMap()
Get a map of the tables in this font accessed by table tag.toString()
-
字段详细资料
-
logger
-
CFF_TABLE_ORDERING
Ordering of tables for different font types. -
TRUE_TYPE_TABLE_ORDERING
-
SFNTVERSION_1
public static final int SFNTVERSION_1 -
sfntVersion
private final int sfntVersion -
digest
private final byte[] digest -
checksum
private long checksum -
tables
-
-
构造器详细资料
-
Font
private Font(int sfntVersion, byte[] digest) Constructor.- 参数:
sfntVersion
- the sfnt versiondigest
- the computed digest for the font; null if digest was not computed
-
-
方法详细资料
-
sfntVersion
public int sfntVersion()Gets the sfnt version set in the sfnt wrapper of the font.- 返回:
- the sfnt version
-
digest
public byte[] digest()Gets a copy of the fonts digest that was created when the font was read. If no digest was set at creation time then the return result will be null.- 返回:
- a copy of the digest array or
null
if one wasn't set at creation time
-
checksum
public long checksum()Get the checksum for this font.- 返回:
- the font checksum
-
numTables
public int numTables()Get the number of tables in this font.- 返回:
- the number of tables
-
iterator
Get an iterator over all the tables in the font.- 返回:
- a table iterator
-
hasTable
public boolean hasTable(int tag) Does the font have a particular table.- 参数:
tag
- the table identifier- 返回:
- true if the table is in the font; false otherwise
-
getTable
Get the table in this font with the specified id.- 类型参数:
T
- the type of the table- 参数:
tag
- the identifier of the table- 返回:
- the table specified if it exists; null otherwise
-
tableMap
Get a map of the tables in this font accessed by table tag.- 返回:
- an unmodifiable view of the tables in this font
-
toString
-
serialize
Serialize the font to the output stream.- 参数:
os
- the destination for the font serializationtableOrdering
- the table ordering to apply- 抛出:
IOException
-
buildTableHeadersForSerialization
Build the table headers to be used for serialization. These headers will be filled out with the data required for serialization. The headers will be sorted in the order specified and only those specified will have headers generated.- 参数:
tableOrdering
- the tables to generate headers for and the order to sort them- 返回:
- a list of table headers ready for serialization
-
serializeHeader
Searialize the headers.- 参数:
fos
- the destination stream for the headerstableHeaders
- the headers to serialize- 抛出:
IOException
-
serializeTables
Serialize the tables.- 参数:
fos
- the destination stream for the headerstableHeaders
- the headers for the tables to serialize- 抛出:
IOException
-
generateTableOrdering
Generate the full table ordering to used for serialization. The full ordering uses the partial ordering as a seed and then adds all remaining tables in the font in an undefined order.- 参数:
defaultTableOrdering
- the partial ordering to be used as a seed for the full ordering- 返回:
- the full ordering for serialization
-
defaultTableOrdering
Get the default table ordering based on the type of the font.- 返回:
- the default table ordering
-