// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using System.IO;
namespace SixLabors.Fonts.Tables.AdvancedTypographic.GPos {
///
/// Represents the BaseArray table used in MarkToBase attachment positioning (GPOS LookupType 4).
/// The BaseArray table contains an array of BaseRecords, one for each base glyph, ordered by the base Coverage index.
///
///
internal class BaseArrayTable
{
///
/// Initializes a new instance of the class.
///
/// The big endian binary reader.
/// The offset to the beginning of the base array table.
/// The class count.
public BaseArrayTable(BigEndianBinaryReader reader, long offset, ushort classCount)
{
// +--------------+------------------------+--------------------------------------------------------------------------------------+
// | Type | Name | Description |
// +==============+========================+======================================================================================+
// | uint16 | baseCount | Number of BaseRecords |
// +--------------+------------------------+--------------------------------------------------------------------------------------+
// | BaseRecord | baseRecords[baseCount] | Array of BaseRecords, in order of baseCoverage Index. |
// +--------------+------------------------+--------------------------------------------------------------------------------------+
reader.Seek(offset, SeekOrigin.Begin);
ushort baseCount = reader.ReadUInt16();
this.BaseRecords = new BaseRecord[baseCount];
for (int i = 0; i < baseCount; i++)
{
this.BaseRecords[i] = new BaseRecord(reader, classCount, offset);
}
}
///
/// Gets the base records.
///
public BaseRecord[] BaseRecords { get; }
}
}