// Copyright (c) Six Labors. // Licensed under the Six Labors Split License. using SixLabors.Fonts.Unicode; using SixLabors.Fonts.WellKnownIds; using System.Collections.Generic; namespace SixLabors.Fonts.Tables.General.CMap { /// /// Base class for all 'cmap' subtables that map character codes to glyph indices. /// /// internal abstract class CMapSubTable { /// /// Initializes a new instance of the class. /// public CMapSubTable() { } /// /// Initializes a new instance of the class. /// /// The platform identifier. /// The platform-specific encoding identifier. /// The subtable format number. public CMapSubTable(PlatformIDs platform, ushort encoding, ushort format) { this.Platform = platform; this.Encoding = encoding; this.Format = format; } /// /// Gets the subtable format number. /// public ushort Format { get; } /// /// Gets the platform identifier. /// public PlatformIDs Platform { get; } /// /// Gets the platform-specific encoding identifier. /// public ushort Encoding { get; } /// /// Tries to get the glyph identifier for the given code point. /// /// The Unicode code point. /// When this method returns, contains the glyph identifier if found; otherwise, 0. /// if the glyph identifier was found; otherwise, . public abstract bool TryGetGlyphId(CodePoint codePoint, out ushort glyphId); /// /// Tries to get the code point for the given glyph identifier. /// /// The glyph identifier. /// When this method returns, contains the code point if found; otherwise, the default value. /// if the code point was found; otherwise, . public abstract bool TryGetCodePoint(ushort glyphId, out CodePoint codePoint); /// /// Gets the collection of all available code points in this subtable. /// /// An enumerable of available code point values. public abstract IEnumerable GetAvailableCodePoints(); } }