Xui.Runtime.Software.Font
Assembly: Xui.Runtime.Software · C# declarations · Assembly overview
Types
class CMapTablereadonly record struct CMapTable.GlyphMappingclass Catalogreadonly struct FontFaceclass FontUsagereadonly record struct FontUsage.RunePairclass GPosTableclass GPosTable.ClassDefTableclass GPosTable.ClassDefTable.Format1class GPosTable.ClassDefTable.Format2class GPosTable.CoverageTableclass GPosTable.CoverageTable.Format1class GPosTable.CoverageTable.Format2class GPosTable.ExtensionPositioningSubtableclass GPosTable.FeatureListTableclass GPosTable.FeatureTableclass GPosTable.LangSysTableclass GPosTable.LookupListTableclass GPosTable.LookupTableenum GPosTable.LookupTable.GPosLookupTypeclass GPosTable.PairAdjustmentSubtableclass GPosTable.PairAdjustmentSubtable.Format1record class GPosTable.PairAdjustmentSubtable.Format1.PairSetrecord class GPosTable.PairAdjustmentSubtable.Format1.PairValueRecordclass GPosTable.PairAdjustmentSubtable.Format2record class GPosTable.PairAdjustmentSubtable.Format2.PairValueRecordclass GPosTable.ScriptListTableclass GPosTable.ScriptTableclass GlyfTablereadonly record struct GlyfTable.Subsetreadonly record struct GlyphPositionref struct GlyphShapestruct GlyphShape.GlyphBoundclass HeaderTableclass HorizontalHeaderTableclass HorizontalMetricsTablerecord struct HorizontalMetricsTable.HorizontalMetricclass KernTablereadonly record struct KernTable.Pairclass LocaTableclass MaxProfileTableclass NameTablerecord struct NameTable.NameRecordclass OS2Tableclass PostTablereadonly record struct TableRecordclass TextLayoutreadonly record struct TextLayout.GlyphPositionclass TrueTypeFontreadonly struct TrueTypeFont.KerningQueryreadonly record struct TrueTypeFont.TableRecordrecord struct TrueTypeFont.ValueRecordrecord struct TrueTypeFont.ValueRecordTupleclass TrueTypeFontSubset
class CMapTable
public class CMapTable
{
public CMapTable(ReadOnlySpan<byte> data);
public int? GetGlyphIndex(int unicode);
public int? GetGlyphIndex(Rune rune);
public static byte[] CreateSubset(IReadOnlyList<GlyphMapping> mappings);
public readonly record struct GlyphMapping(Rune Character, ushort GlyphId);
}
CMapTable.CMapTable(ReadOnlySpan<byte> data)
public CMapTable(ReadOnlySpan<byte> data);
byte[] CMapTable.CreateSubset(IReadOnlyList<GlyphMapping> mappings)
public static byte[] CreateSubset(IReadOnlyList<GlyphMapping> mappings);
Creates a Windows Unicode cmap for the retained Unicode scalar values.
int? CMapTable.GetGlyphIndex(int unicode)
public int? GetGlyphIndex(int unicode);
int? CMapTable.GetGlyphIndex(Rune rune)
public int? GetGlyphIndex(Rune rune);
readonly record struct CMapTable.GlyphMapping
public readonly record struct GlyphMapping(Rune Character, ushort GlyphId);
GlyphMapping.GlyphMapping(Rune Character, ushort GlyphId)
public GlyphMapping(Rune Character, ushort GlyphId);
Rune GlyphMapping.Character
public Rune Character { get; init; }
ushort GlyphMapping.GlyphId
public ushort GlyphId { get; init; }
class Catalog
public class Catalog
{
public Catalog(params IEnumerable<Uri>[] sources);
public Catalog(IFontSource fontSource);
public virtual IEnumerable<Uri> Fonts();
public virtual ReadOnlyMemory<byte> LoadFromUri(Uri uri);
public static ReadOnlyMemory<byte> LoadEmbedded(Uri uri);
public IEnumerable<Uri> AStar(FontFace font);
public TextMetrics MeasureText(in Core.Canvas.Font font, string text, TextAlign textAlign = TextAlign.Left, TextBaseline textBaseline = TextBaseline.Alphabetic);
public TrueTypeFont? FontForFace(in FontFace face);
}
Catalog.Catalog(params IEnumerable<Uri>[] sources)
public Catalog(params IEnumerable<Uri>[] sources);
Catalog.Catalog(IFontSource fontSource)
public Catalog(IFontSource fontSource);
Creates a catalog backed by descriptor-first, lazily loaded font resources.
IEnumerable<Uri> Catalog.AStar(FontFace font)
public IEnumerable<Uri> AStar(FontFace font);
TrueTypeFont? Catalog.FontForFace(in FontFace face)
public TrueTypeFont? FontForFace(in FontFace face);
IEnumerable<Uri> Catalog.Fonts()
public virtual IEnumerable<Uri> Fonts();
ReadOnlyMemory<byte> Catalog.LoadEmbedded(Uri uri)
public static ReadOnlyMemory<byte> LoadEmbedded(Uri uri);
Loads embedded font data from a URI in the format: embedded://Assembly.Name/Folder/File.ttf
uri— The embedded URI, e.g. embedded://Xui.Core.Fonts/Inter/Inter-Bold.ttf
Returns: A byte array containing the font file contents.
Throws Thrown when the resource or assembly cannot be found.: Thrown when the resource or assembly cannot be found.
ReadOnlyMemory<byte> Catalog.LoadFromUri(Uri uri)
public virtual ReadOnlyMemory<byte> LoadFromUri(Uri uri);
TextMetrics Catalog.MeasureText(in Font font, string text, TextAlign textAlign = TextAlign.Left, TextBaseline textBaseline = TextBaseline.Alphabetic)
public TextMetrics MeasureText(in Core.Canvas.Font font, string text, TextAlign textAlign = TextAlign.Left, TextBaseline textBaseline = TextBaseline.Alphabetic);
readonly struct FontFace
public readonly struct FontFace
{
public static readonly IEqualityComparer<FontFace> Comparer;
public string Family { get; }
public FontWeight Weight { get; }
public FontStyle Style { get; }
public FontStretch Stretch { get; }
public FontFace(string family, FontWeight weight, FontStyle style, FontStretch stretch);
}
FontFace.FontFace(string family, FontWeight weight, FontStyle style, FontStretch stretch)
public FontFace(string family, FontWeight weight, FontStyle style, FontStretch stretch);
IEqualityComparer<FontFace> FontFace.Comparer
public static readonly IEqualityComparer<FontFace> Comparer;
A struct comparer for Xui.Runtime.Software.Font.FontFace that avoids boxing and uses case-insensitive family comparison.
string FontFace.Family
public string Family { get; }
FontStretch FontFace.Stretch
public FontStretch Stretch { get; }
FontStyle FontFace.Style
public FontStyle Style { get; }
FontWeight FontFace.Weight
public FontWeight Weight { get; }
class FontUsage
The characters and adjacent character pairs rendered with one font face.
This deliberately records source characters rather than only glyph IDs. A compact font needs a cmap for the SVG text, while pairs allow the subsetter to retain the kerning actually used. Complex OpenType shaping is outside the first subset format and will add richer usage records.
public sealed class FontUsage
{
public IReadOnlySet<Rune> Characters { get; }
public IReadOnlySet<RunePair> Pairs { get; }
public void Add(string text);
public readonly record struct RunePair(Rune Left, Rune Right);
}
void FontUsage.Add(string text)
public void Add(string text);
IReadOnlySet<Rune> FontUsage.Characters
public IReadOnlySet<Rune> Characters { get; }
IReadOnlySet<RunePair> FontUsage.Pairs
public IReadOnlySet<RunePair> Pairs { get; }
readonly record struct FontUsage.RunePair
public readonly record struct RunePair(Rune Left, Rune Right);
RunePair.RunePair(Rune Left, Rune Right)
public RunePair(Rune Left, Rune Right);
Rune RunePair.Left
public Rune Left { get; init; }
Rune RunePair.Right
public Rune Right { get; init; }
class GPosTable
Parses the 'GPOS' (Glyph Positioning) table from an OpenType font. This table handles kerning, mark positioning, and other glyph adjustments.
public sealed partial class GPosTable
{
public abstract partial class ClassDefTable
{
public sealed class Format1 : ClassDefTable
{
public Format1(ReadOnlySpan<byte> span);
public override ushort this[ushort glyphId] { get; }
}
}
}
public sealed partial class GPosTable
{
public abstract partial class ClassDefTable
{
public sealed class Format2 : ClassDefTable
{
public Format2(ReadOnlySpan<byte> span);
public override ushort this[ushort glyphId] { get; }
}
}
}
public sealed partial class GPosTable
{
public abstract partial class ClassDefTable
{
public static ClassDefTable Parse(ReadOnlySpan<byte> span);
public abstract ushort this[ushort glyphId] { get; }
}
}
public sealed partial class GPosTable
{
public abstract partial class CoverageTable : IReadOnlyDictionary<ushort, int>
{
public sealed class Format1 : CoverageTable
{
public Format1(ReadOnlySpan<byte> span);
public override int Count { get; }
public override IEnumerable<ushort> Keys { get; }
public override IEnumerable<int> Values { get; }
public override bool ContainsKey(ushort key);
public override bool TryGetValue(ushort key, out int value);
public override int this[ushort key] { get; }
public override IEnumerator<KeyValuePair<ushort, int>> GetEnumerator();
}
}
}
public sealed partial class GPosTable
{
public abstract partial class CoverageTable : IReadOnlyDictionary<ushort, int>
{
public sealed class Format2 : CoverageTable
{
public Format2(ReadOnlySpan<byte> span);
public override int Count { get; }
public override IEnumerable<ushort> Keys { get; }
public override IEnumerable<int> Values { get; }
public override bool ContainsKey(ushort key);
public override bool TryGetValue(ushort key, out int value);
public override int this[ushort key] { get; }
public override IEnumerator<KeyValuePair<ushort, int>> GetEnumerator();
}
}
}
public sealed partial class GPosTable
{
public abstract partial class CoverageTable : IReadOnlyDictionary<ushort, int>
{
public static CoverageTable Parse(ReadOnlySpan<byte> span);
public abstract int Count { get; }
public abstract IEnumerable<ushort> Keys { get; }
public abstract IEnumerable<int> Values { get; }
public abstract bool ContainsKey(ushort key);
public abstract bool TryGetValue(ushort key, out int value);
public abstract int this[ushort key] { get; }
public abstract IEnumerator<KeyValuePair<ushort, int>> GetEnumerator();
}
}
public sealed partial class GPosTable
{
public sealed class ExtensionPositioningSubtable
{
public GPosLookupType ExtensionLookupType { get; }
public PairAdjustmentSubtable? WrappedPairSubtable { get; }
public ExtensionPositioningSubtable(ReadOnlySpan<byte> span);
public TrueTypeFont.ValueRecordTuple this[ushort leftGlyph, ushort rightGlyph] { get; }
}
}
public sealed partial class GPosTable
{
public sealed class FeatureListTable : IReadOnlyDictionary<string, FeatureTable>
{
public FeatureListTable(ReadOnlySpan<byte> span);
public FeatureTable this[string key] { get; }
public IEnumerable<string> Keys { get; }
public IEnumerable<FeatureTable> Values { get; }
public int Count { get; }
public bool ContainsKey(string key);
public bool TryGetValue(string key, out FeatureTable value);
public IEnumerator<KeyValuePair<string, FeatureTable>> GetEnumerator();
}
public sealed class FeatureTable
{
public List<ushort> LookupIndices { get; }
public FeatureTable(ReadOnlySpan<byte> span);
}
}
public sealed partial class GPosTable
{
public sealed class LookupListTable : IReadOnlyList<LookupTable>
{
public LookupListTable(ReadOnlySpan<byte> span);
public LookupTable this[int index] { get; }
public int Count { get; }
public IEnumerator<LookupTable> GetEnumerator();
}
public sealed class LookupTable
{
public GPosLookupType LookupType { get; }
public ushort LookupFlag { get; }
public List<ushort> SubTableOffsets { get; }
public List<PairAdjustmentSubtable>? PairAdjustmentSubtables { get; }
public List<ExtensionPositioningSubtable>? ExtensionPositioningSubtables { get; }
public LookupTable(ReadOnlySpan<byte> span);
public TrueTypeFont.ValueRecordTuple this[ushort leftGlyph, ushort rightGlyph] { get; }
public enum GPosLookupType : ushort
{
SingleAdjustment = 1,
PairAdjustment = 2,
CursiveAttachment = 3,
MarkToBase = 4,
MarkToLigature = 5,
MarkToMark = 6,
ContextPositioning = 7,
ChainedContextPositioning = 8,
ExtensionPositioning = 9
}
}
}
public sealed partial class GPosTable
{
public abstract partial class PairAdjustmentSubtable
{
public class Format1 : PairAdjustmentSubtable
{
public ushort ValueFormat1 { get; }
public ushort ValueFormat2 { get; }
public List<PairSet> PairSets { get; }
public CoverageTable Coverage { get; }
public Format1(ReadOnlySpan<byte> span);
public sealed record PairSet(List<PairValueRecord> Pairs);
public sealed record PairValueRecord(ushort SecondGlyphID, TrueTypeFont.ValueRecord Value1, TrueTypeFont.ValueRecord Value2);
public override TrueTypeFont.ValueRecordTuple this[ushort leftGlyph, ushort rightGlyph] { get; }
}
}
}
public sealed partial class GPosTable
{
public abstract partial class PairAdjustmentSubtable
{
public sealed class Format2 : PairAdjustmentSubtable
{
public ushort ValueFormat1 { get; }
public ushort ValueFormat2 { get; }
public ClassDefTable ClassDef1 { get; }
public ClassDefTable ClassDef2 { get; }
public PairValueRecord[, ] Matrix { get; }
public CoverageTable Coverage { get; }
public ushort Class1Count { get; }
public ushort Class2Count { get; }
public Format2(ReadOnlySpan<byte> span);
public sealed record PairValueRecord(TrueTypeFont.ValueRecord Value1, TrueTypeFont.ValueRecord Value2);
public override TrueTypeFont.ValueRecordTuple this[ushort leftGlyph, ushort rightGlyph] { get; }
}
}
}
public sealed partial class GPosTable
{
public abstract partial class PairAdjustmentSubtable
{
public static PairAdjustmentSubtable Parse(ReadOnlySpan<byte> span);
public abstract TrueTypeFont.ValueRecordTuple this[ushort leftGlyph, ushort rightGlyph] { get; }
}
}
public sealed partial class GPosTable
{
public sealed class ScriptListTable : IReadOnlyDictionary<string, ScriptTable>
{
public ScriptListTable(ReadOnlySpan<byte> span);
public ScriptTable this[string key] { get; }
public IEnumerable<string> Keys { get; }
public IEnumerable<ScriptTable> Values { get; }
public int Count { get; }
public bool ContainsKey(string key);
public bool TryGetValue(string key, out ScriptTable value);
public IEnumerator<KeyValuePair<string, ScriptTable>> GetEnumerator();
}
public sealed class ScriptTable : IReadOnlyDictionary<string, LangSysTable>
{
public ScriptTable(ReadOnlySpan<byte> span);
public LangSysTable this[string key] { get; }
public IEnumerable<string> Keys { get; }
public IEnumerable<LangSysTable> Values { get; }
public int Count { get; }
public bool ContainsKey(string key);
public bool TryGetValue(string key, out LangSysTable value);
public IEnumerator<KeyValuePair<string, LangSysTable>> GetEnumerator();
}
public sealed class LangSysTable
{
public ushort RequiredFeatureIndex { get; }
public List<ushort> FeatureIndices { get; }
public LangSysTable(ReadOnlySpan<byte> span);
}
}
public sealed partial class GPosTable
{
public ushort MajorVersion { get; }
public ushort MinorVersion { get; }
public ushort ScriptListOffset { get; }
public ushort FeatureListOffset { get; }
public ushort LookupListOffset { get; }
public uint? FeatureVariationsOffset { get; }
public ScriptListTable? ScriptList { get; }
public FeatureListTable? FeatureList { get; }
public LookupListTable? LookupList { get; }
public CMapTable CMap { get; }
public GPosTable(ReadOnlySpan<byte> span, CMapTable cMap);
public TrueTypeFont.ValueRecord this[Rune left, Rune right] { get; }
}
GPosTable.GPosTable(ReadOnlySpan<byte> span, CMapTable cMap)
public GPosTable(ReadOnlySpan<byte> span, CMapTable cMap);
CMapTable GPosTable.CMap
public CMapTable CMap { get; }
FeatureListTable? GPosTable.FeatureList
public FeatureListTable? FeatureList { get; }
ushort GPosTable.FeatureListOffset
public ushort FeatureListOffset { get; }
uint? GPosTable.FeatureVariationsOffset
public uint? FeatureVariationsOffset { get; }
ValueRecord GPosTable.this[Rune left, Rune right]
public TrueTypeFont.ValueRecord this[Rune left, Rune right] { get; }
Gets the kerning adjustment between two characters using GPOS LookupType 2 or ExtensionPositioning. Returns a default ValueRecord if no adjustment is defined.
LookupListTable? GPosTable.LookupList
public LookupListTable? LookupList { get; }
ushort GPosTable.LookupListOffset
public ushort LookupListOffset { get; }
ushort GPosTable.MajorVersion
public ushort MajorVersion { get; }
ushort GPosTable.MinorVersion
public ushort MinorVersion { get; }
ScriptListTable? GPosTable.ScriptList
public ScriptListTable? ScriptList { get; }
ushort GPosTable.ScriptListOffset
public ushort ScriptListOffset { get; }
class GPosTable.ClassDefTable
public abstract partial class ClassDefTable
{
public sealed class Format1 : ClassDefTable
{
public Format1(ReadOnlySpan<byte> span);
public override ushort this[ushort glyphId] { get; }
}
}
public abstract partial class ClassDefTable
{
public sealed class Format2 : ClassDefTable
{
public Format2(ReadOnlySpan<byte> span);
public override ushort this[ushort glyphId] { get; }
}
}
public abstract partial class ClassDefTable
{
public static ClassDefTable Parse(ReadOnlySpan<byte> span);
public abstract ushort this[ushort glyphId] { get; }
}
ushort ClassDefTable.this[ushort glyphId]
public abstract ushort this[ushort glyphId] { get; }
ClassDefTable ClassDefTable.Parse(ReadOnlySpan<byte> span)
public static ClassDefTable Parse(ReadOnlySpan<byte> span);
Parses a ClassDefTable (Format 1 or 2).
class GPosTable.ClassDefTable.Format1
public sealed class Format1 : ClassDefTable
{
public Format1(ReadOnlySpan<byte> span);
public override ushort this[ushort glyphId] { get; }
}
Format1.Format1(ReadOnlySpan<byte> span)
public Format1(ReadOnlySpan<byte> span);
ushort Format1.this[ushort glyphId]
public override ushort this[ushort glyphId] { get; }
Returns the class ID for the given glyph ID. If the glyph is not in the defined range, returns 0 (default class).
class GPosTable.ClassDefTable.Format2
public sealed class Format2 : ClassDefTable
{
public Format2(ReadOnlySpan<byte> span);
public override ushort this[ushort glyphId] { get; }
}
Format2.Format2(ReadOnlySpan<byte> span)
public Format2(ReadOnlySpan<byte> span);
ushort Format2.this[ushort glyphId]
public override ushort this[ushort glyphId] { get; }
class GPosTable.CoverageTable
Represents a GPOS Coverage Table used in subtables to identify glyphs affected.
Represents a GPOS Coverage Table used in subtables to identify glyphs affected.
public abstract partial class CoverageTable : IReadOnlyDictionary<ushort, int>
{
public sealed class Format1 : CoverageTable
{
public Format1(ReadOnlySpan<byte> span);
public override int Count { get; }
public override IEnumerable<ushort> Keys { get; }
public override IEnumerable<int> Values { get; }
public override bool ContainsKey(ushort key);
public override bool TryGetValue(ushort key, out int value);
public override int this[ushort key] { get; }
public override IEnumerator<KeyValuePair<ushort, int>> GetEnumerator();
}
}
public abstract partial class CoverageTable : IReadOnlyDictionary<ushort, int>
{
public sealed class Format2 : CoverageTable
{
public Format2(ReadOnlySpan<byte> span);
public override int Count { get; }
public override IEnumerable<ushort> Keys { get; }
public override IEnumerable<int> Values { get; }
public override bool ContainsKey(ushort key);
public override bool TryGetValue(ushort key, out int value);
public override int this[ushort key] { get; }
public override IEnumerator<KeyValuePair<ushort, int>> GetEnumerator();
}
}
public abstract partial class CoverageTable : IReadOnlyDictionary<ushort, int>
{
public static CoverageTable Parse(ReadOnlySpan<byte> span);
public abstract int Count { get; }
public abstract IEnumerable<ushort> Keys { get; }
public abstract IEnumerable<int> Values { get; }
public abstract bool ContainsKey(ushort key);
public abstract bool TryGetValue(ushort key, out int value);
public abstract int this[ushort key] { get; }
public abstract IEnumerator<KeyValuePair<ushort, int>> GetEnumerator();
}
bool CoverageTable.ContainsKey(ushort key)
public abstract bool ContainsKey(ushort key);
int CoverageTable.Count
public abstract int Count { get; }
IEnumerator<KeyValuePair<ushort, int>> CoverageTable.GetEnumerator()
public abstract IEnumerator<KeyValuePair<ushort, int>> GetEnumerator();
int CoverageTable.this[ushort key]
public abstract int this[ushort key] { get; }
IEnumerable<ushort> CoverageTable.Keys
public abstract IEnumerable<ushort> Keys { get; }
CoverageTable CoverageTable.Parse(ReadOnlySpan<byte> span)
public static CoverageTable Parse(ReadOnlySpan<byte> span);
bool CoverageTable.TryGetValue(ushort key, out int value)
public abstract bool TryGetValue(ushort key, out int value);
IEnumerable<int> CoverageTable.Values
public abstract IEnumerable<int> Values { get; }
class GPosTable.CoverageTable.Format1
public sealed class Format1 : CoverageTable
{
public Format1(ReadOnlySpan<byte> span);
public override int Count { get; }
public override IEnumerable<ushort> Keys { get; }
public override IEnumerable<int> Values { get; }
public override bool ContainsKey(ushort key);
public override bool TryGetValue(ushort key, out int value);
public override int this[ushort key] { get; }
public override IEnumerator<KeyValuePair<ushort, int>> GetEnumerator();
}
Format1.Format1(ReadOnlySpan<byte> span)
public Format1(ReadOnlySpan<byte> span);
bool Format1.ContainsKey(ushort key)
public override bool ContainsKey(ushort key);
int Format1.Count
public override int Count { get; }
IEnumerator<KeyValuePair<ushort, int>> Format1.GetEnumerator()
public override IEnumerator<KeyValuePair<ushort, int>> GetEnumerator();
int Format1.this[ushort key]
public override int this[ushort key] { get; }
IEnumerable<ushort> Format1.Keys
public override IEnumerable<ushort> Keys { get; }
bool Format1.TryGetValue(ushort key, out int value)
public override bool TryGetValue(ushort key, out int value);
IEnumerable<int> Format1.Values
public override IEnumerable<int> Values { get; }
class GPosTable.CoverageTable.Format2
public sealed class Format2 : CoverageTable
{
public Format2(ReadOnlySpan<byte> span);
public override int Count { get; }
public override IEnumerable<ushort> Keys { get; }
public override IEnumerable<int> Values { get; }
public override bool ContainsKey(ushort key);
public override bool TryGetValue(ushort key, out int value);
public override int this[ushort key] { get; }
public override IEnumerator<KeyValuePair<ushort, int>> GetEnumerator();
}
Format2.Format2(ReadOnlySpan<byte> span)
public Format2(ReadOnlySpan<byte> span);
bool Format2.ContainsKey(ushort key)
public override bool ContainsKey(ushort key);
int Format2.Count
public override int Count { get; }
IEnumerator<KeyValuePair<ushort, int>> Format2.GetEnumerator()
public override IEnumerator<KeyValuePair<ushort, int>> GetEnumerator();
int Format2.this[ushort key]
public override int this[ushort key] { get; }
IEnumerable<ushort> Format2.Keys
public override IEnumerable<ushort> Keys { get; }
bool Format2.TryGetValue(ushort key, out int value)
public override bool TryGetValue(ushort key, out int value);
IEnumerable<int> Format2.Values
public override IEnumerable<int> Values { get; }
class GPosTable.ExtensionPositioningSubtable
public sealed class ExtensionPositioningSubtable
{
public GPosLookupType ExtensionLookupType { get; }
public PairAdjustmentSubtable? WrappedPairSubtable { get; }
public ExtensionPositioningSubtable(ReadOnlySpan<byte> span);
public TrueTypeFont.ValueRecordTuple this[ushort leftGlyph, ushort rightGlyph] { get; }
}
ExtensionPositioningSubtable.ExtensionPositioningSubtable(ReadOnlySpan<byte> span)
public ExtensionPositioningSubtable(ReadOnlySpan<byte> span);
GPosLookupType ExtensionPositioningSubtable.ExtensionLookupType
public GPosLookupType ExtensionLookupType { get; }
ValueRecordTuple ExtensionPositioningSubtable.this[ushort leftGlyph, ushort rightGlyph]
public TrueTypeFont.ValueRecordTuple this[ushort leftGlyph, ushort rightGlyph] { get; }
PairAdjustmentSubtable? ExtensionPositioningSubtable.WrappedPairSubtable
public PairAdjustmentSubtable? WrappedPairSubtable { get; }
class GPosTable.FeatureListTable
public sealed class FeatureListTable : IReadOnlyDictionary<string, FeatureTable>
{
public FeatureListTable(ReadOnlySpan<byte> span);
public FeatureTable this[string key] { get; }
public IEnumerable<string> Keys { get; }
public IEnumerable<FeatureTable> Values { get; }
public int Count { get; }
public bool ContainsKey(string key);
public bool TryGetValue(string key, out FeatureTable value);
public IEnumerator<KeyValuePair<string, FeatureTable>> GetEnumerator();
}
FeatureListTable.FeatureListTable(ReadOnlySpan<byte> span)
public FeatureListTable(ReadOnlySpan<byte> span);
bool FeatureListTable.ContainsKey(string key)
public bool ContainsKey(string key);
int FeatureListTable.Count
public int Count { get; }
IEnumerator<KeyValuePair<string, FeatureTable>> FeatureListTable.GetEnumerator()
public IEnumerator<KeyValuePair<string, FeatureTable>> GetEnumerator();
FeatureTable FeatureListTable.this[string key]
public FeatureTable this[string key] { get; }
IEnumerable<string> FeatureListTable.Keys
public IEnumerable<string> Keys { get; }
bool FeatureListTable.TryGetValue(string key, out FeatureTable value)
public bool TryGetValue(string key, out FeatureTable value);
IEnumerable<FeatureTable> FeatureListTable.Values
public IEnumerable<FeatureTable> Values { get; }
class GPosTable.FeatureTable
public sealed class FeatureTable
{
public List<ushort> LookupIndices { get; }
public FeatureTable(ReadOnlySpan<byte> span);
}
FeatureTable.FeatureTable(ReadOnlySpan<byte> span)
public FeatureTable(ReadOnlySpan<byte> span);
List<ushort> FeatureTable.LookupIndices
public List<ushort> LookupIndices { get; }
class GPosTable.LangSysTable
public sealed class LangSysTable
{
public ushort RequiredFeatureIndex { get; }
public List<ushort> FeatureIndices { get; }
public LangSysTable(ReadOnlySpan<byte> span);
}
LangSysTable.LangSysTable(ReadOnlySpan<byte> span)
public LangSysTable(ReadOnlySpan<byte> span);
List<ushort> LangSysTable.FeatureIndices
public List<ushort> FeatureIndices { get; }
ushort LangSysTable.RequiredFeatureIndex
public ushort RequiredFeatureIndex { get; }
class GPosTable.LookupListTable
public sealed class LookupListTable : IReadOnlyList<LookupTable>
{
public LookupListTable(ReadOnlySpan<byte> span);
public LookupTable this[int index] { get; }
public int Count { get; }
public IEnumerator<LookupTable> GetEnumerator();
}
LookupListTable.LookupListTable(ReadOnlySpan<byte> span)
public LookupListTable(ReadOnlySpan<byte> span);
int LookupListTable.Count
public int Count { get; }
IEnumerator<LookupTable> LookupListTable.GetEnumerator()
public IEnumerator<LookupTable> GetEnumerator();
LookupTable LookupListTable.this[int index]
public LookupTable this[int index] { get; }
class GPosTable.LookupTable
public sealed class LookupTable
{
public GPosLookupType LookupType { get; }
public ushort LookupFlag { get; }
public List<ushort> SubTableOffsets { get; }
public List<PairAdjustmentSubtable>? PairAdjustmentSubtables { get; }
public List<ExtensionPositioningSubtable>? ExtensionPositioningSubtables { get; }
public LookupTable(ReadOnlySpan<byte> span);
public TrueTypeFont.ValueRecordTuple this[ushort leftGlyph, ushort rightGlyph] { get; }
public enum GPosLookupType : ushort
{
SingleAdjustment = 1,
PairAdjustment = 2,
CursiveAttachment = 3,
MarkToBase = 4,
MarkToLigature = 5,
MarkToMark = 6,
ContextPositioning = 7,
ChainedContextPositioning = 8,
ExtensionPositioning = 9
}
}
LookupTable.LookupTable(ReadOnlySpan<byte> span)
public LookupTable(ReadOnlySpan<byte> span);
List<ExtensionPositioningSubtable>? LookupTable.ExtensionPositioningSubtables
public List<ExtensionPositioningSubtable>? ExtensionPositioningSubtables { get; }
ValueRecordTuple LookupTable.this[ushort leftGlyph, ushort rightGlyph]
public TrueTypeFont.ValueRecordTuple this[ushort leftGlyph, ushort rightGlyph] { get; }
ushort LookupTable.LookupFlag
public ushort LookupFlag { get; }
GPosLookupType LookupTable.LookupType
public GPosLookupType LookupType { get; }
List<PairAdjustmentSubtable>? LookupTable.PairAdjustmentSubtables
public List<PairAdjustmentSubtable>? PairAdjustmentSubtables { get; }
List<ushort> LookupTable.SubTableOffsets
public List<ushort> SubTableOffsets { get; }
enum GPosTable.LookupTable.GPosLookupType
public enum GPosLookupType : ushort
{
SingleAdjustment = 1,
PairAdjustment = 2,
CursiveAttachment = 3,
MarkToBase = 4,
MarkToLigature = 5,
MarkToMark = 6,
ContextPositioning = 7,
ChainedContextPositioning = 8,
ExtensionPositioning = 9
}
GPosLookupType.ChainedContextPositioning
ChainedContextPositioning = 8
GPosLookupType.ContextPositioning
ContextPositioning = 7
GPosLookupType.CursiveAttachment
CursiveAttachment = 3
GPosLookupType.ExtensionPositioning
ExtensionPositioning = 9
GPosLookupType.MarkToBase
MarkToBase = 4
GPosLookupType.MarkToLigature
MarkToLigature = 5
GPosLookupType.MarkToMark
MarkToMark = 6
GPosLookupType.PairAdjustment
PairAdjustment = 2
GPosLookupType.SingleAdjustment
SingleAdjustment = 1
class GPosTable.PairAdjustmentSubtable
public abstract partial class PairAdjustmentSubtable
{
public class Format1 : PairAdjustmentSubtable
{
public ushort ValueFormat1 { get; }
public ushort ValueFormat2 { get; }
public List<PairSet> PairSets { get; }
public CoverageTable Coverage { get; }
public Format1(ReadOnlySpan<byte> span);
public sealed record PairSet(List<PairValueRecord> Pairs);
public sealed record PairValueRecord(ushort SecondGlyphID, TrueTypeFont.ValueRecord Value1, TrueTypeFont.ValueRecord Value2);
public override TrueTypeFont.ValueRecordTuple this[ushort leftGlyph, ushort rightGlyph] { get; }
}
}
public abstract partial class PairAdjustmentSubtable
{
public sealed class Format2 : PairAdjustmentSubtable
{
public ushort ValueFormat1 { get; }
public ushort ValueFormat2 { get; }
public ClassDefTable ClassDef1 { get; }
public ClassDefTable ClassDef2 { get; }
public PairValueRecord[, ] Matrix { get; }
public CoverageTable Coverage { get; }
public ushort Class1Count { get; }
public ushort Class2Count { get; }
public Format2(ReadOnlySpan<byte> span);
public sealed record PairValueRecord(TrueTypeFont.ValueRecord Value1, TrueTypeFont.ValueRecord Value2);
public override TrueTypeFont.ValueRecordTuple this[ushort leftGlyph, ushort rightGlyph] { get; }
}
}
public abstract partial class PairAdjustmentSubtable
{
public static PairAdjustmentSubtable Parse(ReadOnlySpan<byte> span);
public abstract TrueTypeFont.ValueRecordTuple this[ushort leftGlyph, ushort rightGlyph] { get; }
}
ValueRecordTuple PairAdjustmentSubtable.this[ushort leftGlyph, ushort rightGlyph]
public abstract TrueTypeFont.ValueRecordTuple this[ushort leftGlyph, ushort rightGlyph] { get; }
PairAdjustmentSubtable PairAdjustmentSubtable.Parse(ReadOnlySpan<byte> span)
public static PairAdjustmentSubtable Parse(ReadOnlySpan<byte> span);
class GPosTable.PairAdjustmentSubtable.Format1
public class Format1 : PairAdjustmentSubtable
{
public ushort ValueFormat1 { get; }
public ushort ValueFormat2 { get; }
public List<PairSet> PairSets { get; }
public CoverageTable Coverage { get; }
public Format1(ReadOnlySpan<byte> span);
public sealed record PairSet(List<PairValueRecord> Pairs);
public sealed record PairValueRecord(ushort SecondGlyphID, TrueTypeFont.ValueRecord Value1, TrueTypeFont.ValueRecord Value2);
public override TrueTypeFont.ValueRecordTuple this[ushort leftGlyph, ushort rightGlyph] { get; }
}
Format1.Format1(ReadOnlySpan<byte> span)
public Format1(ReadOnlySpan<byte> span);
CoverageTable Format1.Coverage
public CoverageTable Coverage { get; }
ValueRecordTuple Format1.this[ushort leftGlyph, ushort rightGlyph]
public override TrueTypeFont.ValueRecordTuple this[ushort leftGlyph, ushort rightGlyph] { get; }
List<PairSet> Format1.PairSets
public List<PairSet> PairSets { get; }
ushort Format1.ValueFormat1
public ushort ValueFormat1 { get; }
ushort Format1.ValueFormat2
public ushort ValueFormat2 { get; }
record class GPosTable.PairAdjustmentSubtable.Format1.PairSet
public sealed record PairSet(List<PairValueRecord> Pairs);
PairSet.PairSet(List<PairValueRecord> Pairs)
public PairSet(List<PairValueRecord> Pairs);
List<PairValueRecord> PairSet.Pairs
public List<PairValueRecord> Pairs { get; init; }
record class GPosTable.PairAdjustmentSubtable.Format1.PairValueRecord
public sealed record PairValueRecord(ushort SecondGlyphID, TrueTypeFont.ValueRecord Value1, TrueTypeFont.ValueRecord Value2);
PairValueRecord.PairValueRecord(ushort SecondGlyphID, ValueRecord Value1, ValueRecord Value2)
public PairValueRecord(ushort SecondGlyphID, TrueTypeFont.ValueRecord Value1, TrueTypeFont.ValueRecord Value2);
ushort PairValueRecord.SecondGlyphID
public ushort SecondGlyphID { get; init; }
ValueRecord PairValueRecord.Value1
public TrueTypeFont.ValueRecord Value1 { get; init; }
ValueRecord PairValueRecord.Value2
public TrueTypeFont.ValueRecord Value2 { get; init; }
class GPosTable.PairAdjustmentSubtable.Format2
Represents a GPOS LookupType 2 subtable: Pair Adjustment Format 2 (class-based kerning).
public sealed class Format2 : PairAdjustmentSubtable
{
public ushort ValueFormat1 { get; }
public ushort ValueFormat2 { get; }
public ClassDefTable ClassDef1 { get; }
public ClassDefTable ClassDef2 { get; }
public PairValueRecord[, ] Matrix { get; }
public CoverageTable Coverage { get; }
public ushort Class1Count { get; }
public ushort Class2Count { get; }
public Format2(ReadOnlySpan<byte> span);
public sealed record PairValueRecord(TrueTypeFont.ValueRecord Value1, TrueTypeFont.ValueRecord Value2);
public override TrueTypeFont.ValueRecordTuple this[ushort leftGlyph, ushort rightGlyph] { get; }
}
Format2.Format2(ReadOnlySpan<byte> span)
public Format2(ReadOnlySpan<byte> span);
ushort Format2.Class1Count
public ushort Class1Count { get; }
ushort Format2.Class2Count
public ushort Class2Count { get; }
ClassDefTable Format2.ClassDef1
public ClassDefTable ClassDef1 { get; }
ClassDefTable Format2.ClassDef2
public ClassDefTable ClassDef2 { get; }
CoverageTable Format2.Coverage
public CoverageTable Coverage { get; }
ValueRecordTuple Format2.this[ushort leftGlyph, ushort rightGlyph]
public override TrueTypeFont.ValueRecordTuple this[ushort leftGlyph, ushort rightGlyph] { get; }
PairValueRecord[,] Format2.Matrix
public PairValueRecord[, ] Matrix { get; }
ushort Format2.ValueFormat1
public ushort ValueFormat1 { get; }
ushort Format2.ValueFormat2
public ushort ValueFormat2 { get; }
record class GPosTable.PairAdjustmentSubtable.Format2.PairValueRecord
public sealed record PairValueRecord(TrueTypeFont.ValueRecord Value1, TrueTypeFont.ValueRecord Value2);
PairValueRecord.PairValueRecord(ValueRecord Value1, ValueRecord Value2)
public PairValueRecord(TrueTypeFont.ValueRecord Value1, TrueTypeFont.ValueRecord Value2);
ValueRecord PairValueRecord.Value1
public TrueTypeFont.ValueRecord Value1 { get; init; }
ValueRecord PairValueRecord.Value2
public TrueTypeFont.ValueRecord Value2 { get; init; }
class GPosTable.ScriptListTable
public sealed class ScriptListTable : IReadOnlyDictionary<string, ScriptTable>
{
public ScriptListTable(ReadOnlySpan<byte> span);
public ScriptTable this[string key] { get; }
public IEnumerable<string> Keys { get; }
public IEnumerable<ScriptTable> Values { get; }
public int Count { get; }
public bool ContainsKey(string key);
public bool TryGetValue(string key, out ScriptTable value);
public IEnumerator<KeyValuePair<string, ScriptTable>> GetEnumerator();
}
ScriptListTable.ScriptListTable(ReadOnlySpan<byte> span)
public ScriptListTable(ReadOnlySpan<byte> span);
bool ScriptListTable.ContainsKey(string key)
public bool ContainsKey(string key);
int ScriptListTable.Count
public int Count { get; }
IEnumerator<KeyValuePair<string, ScriptTable>> ScriptListTable.GetEnumerator()
public IEnumerator<KeyValuePair<string, ScriptTable>> GetEnumerator();
ScriptTable ScriptListTable.this[string key]
public ScriptTable this[string key] { get; }
IEnumerable<string> ScriptListTable.Keys
public IEnumerable<string> Keys { get; }
bool ScriptListTable.TryGetValue(string key, out ScriptTable value)
public bool TryGetValue(string key, out ScriptTable value);
IEnumerable<ScriptTable> ScriptListTable.Values
public IEnumerable<ScriptTable> Values { get; }
class GPosTable.ScriptTable
public sealed class ScriptTable : IReadOnlyDictionary<string, LangSysTable>
{
public ScriptTable(ReadOnlySpan<byte> span);
public LangSysTable this[string key] { get; }
public IEnumerable<string> Keys { get; }
public IEnumerable<LangSysTable> Values { get; }
public int Count { get; }
public bool ContainsKey(string key);
public bool TryGetValue(string key, out LangSysTable value);
public IEnumerator<KeyValuePair<string, LangSysTable>> GetEnumerator();
}
ScriptTable.ScriptTable(ReadOnlySpan<byte> span)
public ScriptTable(ReadOnlySpan<byte> span);
bool ScriptTable.ContainsKey(string key)
public bool ContainsKey(string key);
int ScriptTable.Count
public int Count { get; }
IEnumerator<KeyValuePair<string, LangSysTable>> ScriptTable.GetEnumerator()
public IEnumerator<KeyValuePair<string, LangSysTable>> GetEnumerator();
LangSysTable ScriptTable.this[string key]
public LangSysTable this[string key] { get; }
IEnumerable<string> ScriptTable.Keys
public IEnumerable<string> Keys { get; }
bool ScriptTable.TryGetValue(string key, out LangSysTable value)
public bool TryGetValue(string key, out LangSysTable value);
IEnumerable<LangSysTable> ScriptTable.Values
public IEnumerable<LangSysTable> Values { get; }
class GlyfTable
public class GlyfTable
{
public GlyfTable(ReadOnlyMemory<byte> data, LocaTable loca);
public bool TryGetGlyph(int glyphIndex, out GlyphShape shape);
public void ExpandCompositeDependencies(SortedSet<int> glyphs);
public Subset CreateSubset(IReadOnlyList<int> glyphs, IReadOnlyDictionary<int, ushort> glyphMap);
public readonly record struct Subset(byte[] Glyf, byte[] Loca);
}
GlyfTable.GlyfTable(ReadOnlyMemory<byte> data, LocaTable loca)
public GlyfTable(ReadOnlyMemory<byte> data, LocaTable loca);
Subset GlyfTable.CreateSubset(IReadOnlyList<int> glyphs, IReadOnlyDictionary<int, ushort> glyphMap)
public Subset CreateSubset(IReadOnlyList<int> glyphs, IReadOnlyDictionary<int, ushort> glyphMap);
Creates compact glyf and long-format loca tables for retained glyphs.
void GlyfTable.ExpandCompositeDependencies(SortedSet<int> glyphs)
public void ExpandCompositeDependencies(SortedSet<int> glyphs);
Adds every component needed by retained composite glyphs.
bool GlyfTable.TryGetGlyph(int glyphIndex, out GlyphShape shape)
public bool TryGetGlyph(int glyphIndex, out GlyphShape shape);
Returns a glyph shape by slicing the raw memory using loca table offsets.
readonly record struct GlyfTable.Subset
public readonly record struct Subset(byte[] Glyf, byte[] Loca);
Subset.Subset(byte[] Glyf, byte[] Loca)
public Subset(byte[] Glyf, byte[] Loca);
byte[] Subset.Glyf
public byte[] Glyf { get; init; }
byte[] Subset.Loca
public byte[] Loca { get; init; }
readonly record struct GlyphPosition
public readonly record struct GlyphPosition(int GlyphId, float X, float Y);
GlyphPosition.GlyphPosition(int GlyphId, float X, float Y)
public GlyphPosition(int GlyphId, float X, float Y);
int GlyphPosition.GlyphId
public int GlyphId { get; init; }
float GlyphPosition.X
public float X { get; init; }
float GlyphPosition.Y
public float Y { get; init; }
ref struct GlyphShape
A parsed TrueType glyph. This is a lightweight, stack-only view into raw glyph data.
public ref struct GlyphShape
{
public GlyphBound Bounds { get; }
public GlyphShape(ReadOnlySpan<byte> data);
public void Visit(IGlyphPathBuilder builder);
public struct GlyphBound
{
public short XMin;
public short YMin;
public short XMax;
public short YMax;
public GlyphBound(short xMin, short yMin, short xMax, short yMax);
}
}
GlyphShape.GlyphShape(ReadOnlySpan<byte> data)
public GlyphShape(ReadOnlySpan<byte> data);
GlyphBound GlyphShape.Bounds
public GlyphBound Bounds { get; }
Gets the unscaled bounding box of the glyph in font units.
void GlyphShape.Visit(IGlyphPathBuilder builder)
public void Visit(IGlyphPathBuilder builder);
struct GlyphShape.GlyphBound
public struct GlyphBound
{
public short XMin;
public short YMin;
public short XMax;
public short YMax;
public GlyphBound(short xMin, short yMin, short xMax, short yMax);
}
GlyphBound.GlyphBound(short xMin, short yMin, short xMax, short yMax)
public GlyphBound(short xMin, short yMin, short xMax, short yMax);
short GlyphBound.XMax
public short XMax;
short GlyphBound.XMin
public short XMin;
short GlyphBound.YMax
public short YMax;
short GlyphBound.YMin
public short YMin;
class HeaderTable
public class HeaderTable
{
public ushort FontRevisionMajor { get; }
public ushort FontRevisionMinor { get; }
public ushort UnitsPerEm { get; }
public DateTime Created { get; }
public DateTime Modified { get; }
public short XMin { get; }
public short YMin { get; }
public short XMax { get; }
public short YMax { get; }
public ushort MacStyle { get; }
public ushort LowestRecPPEM { get; }
public ushort IndexToLocFormat { get; }
public bool IsBold { get; }
public bool IsItalic { get; }
public bool IsUnderline { get; }
public bool IsOutline { get; }
public bool IsShadow { get; }
public bool IsCondensed { get; }
public bool IsExtended { get; }
public HeaderTable(ReadOnlySpan<byte> data);
public static byte[] CreateSubset(ReadOnlySpan<byte> source);
}
HeaderTable.HeaderTable(ReadOnlySpan<byte> data)
public HeaderTable(ReadOnlySpan<byte> data);
byte[] HeaderTable.CreateSubset(ReadOnlySpan<byte> source)
public static byte[] CreateSubset(ReadOnlySpan<byte> source);
Copies a head table configured for long loca offsets and a new checksum.
DateTime HeaderTable.Created
public DateTime Created { get; }
ushort HeaderTable.FontRevisionMajor
public ushort FontRevisionMajor { get; }
ushort HeaderTable.FontRevisionMinor
public ushort FontRevisionMinor { get; }
ushort HeaderTable.IndexToLocFormat
public ushort IndexToLocFormat { get; }
bool HeaderTable.IsBold
public bool IsBold { get; }
bool HeaderTable.IsCondensed
public bool IsCondensed { get; }
bool HeaderTable.IsExtended
public bool IsExtended { get; }
bool HeaderTable.IsItalic
public bool IsItalic { get; }
bool HeaderTable.IsOutline
public bool IsOutline { get; }
bool HeaderTable.IsShadow
public bool IsShadow { get; }
bool HeaderTable.IsUnderline
public bool IsUnderline { get; }
ushort HeaderTable.LowestRecPPEM
public ushort LowestRecPPEM { get; }
ushort HeaderTable.MacStyle
public ushort MacStyle { get; }
DateTime HeaderTable.Modified
public DateTime Modified { get; }
ushort HeaderTable.UnitsPerEm
public ushort UnitsPerEm { get; }
short HeaderTable.XMax
public short XMax { get; }
short HeaderTable.XMin
public short XMin { get; }
short HeaderTable.YMax
public short YMax { get; }
short HeaderTable.YMin
public short YMin { get; }
class HorizontalHeaderTable
public class HorizontalHeaderTable
{
public short Ascender { get; }
public short Descender { get; }
public short LineGap { get; }
public ushort AdvanceWidthMax { get; }
public short MinLeftSideBearing { get; }
public short MinRightSideBearing { get; }
public short XMaxExtent { get; }
public short CaretSlopeRise { get; }
public short CaretSlopeRun { get; }
public short CaretOffset { get; }
public short MetricDataFormat { get; }
public ushort NumberOfHMetrics { get; }
public HorizontalHeaderTable(ReadOnlySpan<byte> data);
public static byte[] CreateSubset(ReadOnlySpan<byte> source, ushort numberOfHMetrics);
}
HorizontalHeaderTable.HorizontalHeaderTable(ReadOnlySpan<byte> data)
public HorizontalHeaderTable(ReadOnlySpan<byte> data);
ushort HorizontalHeaderTable.AdvanceWidthMax
public ushort AdvanceWidthMax { get; }
short HorizontalHeaderTable.Ascender
public short Ascender { get; }
short HorizontalHeaderTable.CaretOffset
public short CaretOffset { get; }
short HorizontalHeaderTable.CaretSlopeRise
public short CaretSlopeRise { get; }
short HorizontalHeaderTable.CaretSlopeRun
public short CaretSlopeRun { get; }
byte[] HorizontalHeaderTable.CreateSubset(ReadOnlySpan<byte> source, ushort numberOfHMetrics)
public static byte[] CreateSubset(ReadOnlySpan<byte> source, ushort numberOfHMetrics);
Copies an hhea table for a compact hmtx table with one metric per glyph.
short HorizontalHeaderTable.Descender
public short Descender { get; }
short HorizontalHeaderTable.LineGap
public short LineGap { get; }
short HorizontalHeaderTable.MetricDataFormat
public short MetricDataFormat { get; }
short HorizontalHeaderTable.MinLeftSideBearing
public short MinLeftSideBearing { get; }
short HorizontalHeaderTable.MinRightSideBearing
public short MinRightSideBearing { get; }
ushort HorizontalHeaderTable.NumberOfHMetrics
public ushort NumberOfHMetrics { get; }
short HorizontalHeaderTable.XMaxExtent
public short XMaxExtent { get; }
class HorizontalMetricsTable
public class HorizontalMetricsTable
{
public HorizontalMetricsTable(ReadOnlySpan<byte> data, ushort numberOfHMetrics);
public HorizontalMetric GetMetric(int glyphIndex);
public byte[] CreateSubset(IEnumerable<int> glyphIndices);
public record struct HorizontalMetric(ushort AdvanceWidth, short LeftSideBearing);
}
HorizontalMetricsTable.HorizontalMetricsTable(ReadOnlySpan<byte> data, ushort numberOfHMetrics)
public HorizontalMetricsTable(ReadOnlySpan<byte> data, ushort numberOfHMetrics);
byte[] HorizontalMetricsTable.CreateSubset(IEnumerable<int> glyphIndices)
public byte[] CreateSubset(IEnumerable<int> glyphIndices);
Creates a compact hmtx table with one full metric per retained glyph.
HorizontalMetric HorizontalMetricsTable.GetMetric(int glyphIndex)
public HorizontalMetric GetMetric(int glyphIndex);
record struct HorizontalMetricsTable.HorizontalMetric
public record struct HorizontalMetric(ushort AdvanceWidth, short LeftSideBearing);
HorizontalMetric.HorizontalMetric(ushort AdvanceWidth, short LeftSideBearing)
public HorizontalMetric(ushort AdvanceWidth, short LeftSideBearing);
ushort HorizontalMetric.AdvanceWidth
public ushort AdvanceWidth { get; set; }
short HorizontalMetric.LeftSideBearing
public short LeftSideBearing { get; set; }
class KernTable
public sealed class KernTable
{
public readonly Dictionary<(ushort Left, ushort Right), short> Pairs;
public CMapTable CMap { get; }
public KernTable(ReadOnlySpan<byte> data, CMapTable cmap);
public short GetKerningAdjustment(ushort left, ushort right);
public TrueTypeFont.ValueRecord this[Rune left, Rune right] { get; }
public static byte[] CreateSubset(IEnumerable<Pair> pairs);
public readonly record struct Pair(ushort Left, ushort Right, short Value);
}
KernTable.KernTable(ReadOnlySpan<byte> data, CMapTable cmap)
public KernTable(ReadOnlySpan<byte> data, CMapTable cmap);
CMapTable KernTable.CMap
public CMapTable CMap { get; }
byte[] KernTable.CreateSubset(IEnumerable<Pair> pairs)
public static byte[] CreateSubset(IEnumerable<Pair> pairs);
Creates a horizontal format-0 kern table from the retained pairs.
short KernTable.GetKerningAdjustment(ushort left, ushort right)
public short GetKerningAdjustment(ushort left, ushort right);
ValueRecord KernTable.this[Rune left, Rune right]
public TrueTypeFont.ValueRecord this[Rune left, Rune right] { get; }
Dictionary<(ushort Left, ushort Right), short> KernTable.Pairs
public readonly Dictionary<(ushort Left, ushort Right), short> Pairs;
readonly record struct KernTable.Pair
public readonly record struct Pair(ushort Left, ushort Right, short Value);
Pair.Pair(ushort Left, ushort Right, short Value)
public Pair(ushort Left, ushort Right, short Value);
ushort Pair.Left
public ushort Left { get; init; }
ushort Pair.Right
public ushort Right { get; init; }
short Pair.Value
public short Value { get; init; }
class LocaTable
public class LocaTable
{
public LocaTable(ReadOnlySpan<byte> data, int numGlyphs, ushort indexToLocFormat);
public (int Offset, int Length) GetGlyphBounds(int glyphIndex);
public static byte[] CreateLong(IReadOnlyList<int> offsets);
}
LocaTable.LocaTable(ReadOnlySpan<byte> data, int numGlyphs, ushort indexToLocFormat)
public LocaTable(ReadOnlySpan<byte> data, int numGlyphs, ushort indexToLocFormat);
byte[] LocaTable.CreateLong(IReadOnlyList<int> offsets)
public static byte[] CreateLong(IReadOnlyList<int> offsets);
Creates a long-format loca table from glyph offsets.
(int Offset, int Length) LocaTable.GetGlyphBounds(int glyphIndex)
public (int Offset, int Length) GetGlyphBounds(int glyphIndex);
class MaxProfileTable
public class MaxProfileTable
{
public ushort NumGlyphs { get; }
public MaxProfileTable(ReadOnlySpan<byte> data);
public static byte[] CreateSubset(ReadOnlySpan<byte> source, ushort numGlyphs);
}
MaxProfileTable.MaxProfileTable(ReadOnlySpan<byte> data)
public MaxProfileTable(ReadOnlySpan<byte> data);
byte[] MaxProfileTable.CreateSubset(ReadOnlySpan<byte> source, ushort numGlyphs)
public static byte[] CreateSubset(ReadOnlySpan<byte> source, ushort numGlyphs);
Copies a maxp table with the compact glyph count.
ushort MaxProfileTable.NumGlyphs
public ushort NumGlyphs { get; }
class NameTable
public partial class NameTable
{
public string? Copyright { get; }
public string? FamilyName { get; }
public string? SubfamilyName { get; }
public string? UniqueIdentifier { get; }
public string? FullName { get; }
public string? Version { get; }
public string? PostScriptName { get; }
public string? Trademark { get; }
public string? Manufacturer { get; }
public string? Designer { get; }
public string? Description { get; }
public string? VendorURL { get; }
public string? DesignerURL { get; }
public string? License { get; }
public string? LicenseURL { get; }
public string? PreferredFamily { get; }
public string? PreferredSubfamily { get; }
public IReadOnlyList<NameRecord> Names { get; }
public NameTable(ReadOnlySpan<byte> data);
public string? GetNameById(int id);
public record struct NameRecord(ushort NameID, string Value);
}
NameTable.NameTable(ReadOnlySpan<byte> data)
public NameTable(ReadOnlySpan<byte> data);
string? NameTable.Copyright
public string? Copyright { get; }
Copyright notice (Name ID 0)
string? NameTable.Description
public string? Description { get; }
Description of the font (Name ID 10)
string? NameTable.Designer
public string? Designer { get; }
Designer name (Name ID 9)
string? NameTable.DesignerURL
public string? DesignerURL { get; }
URL of the designer (Name ID 12)
string? NameTable.FamilyName
public string? FamilyName { get; }
Font family name (Name ID 1)
string? NameTable.FullName
public string? FullName { get; }
Full font name (Name ID 4)
string? NameTable.GetNameById(int id)
public string? GetNameById(int id);
string? NameTable.License
public string? License { get; }
License description (Name ID 13)
string? NameTable.LicenseURL
public string? LicenseURL { get; }
License info URL (Name ID 14)
string? NameTable.Manufacturer
public string? Manufacturer { get; }
Manufacturer name (Name ID 8)
IReadOnlyList<NameRecord> NameTable.Names
public IReadOnlyList<NameRecord> Names { get; }
string? NameTable.PostScriptName
public string? PostScriptName { get; }
PostScript name (Name ID 6)
string? NameTable.PreferredFamily
public string? PreferredFamily { get; }
Preferred family (Name ID 16) — used for name linking and fallback grouping
string? NameTable.PreferredSubfamily
public string? PreferredSubfamily { get; }
Preferred subfamily (Name ID 17) — used with PreferredFamily
string? NameTable.SubfamilyName
public string? SubfamilyName { get; }
Font subfamily name (e.g. Regular, Bold) (Name ID 2)
string? NameTable.Trademark
public string? Trademark { get; }
Trademark notice (Name ID 7)
string? NameTable.UniqueIdentifier
public string? UniqueIdentifier { get; }
Unique font identifier (Name ID 3)
string? NameTable.VendorURL
public string? VendorURL { get; }
URL of the vendor (Name ID 11)
string? NameTable.Version
public string? Version { get; }
Version string (Name ID 5)
record struct NameTable.NameRecord
public record struct NameRecord(ushort NameID, string Value);
NameRecord.NameRecord(ushort NameID, string Value)
public NameRecord(ushort NameID, string Value);
ushort NameRecord.NameID
public ushort NameID { get; set; }
string NameRecord.Value
public string Value { get; set; }
class OS2Table
public class OS2Table
{
public ushort WeightClass { get; }
public ushort WidthClass { get; }
public short TypoAscender { get; }
public short TypoDescender { get; }
public short TypoLineGap { get; }
public OS2Table(ReadOnlySpan<byte> data);
}
OS2Table.OS2Table(ReadOnlySpan<byte> data)
public OS2Table(ReadOnlySpan<byte> data);
short OS2Table.TypoAscender
public short TypoAscender { get; }
short OS2Table.TypoDescender
public short TypoDescender { get; }
short OS2Table.TypoLineGap
public short TypoLineGap { get; }
ushort OS2Table.WeightClass
public ushort WeightClass { get; }
ushort OS2Table.WidthClass
public ushort WidthClass { get; }
class PostTable
public class PostTable
{
public PostTable(ReadOnlySpan<byte> data);
public string? GetGlyphName(int glyphIndex);
public static byte[] CreateSubset(ReadOnlySpan<byte> source);
}
PostTable.PostTable(ReadOnlySpan<byte> data)
public PostTable(ReadOnlySpan<byte> data);
byte[] PostTable.CreateSubset(ReadOnlySpan<byte> source)
public static byte[] CreateSubset(ReadOnlySpan<byte> source);
Creates a post format-3 table, retaining metrics but dropping glyph names.
string? PostTable.GetGlyphName(int glyphIndex)
public string? GetGlyphName(int glyphIndex);
readonly record struct TableRecord
public readonly record struct TableRecord(string Tag, uint Offset, uint Length, uint Checksum);
TableRecord.TableRecord(string Tag, uint Offset, uint Length, uint Checksum)
public TableRecord(string Tag, uint Offset, uint Length, uint Checksum);
uint TableRecord.Checksum
public uint Checksum { get; init; }
uint TableRecord.Length
public uint Length { get; init; }
uint TableRecord.Offset
public uint Offset { get; init; }
string TableRecord.Tag
public string Tag { get; init; }
class TextLayout
Lays out a string of text using a TrueType font. Produces positioned glyphs and bounding metrics for rendering and measurement.
public class TextLayout
{
public IReadOnlyList<GlyphPosition> Glyphs { get; }
public readonly LineMetrics LineMetrics;
public TextLayout(TrueTypeFont font, string text);
public TextLayout(TrueTypeFont font, string text, nfloat fontSize, TextAlign textAlign = TextAlign.Left, TextBaseline textBaseline = TextBaseline.Alphabetic);
public void Visit(IGlyphPathBuilder builder);
public readonly record struct GlyphPosition(int GlyphId, NFloat X, NFloat Y);
}
TextLayout.TextLayout(TrueTypeFont font, string text)
public TextLayout(TrueTypeFont font, string text);
TextLayout.TextLayout(TrueTypeFont font, string text, NFloat fontSize, TextAlign textAlign = TextAlign.Left, TextBaseline textBaseline = TextBaseline.Alphabetic)
public TextLayout(TrueTypeFont font, string text, nfloat fontSize, TextAlign textAlign = TextAlign.Left, TextBaseline textBaseline = TextBaseline.Alphabetic);
IReadOnlyList<GlyphPosition> TextLayout.Glyphs
public IReadOnlyList<GlyphPosition> Glyphs { get; }
LineMetrics TextLayout.LineMetrics
public readonly LineMetrics LineMetrics;
The horizontal and vertical bounding metrics of the laid-out text.
void TextLayout.Visit(IGlyphPathBuilder builder)
public void Visit(IGlyphPathBuilder builder);
Visits each glyph path, offset and scaled to its layout position.
readonly record struct TextLayout.GlyphPosition
public readonly record struct GlyphPosition(int GlyphId, NFloat X, NFloat Y);
GlyphPosition.GlyphPosition(int GlyphId, NFloat X, NFloat Y)
public GlyphPosition(int GlyphId, NFloat X, NFloat Y);
int GlyphPosition.GlyphId
public int GlyphId { get; init; }
NFloat GlyphPosition.X
public NFloat X { get; init; }
NFloat GlyphPosition.Y
public NFloat Y { get; init; }
class TrueTypeFont
public partial class TrueTypeFont
{
public record struct ValueRecord(short? XPlacement, short? YPlacement, short? XAdvance, short? YAdvance)
{
public static ValueRecord Parse(ReadOnlySpan<byte> span, ushort format, out int size);
}
}
public partial class TrueTypeFont
{
public record struct ValueRecordTuple(ValueRecord Left, ValueRecord Right);
}
public partial class TrueTypeFont
{
public readonly ReadOnlyMemory<byte> Blob;
public readonly Uri? SourceUri;
public IReadOnlyDictionary<string, TableRecord> Tables { get; }
public HeaderTable? Head { get; }
public MaxProfileTable? Maxp { get; }
public CMapTable? Cmap { get; }
public PostTable? Post { get; }
public LocaTable? Loca { get; }
public GlyfTable? Glyf { get; }
public OS2Table? OS2 { get; }
public NameTable? Name { get; }
public HorizontalHeaderTable? Hhea { get; }
public HorizontalMetricsTable? Hmtx { get; }
public KernTable? Kern { get; }
public GPosTable? GPos { get; }
public FontFace Face { get; }
public KerningQuery Kerning { get; }
public TrueTypeFont(ReadOnlyMemory<byte> blob, Uri? SourceUri = null);
public TextMetrics MeasureText(string text, Xui.Core.Canvas.Font font, TextAlign textAlign = TextAlign.Left, TextBaseline textBaseline = TextBaseline.Alphabetic);
public LineMetrics MeasureLine(string text, Xui.Core.Canvas.Font font, TextAlign textAlign = TextAlign.Left, TextBaseline textBaseline = TextBaseline.Alphabetic);
public FontMetrics Metrics(Xui.Core.Canvas.Font font);
public bool TryGetGlyph(int glyphId, out GlyphShape shape);
public int? GetGlyphIndex(Rune rune);
public string? GetGlyphName(int glyphId);
public readonly record struct TableRecord(string Tag, uint Offset, uint Length, uint Checksum);
public readonly struct KerningQuery
{
public KerningQuery(TrueTypeFont font);
public ValueRecord this[Rune left, Rune right] { get; }
}
public static FontFace FontFace(HeaderTable? head, NameTable? name, OS2Table? os2);
public static FontFace FontFace(ReadOnlySpan<byte> fontData);
}
TrueTypeFont.TrueTypeFont(ReadOnlyMemory<byte> blob, Uri? SourceUri = null)
public TrueTypeFont(ReadOnlyMemory<byte> blob, Uri? SourceUri = null);
ReadOnlyMemory<byte> TrueTypeFont.Blob
public readonly ReadOnlyMemory<byte> Blob;
CMapTable? TrueTypeFont.Cmap
public CMapTable? Cmap { get; }
FontFace TrueTypeFont.Face
public FontFace Face { get; }
FontFace TrueTypeFont.FontFace(ReadOnlySpan<byte> fontData)
public static FontFace FontFace(ReadOnlySpan<byte> fontData);
FontFace TrueTypeFont.FontFace(HeaderTable? head, NameTable? name, OS2Table? os2)
public static FontFace FontFace(HeaderTable? head, NameTable? name, OS2Table? os2);
Extracts a Xui.Runtime.Software.Font.TrueTypeFont.FontFace(Xui.Runtime.Software.Font.HeaderTable,Xui.Runtime.Software.Font.NameTable,Xui.Runtime.Software.Font.OS2Table) from minimal parsed font tables.
name— TheXui.Runtime.Software.Font.NameTablecontaining font naming information.os2— TheXui.Runtime.Software.Font.OS2Tablecontaining weight and width data.head— TheXui.Runtime.Software.Font.HeaderTableused to determine italic style (via macStyle flags).
Returns: A constructed Xui.Runtime.Software.Font.TrueTypeFont.FontFace(Xui.Runtime.Software.Font.HeaderTable,Xui.Runtime.Software.Font.NameTable,Xui.Runtime.Software.Font.OS2Table).
GPosTable? TrueTypeFont.GPos
public GPosTable? GPos { get; }
int? TrueTypeFont.GetGlyphIndex(Rune rune)
public int? GetGlyphIndex(Rune rune);
string? TrueTypeFont.GetGlyphName(int glyphId)
public string? GetGlyphName(int glyphId);
GlyfTable? TrueTypeFont.Glyf
public GlyfTable? Glyf { get; }
HeaderTable? TrueTypeFont.Head
public HeaderTable? Head { get; }
HorizontalHeaderTable? TrueTypeFont.Hhea
public HorizontalHeaderTable? Hhea { get; }
HorizontalMetricsTable? TrueTypeFont.Hmtx
public HorizontalMetricsTable? Hmtx { get; }
KernTable? TrueTypeFont.Kern
public KernTable? Kern { get; }
KerningQuery TrueTypeFont.Kerning
public KerningQuery Kerning { get; }
LocaTable? TrueTypeFont.Loca
public LocaTable? Loca { get; }
MaxProfileTable? TrueTypeFont.Maxp
public MaxProfileTable? Maxp { get; }
LineMetrics TrueTypeFont.MeasureLine(string text, Font font, TextAlign textAlign = TextAlign.Left, TextBaseline textBaseline = TextBaseline.Alphabetic)
public LineMetrics MeasureLine(string text, Xui.Core.Canvas.Font font, TextAlign textAlign = TextAlign.Left, TextBaseline textBaseline = TextBaseline.Alphabetic);
Measures metrics which depend on the text's glyphs and shaping.
TextMetrics TrueTypeFont.MeasureText(string text, Font font, TextAlign textAlign = TextAlign.Left, TextBaseline textBaseline = TextBaseline.Alphabetic)
public TextMetrics MeasureText(string text, Xui.Core.Canvas.Font font, TextAlign textAlign = TextAlign.Left, TextBaseline textBaseline = TextBaseline.Alphabetic);
FontMetrics TrueTypeFont.Metrics(Font font)
public FontMetrics Metrics(Xui.Core.Canvas.Font font);
NameTable? TrueTypeFont.Name
public NameTable? Name { get; }
OS2Table? TrueTypeFont.OS2
public OS2Table? OS2 { get; }
PostTable? TrueTypeFont.Post
public PostTable? Post { get; }
Uri? TrueTypeFont.SourceUri
public readonly Uri? SourceUri;
IReadOnlyDictionary<string, TableRecord> TrueTypeFont.Tables
public IReadOnlyDictionary<string, TableRecord> Tables { get; }
bool TrueTypeFont.TryGetGlyph(int glyphId, out GlyphShape shape)
public bool TryGetGlyph(int glyphId, out GlyphShape shape);
readonly struct TrueTypeFont.KerningQuery
public readonly struct KerningQuery
{
public KerningQuery(TrueTypeFont font);
public ValueRecord this[Rune left, Rune right] { get; }
}
KerningQuery.KerningQuery(TrueTypeFont font)
public KerningQuery(TrueTypeFont font);
ValueRecord KerningQuery.this[Rune left, Rune right]
public ValueRecord this[Rune left, Rune right] { get; }
readonly record struct TrueTypeFont.TableRecord
public readonly record struct TableRecord(string Tag, uint Offset, uint Length, uint Checksum);
TableRecord.TableRecord(string Tag, uint Offset, uint Length, uint Checksum)
public TableRecord(string Tag, uint Offset, uint Length, uint Checksum);
uint TableRecord.Checksum
public uint Checksum { get; init; }
uint TableRecord.Length
public uint Length { get; init; }
uint TableRecord.Offset
public uint Offset { get; init; }
string TableRecord.Tag
public string Tag { get; init; }
record struct TrueTypeFont.ValueRecord
public record struct ValueRecord(short? XPlacement, short? YPlacement, short? XAdvance, short? YAdvance)
{
public static ValueRecord Parse(ReadOnlySpan<byte> span, ushort format, out int size);
}
ValueRecord.ValueRecord(short? XPlacement, short? YPlacement, short? XAdvance, short? YAdvance)
public ValueRecord(short? XPlacement, short? YPlacement, short? XAdvance, short? YAdvance);
ValueRecord ValueRecord.Parse(ReadOnlySpan<byte> span, ushort format, out int size)
public static ValueRecord Parse(ReadOnlySpan<byte> span, ushort format, out int size);
short? ValueRecord.XAdvance
public short? XAdvance { get; set; }
short? ValueRecord.XPlacement
public short? XPlacement { get; set; }
short? ValueRecord.YAdvance
public short? YAdvance { get; set; }
short? ValueRecord.YPlacement
public short? YPlacement { get; set; }
record struct TrueTypeFont.ValueRecordTuple
public record struct ValueRecordTuple(ValueRecord Left, ValueRecord Right);
ValueRecordTuple.ValueRecordTuple(ValueRecord Left, ValueRecord Right)
public ValueRecordTuple(ValueRecord Left, ValueRecord Right);
ValueRecord ValueRecordTuple.Left
public ValueRecord Left { get; set; }
ValueRecord ValueRecordTuple.Right
public ValueRecord Right { get; set; }
class TrueTypeFontSubset
Builds a compact TrueType sfnt containing the rendered simple glyphs and kerning pairs.
public static class TrueTypeFontSubset
{
public static ReadOnlyMemory<byte> Create(TrueTypeFont font, FontUsage usage);
}
ReadOnlyMemory<byte> TrueTypeFontSubset.Create(TrueTypeFont font, FontUsage usage)
public static ReadOnlyMemory<byte> Create(TrueTypeFont font, FontUsage usage);
Creates a deterministic TrueType subset. The initial format supports BMP characters and simple and composite glyf outlines; its callers must retain the original font for unsupported scripts.