• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class FontBinaryReader

A big-endian binary reader for OpenType/TrueType font data. All multi-byte integers are read in network byte order (most-significant byte first), as required by the OpenType specification.

Inheritance
object
FontBinaryReader
Implements
IDisposable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DRIT.Drawing.Font.IO
Assembly: DRIT.Drawing.dll
Syntax
public sealed class FontBinaryReader : IDisposable

Constructors

FontBinaryReader(Stream, bool)

A big-endian binary reader for OpenType/TrueType font data. All multi-byte integers are read in network byte order (most-significant byte first), as required by the OpenType specification.

Declaration
public FontBinaryReader(Stream stream, bool leaveOpen = false)
Parameters
Type Name Description
Stream stream

The stream to read from. Must support seeking.

bool leaveOpen

When true the underlying stream is NOT disposed when this reader is disposed. Use this when the stream's lifetime is managed by an outer scope.

Properties

Length

Total length of the underlying stream in bytes.

Declaration
public long Length { get; }
Property Value
Type Description
long

Position

Current byte position within the underlying stream.

Declaration
public long Position { get; }
Property Value
Type Description
long

Methods

Dispose()

A big-endian binary reader for OpenType/TrueType font data. All multi-byte integers are read in network byte order (most-significant byte first), as required by the OpenType specification.

Declaration
public void Dispose()

ReadBytes(int)

Reads exactly count bytes from the current position.

Declaration
public byte[] ReadBytes(int count)
Parameters
Type Name Description
int count
Returns
Type Description
byte[]

ReadF2Dot14()

Reads a 2.14 fixed-point number (signed 16-bit integer divided by 16384). Used for normalised variation coordinates in gvar/avar.

Declaration
public double ReadF2Dot14()
Returns
Type Description
double

ReadFixed()

Reads a 16.16 fixed-point number (signed 32-bit integer divided by 65536). Used for the sfVersion field, post.italicAngle, etc.

Declaration
public double ReadFixed()
Returns
Type Description
double

ReadInt16()

Reads a signed 16-bit integer (big-endian).

Declaration
public short ReadInt16()
Returns
Type Description
short

ReadInt32()

Reads a signed 32-bit integer (big-endian).

Declaration
public int ReadInt32()
Returns
Type Description
int

ReadInt64()

Reads a signed 64-bit integer (big-endian). Used for LONGDATETIME fields (e.g. head.created / head.modified).

Declaration
public long ReadInt64()
Returns
Type Description
long

ReadTag()

Reads a 4-byte ASCII tag string (e.g. "head", "cmap", "OTTO").

Declaration
public string ReadTag()
Returns
Type Description
string

ReadUInt16()

Reads an unsigned 16-bit integer (big-endian).

Declaration
public ushort ReadUInt16()
Returns
Type Description
ushort

ReadUInt32()

Reads an unsigned 32-bit integer (big-endian).

Declaration
public uint ReadUInt32()
Returns
Type Description
uint

ReadUInt8()

Reads one unsigned byte.

Declaration
public byte ReadUInt8()
Returns
Type Description
byte

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

Skip(int)

Advances the read position by count bytes.

Declaration
public void Skip(int count)
Parameters
Type Name Description
int count

Implements

IDisposable
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX