// Copyright (c) Six Labors. // Licensed under the Six Labors Split License. using System.IO; namespace SixLabors.Fonts.Tables.AdvancedTypographic.GPos { /// /// Each LigatureAttach table consists of an array (componentRecords) and count (componentCount) of the component glyphs in a ligature. /// The array stores the ComponentRecords in the same order as the components in the ligature. /// The order of the records also corresponds to the writing direction — that is, the logical direction — of the text. /// For text written left to right, the first component is on the left; for text written right to left, the first component is on the right. /// internal class LigatureAttachTable { /// /// Initializes a new instance of the class. /// /// The big endian binary reader. /// Number of defined mark classes. /// Offset from beginning of LigatureAttach table. public LigatureAttachTable(BigEndianBinaryReader reader, ushort markClassCount, long offset) { // +-------------------+---------------------------------+--------------------------------------------------------------------------------------+ // | Type | Name | Description | // +===================+=================================+======================================================================================+ // | uint16 | componentCount | Number of ComponentRecords in this ligature. | // +-------------------+---------------------------------+--------------------------------------------------------------------------------------+ // | ComponentRecords | componentRecords[componentCount]| Array of Component records, ordered in writing direction. | // +-------------------+---------------------------------+--------------------------------------------------------------------------------------+ reader.Seek(offset, SeekOrigin.Begin); ushort componentCount = reader.ReadUInt16(); this.ComponentRecords = new ComponentRecord[componentCount]; for (int i = 0; i < componentCount; i++) { this.ComponentRecords[i] = new ComponentRecord(reader, markClassCount, offset); } } /// /// Gets the array of component records for this ligature, ordered in writing direction. /// public ComponentRecord[] ComponentRecords { get; } } }