类 WritableFontData
java.lang.Object
com.google.typography.font.sfntly.data.FontData
com.google.typography.font.sfntly.data.ReadableFontData
com.google.typography.font.sfntly.data.WritableFontData
Writable font data wrapper. Supports writing of data primitives in the
TrueType / OpenType spec.
- 作者:
- Stuart Gill
-
嵌套类概要
从类继承的嵌套类/接口 com.google.typography.font.sfntly.data.FontData
FontData.DataSize
-
字段概要
从类继承的字段 com.google.typography.font.sfntly.data.FontData
array, GROWABLE_SIZE
-
构造器概要
构造器限定符构造器说明private
WritableFontData
(ByteArray<? extends ByteArray<?>> array) Constructor.private
WritableFontData
(WritableFontData data, int offset) Constructor with a lower bound.private
WritableFontData
(WritableFontData data, int offset, int length) Constructor with lower bound and a length bound. -
方法概要
修饰符和类型方法说明void
copyFrom
(InputStream is) Copy everything from the InputStream into this FontData.void
copyFrom
(InputStream is, int length) Copy from the InputStream into this FontData.static final WritableFontData
createWritableFontData
(byte[] b) Constructs a writable font data object.static final WritableFontData
createWritableFontData
(int length) Constructs a writable font data object.static final WritableFontData
createWritableFontData
(ReadableFontData original) Constructs a writable font data object.slice
(int offset) Makes a bottom bound only slice of this array.slice
(int offset, int length) Makes a slice of this FontData.int
writeByte
(int index, byte b) Writes a byte at the given index.int
writeBytes
(int index, byte[] b) Writes the bytes from the array.int
writeBytes
(int index, byte[] b, int offset, int length) Writes the bytes from the array.int
writeBytesPad
(int index, byte[] b, int offset, int length, byte pad) Writes the bytes from the array and pad if necessary.int
writeChar
(int index, byte c) Writes the CHAR at the given index.int
writeDateTime
(int index, long date) Writes the LONGDATETIME at the given index.int
writeFixed
(int index, int f) Writes the Fixed at the given index.int
writeLong
(int index, long l) Writes the LONG at the given index.int
writePadding
(int index, int count) Writes padding to the FontData.int
writePadding
(int index, int count, byte pad) Writes padding to the FontData.int
writeShort
(int index, int s) Writes the SHORT at the given index.int
writeUInt24
(int index, int ui) Writes the UINT24 at the given index.int
writeULong
(int index, long ul) Writes the ULONG at the given index.int
writeULongLE
(int index, long ul) Writes the ULONG at the given index in little endian format.int
writeUShort
(int index, int us) Writes the USHORT at the given index.int
writeUShortLE
(int index, int us) Writes the USHORT at the given index in little endian format.从类继承的方法 com.google.typography.font.sfntly.data.ReadableFontData
checksum, checkSumRange, copyTo, copyTo, createReadableFontData, readByte, readBytes, readChar, readDateTimeAsLong, readF2Dot14, readFixed, readFUnit, readFWord, readLong, readLongDateTime, readShort, readUByte, readUFWord, readUInt24, readULong, readULongAsInt, readULongLE, readUShort, searchULong, searchUShort, searchUShort, setCheckSumRanges, toString, toString
从类继承的方法 com.google.typography.font.sfntly.data.FontData
bound, bound, boundLength, boundOffset, boundsCheck, dataOffset, length, size
-
构造器详细资料
-
WritableFontData
Constructor.- 参数:
array
- byte array to wrap
-
WritableFontData
Constructor with a lower bound.- 参数:
data
- other WritableFontData object to share data withoffset
- offset from the other WritableFontData's data
-
WritableFontData
Constructor with lower bound and a length bound.- 参数:
data
- other WritableFontData object to share data withoffset
- offset from the other WritableFontData's datalength
- length of other WritableFontData's data to use
-
-
方法详细资料
-
createWritableFontData
Constructs a writable font data object. If the length is specified as positive then a fixed size font data object will be created. If the length is zero or less then a growable font data object will be created and the size will be used as an estimate to help in allocating the original space.- 参数:
length
- if length > 0 create a fixed length font data; otherwise create a growable font data- 返回:
- a new writable font data
-
createWritableFontData
Constructs a writable font data object. The new font data object will wrap the bytes passed in to the factory and it will take ownership of those bytes. They should not be used again by the caller.- 参数:
b
- the byte array to wrap- 返回:
- a new writable font data
-
createWritableFontData
Constructs a writable font data object. The new font data object will wrap a copy of the the data used by the original writable font data object passed in.- 参数:
original
- the source font data- 返回:
- a new writable font data
-
slice
Makes a slice of this FontData. The returned slice will share the data with the originalFontData
.- 覆盖:
slice
在类中ReadableFontData
- 参数:
offset
- the start of the slicelength
- the number of bytes in the slice- 返回:
- a slice of the original FontData
-
slice
Makes a bottom bound only slice of this array. The returned slice will share the data with the originalFontData
.- 覆盖:
slice
在类中ReadableFontData
- 参数:
offset
- the start of the slice- 返回:
- a slice of the original FontData
-
writeByte
public int writeByte(int index, byte b) Writes a byte at the given index.- 参数:
index
- index into the font datab
- the byte to write- 返回:
- the number of bytes written
-
writeBytes
public int writeBytes(int index, byte[] b, int offset, int length) Writes the bytes from the array.- 参数:
index
- index into the font datab
- the source for the bytes to be writtenoffset
- offset in the byte arraylength
- the length of the bytes to be written- 返回:
- the number of bytes actually written; -1 if the index is outside the FontData's range
-
writeBytesPad
public int writeBytesPad(int index, byte[] b, int offset, int length, byte pad) Writes the bytes from the array and pad if necessary. Writes to the length given using the byte array provided and if there are not enough bytes in the array then pad to the requested length using the pad byte specified.- 参数:
index
- index into the font datab
- the source for the bytes to be writtenoffset
- offset in the byte arraylength
- the length of the bytes to be writtenpad
- the padding byte to be used if necessary- 返回:
- the number of bytes actually written
-
writePadding
public int writePadding(int index, int count) Writes padding to the FontData. The padding byte written is 0x00.- 参数:
index
- index into the font datacount
- the number of pad bytes to write- 返回:
- the number of pad bytes written
-
writePadding
public int writePadding(int index, int count, byte pad) Writes padding to the FontData.- 参数:
index
- index into the font datacount
- the number of pad bytes to writepad
- the byte value to use as padding- 返回:
- the number of pad bytes written
-
writeBytes
public int writeBytes(int index, byte[] b) Writes the bytes from the array.- 参数:
index
- index into the font datab
- the source for the bytes to be written- 返回:
- the number of bytes actually written; -1 if the index is outside the FontData's range
-
writeChar
public int writeChar(int index, byte c) Writes the CHAR at the given index.- 参数:
index
- index into the font datac
- the CHAR- 返回:
- the number of bytes actually written
- 抛出:
IndexOutOfBoundsException
- if index is outside the FontData's range
-
writeUShort
public int writeUShort(int index, int us) Writes the USHORT at the given index.- 参数:
index
- index into the font dataus
- the USHORT- 返回:
- the number of bytes actually written
- 抛出:
IndexOutOfBoundsException
- if index is outside the FontData's range
-
writeUShortLE
public int writeUShortLE(int index, int us) Writes the USHORT at the given index in little endian format.- 参数:
index
- index into the font dataus
- the USHORT- 返回:
- the number of bytes actually written
- 抛出:
IndexOutOfBoundsException
- if index is outside the FontData's range
-
writeShort
public int writeShort(int index, int s) Writes the SHORT at the given index.- 参数:
index
- index into the font datas
- the SHORT- 返回:
- the number of bytes actually written
- 抛出:
IndexOutOfBoundsException
- if index is outside the FontData's range
-
writeUInt24
public int writeUInt24(int index, int ui) Writes the UINT24 at the given index.- 参数:
index
- index into the font dataui
- the UINT24- 返回:
- the number of bytes actually written
- 抛出:
IndexOutOfBoundsException
- if index is outside the FontData's range
-
writeULong
public int writeULong(int index, long ul) Writes the ULONG at the given index.- 参数:
index
- index into the font dataul
- the ULONG- 返回:
- the number of bytes actually written
- 抛出:
IndexOutOfBoundsException
- if index is outside the FontData's range
-
writeULongLE
public int writeULongLE(int index, long ul) Writes the ULONG at the given index in little endian format.- 参数:
index
- index into the font dataul
- the ULONG- 返回:
- the number of bytes actually written
- 抛出:
IndexOutOfBoundsException
- if index is outside the FontData's range
-
writeLong
public int writeLong(int index, long l) Writes the LONG at the given index.- 参数:
index
- index into the font datal
- the LONG- 返回:
- the number of bytes actually written
- 抛出:
IndexOutOfBoundsException
- if index is outside the FontData's range
-
writeFixed
public int writeFixed(int index, int f) Writes the Fixed at the given index.- 参数:
index
- index into the font dataf
- the Fixed- 返回:
- the number of bytes actually written
- 抛出:
IndexOutOfBoundsException
- if index is outside the FontData's range
-
writeDateTime
public int writeDateTime(int index, long date) Writes the LONGDATETIME at the given index.- 参数:
index
- index into the font datadate
- the LONGDATETIME- 返回:
- the number of bytes actually written
- 抛出:
IndexOutOfBoundsException
- if index is outside the FontData's range
-
copyFrom
Copy from the InputStream into this FontData.- 参数:
is
- the sourcelength
- the number of bytes to copy- 抛出:
IOException
-
copyFrom
Copy everything from the InputStream into this FontData.- 参数:
is
- the source- 抛出:
IOException
-