Class FontBinaryWriter
A big-endian binary writer for OpenType/TrueType font data. All multi-byte integers are written in network byte order (most-significant byte first), as required by the OpenType specification.
Implements
Inherited Members
Namespace: DRIT.Drawing.Font.IO
Assembly: DRIT.Drawing.dll
Syntax
public sealed class FontBinaryWriter : IDisposable
Constructors
FontBinaryWriter(Stream, bool)
A big-endian binary writer for OpenType/TrueType font data. All multi-byte integers are written in network byte order (most-significant byte first), as required by the OpenType specification.
Declaration
public FontBinaryWriter(Stream stream, bool leaveOpen = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream to write to. |
| bool | leaveOpen | When |
Properties
Position
Current byte position within the underlying stream.
Declaration
public long Position { get; }
Property Value
| Type | Description |
|---|---|
| long |
Methods
Align4()
Pads the current position forward with zero bytes until the stream position is aligned to a 4-byte boundary. No-op when already aligned. Required by OpenType: every table must begin on a 4-byte boundary.
Declaration
public void Align4()
Dispose()
A big-endian binary writer for OpenType/TrueType font data. All multi-byte integers are written in network byte order (most-significant byte first), as required by the OpenType specification.
Declaration
public void Dispose()
Flush()
Flushes the underlying stream.
Declaration
public void Flush()
Seek(long)
Seeks to an absolute byte offset from the beginning of the stream.
Declaration
public void Seek(long offset)
Parameters
| Type | Name | Description |
|---|---|---|
| long | offset |
WriteBytes(byte[])
Writes a raw byte array verbatim.
Declaration
public void WriteBytes(byte[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | data |
WriteF2Dot14(double)
Writes a 2.14 fixed-point number.
Declaration
public void WriteF2Dot14(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value |
WriteFixed(double)
Writes a 16.16 fixed-point number.
Declaration
public void WriteFixed(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value |
WriteInt16(short)
Writes a signed 16-bit integer (big-endian).
Declaration
public void WriteInt16(short value)
Parameters
| Type | Name | Description |
|---|---|---|
| short | value |
WriteInt32(int)
Writes a signed 32-bit integer (big-endian).
Declaration
public void WriteInt32(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| int | value |
WriteInt64(long)
Writes a signed 64-bit integer (big-endian).
Declaration
public void WriteInt64(long value)
Parameters
| Type | Name | Description |
|---|---|---|
| long | value |
WriteTag(string)
Writes a 4-byte ASCII tag. If tag is shorter than
4 characters it is right-padded with spaces; if longer it is truncated.
Declaration
public void WriteTag(string tag)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tag |
WriteUInt16(ushort)
Writes an unsigned 16-bit integer (big-endian).
Declaration
public void WriteUInt16(ushort value)
Parameters
| Type | Name | Description |
|---|---|---|
| ushort | value |
WriteUInt32(uint)
Writes an unsigned 32-bit integer (big-endian).
Declaration
public void WriteUInt32(uint value)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | value |
WriteUInt8(byte)
Writes one unsigned byte.
Declaration
public void WriteUInt8(byte value)
Parameters
| Type | Name | Description |
|---|---|---|
| byte | value |