// Copyright (c) Six Labors. // Licensed under the Six Labors Split License. using System.IO; namespace SixLabors.Fonts.Tables.AdvancedTypographic.GPos { /// /// The LigatureArray table contains a count (ligatureCount) and an array of offsets (ligatureAttachOffsets) to LigatureAttach tables. /// The ligatureAttachOffsets array lists the offsets to LigatureAttach tables, one for each ligature glyph listed in the ligatureCoverage table, /// in the same order as the ligatureCoverage index. /// internal class LigatureArrayTable { /// /// Initializes a new instance of the class. /// /// The big endian binary reader. /// The offset to the start of the ligature array table. /// Number of defined mark classes. public LigatureArrayTable(BigEndianBinaryReader reader, long offset, ushort markClassCount) { // +--------------+--------------------------------------+--------------------------------------------------------------------------------------+ // | Type | Name | Description | // +==============+======================================+======================================================================================+ // | uint16 | ligatureCount | Number of LigatureAttach table offsets. | // +--------------+--------------------------------------+--------------------------------------------------------------------------------------+ // | Offset16 | ligatureAttachOffsets[ligatureCount] | Array of offsets to LigatureAttach tables. Offsets are from beginning of | // | | | LigatureArray table, ordered by ligatureCoverage index. | // +--------------+--------------------------------------+--------------------------------------------------------------------------------------+ reader.Seek(offset, SeekOrigin.Begin); ushort ligatureCount = reader.ReadUInt16(); this.LigatureAttachTables = new LigatureAttachTable[ligatureCount]; ushort[] ligatureAttachOffsets = new ushort[ligatureCount]; for (int i = 0; i < ligatureCount; i++) { ligatureAttachOffsets[i] = reader.ReadOffset16(); } for (int i = 0; i < ligatureCount; i++) { this.LigatureAttachTables[i] = new LigatureAttachTable(reader, markClassCount, offset + ligatureAttachOffsets[i]); } } /// /// Gets the array of LigatureAttach tables, one per ligature glyph, in the same order as the ligature Coverage index. /// public LigatureAttachTable[] LigatureAttachTables { get; } } }