diff --git a/src/SixLabors.Fonts/GlyphPositioningCollection.cs b/src/SixLabors.Fonts/GlyphPositioningCollection.cs index 8378ac02..2a4d3389 100644 --- a/src/SixLabors.Fonts/GlyphPositioningCollection.cs +++ b/src/SixLabors.Fonts/GlyphPositioningCollection.cs @@ -118,9 +118,9 @@ public bool TryGetGlyphMetricsAtOffset( isVerticalSubstitution = false; isDecomposed = false; - Tag vert = FeatureTags.VerticalAlternates; - Tag vrt2 = FeatureTags.VerticalAlternatesAndRotation; - Tag vrtr = FeatureTags.VerticalAlternatesForRotation; + Tag vert = KnownFeatureTags.VerticalAlternates; + Tag vrt2 = KnownFeatureTags.VerticalAlternatesAndRotation; + Tag vrtr = KnownFeatureTags.VerticalAlternatesForRotation; for (int i = startIndex; i < this.glyphs.Count; i++) { @@ -171,9 +171,9 @@ public bool TryUpdate(Font font, GlyphSubstitutionCollection collection) bool hasFallBacks = false; List orphans = []; - Tag vert = FeatureTags.VerticalAlternates; - Tag vrt2 = FeatureTags.VerticalAlternatesAndRotation; - Tag vrtr = FeatureTags.VerticalAlternatesForRotation; + Tag vert = KnownFeatureTags.VerticalAlternates; + Tag vrt2 = KnownFeatureTags.VerticalAlternatesAndRotation; + Tag vrtr = KnownFeatureTags.VerticalAlternatesForRotation; for (int i = 0; i < this.glyphs.Count; i++) { @@ -268,9 +268,9 @@ public bool TryAdd(Font font, GlyphSubstitutionCollection collection) LayoutMode layoutMode = this.TextOptions.LayoutMode; ColorFontSupport colorFontSupport = this.TextOptions.ColorFontSupport; - Tag vert = FeatureTags.VerticalAlternates; - Tag vrt2 = FeatureTags.VerticalAlternatesAndRotation; - Tag vrtr = FeatureTags.VerticalAlternatesForRotation; + Tag vert = KnownFeatureTags.VerticalAlternates; + Tag vrt2 = KnownFeatureTags.VerticalAlternatesAndRotation; + Tag vrtr = KnownFeatureTags.VerticalAlternatesForRotation; for (int i = 0; i < collection.Count; i++) { @@ -358,9 +358,9 @@ public void UpdatePosition(FontMetrics fontMetrics, int index) public void Advance(FontMetrics fontMetrics, int index, ushort glyphId, short dx, short dy) { LayoutMode layoutMode = this.TextOptions.LayoutMode; - Tag vert = FeatureTags.VerticalAlternates; - Tag vrt2 = FeatureTags.VerticalAlternatesAndRotation; - Tag vrtr = FeatureTags.VerticalAlternatesForRotation; + Tag vert = KnownFeatureTags.VerticalAlternates; + Tag vrt2 = KnownFeatureTags.VerticalAlternatesAndRotation; + Tag vrtr = KnownFeatureTags.VerticalAlternatesForRotation; GlyphPositioningData glyph = this.glyphs[index]; GlyphMetrics m = glyph.Metrics; diff --git a/src/SixLabors.Fonts/Tables/AdvancedTypographic/FeatureTags.cs b/src/SixLabors.Fonts/Tables/AdvancedTypographic/KnownFeatureTags.cs similarity index 99% rename from src/SixLabors.Fonts/Tables/AdvancedTypographic/FeatureTags.cs rename to src/SixLabors.Fonts/Tables/AdvancedTypographic/KnownFeatureTags.cs index 42c35f48..f2f16137 100644 --- a/src/SixLabors.Fonts/Tables/AdvancedTypographic/FeatureTags.cs +++ b/src/SixLabors.Fonts/Tables/AdvancedTypographic/KnownFeatureTags.cs @@ -7,7 +7,7 @@ namespace SixLabors.Fonts.Tables.AdvancedTypographic; /// Provides enumeration for the different font features. /// /// -public enum FeatureTags : uint +public enum KnownFeatureTags : uint { /// /// Access All Alternates. Shortcode: aalt. diff --git a/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/HangulShaper.cs b/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/HangulShaper.cs index b41312ad..41443077 100644 --- a/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/HangulShaper.cs +++ b/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/HangulShaper.cs @@ -309,7 +309,7 @@ private int DecomposeGlyph(GlyphSubstitutionCollection collection, GlyphShapingD ii[1] = vjmo; ii[0] = ljmo; - collection.Replace(index, ii, FeatureTags.GlyphCompositionDecomposition); + collection.Replace(index, ii, KnownFeatureTags.GlyphCompositionDecomposition); collection.EnableShapingFeature(index, LjmoTag); collection.EnableShapingFeature(index + 1, VjmoTag); return index + 1; @@ -320,7 +320,7 @@ private int DecomposeGlyph(GlyphSubstitutionCollection collection, GlyphShapingD iii[1] = vjmo; iii[0] = ljmo; - collection.Replace(index, iii, FeatureTags.GlyphCompositionDecomposition); + collection.Replace(index, iii, KnownFeatureTags.GlyphCompositionDecomposition); collection.EnableShapingFeature(index, LjmoTag); collection.EnableShapingFeature(index + 1, VjmoTag); collection.EnableShapingFeature(index + 2, TjmoTag); @@ -393,7 +393,7 @@ private int ComposeGlyph(GlyphSubstitutionCollection collection, int index, int { int del = prevType == V ? 3 : 2; int idx = index - del + 1; - collection.Replace(idx, del - 1, id, FeatureTags.GlyphCompositionDecomposition); + collection.Replace(idx, del - 1, id, KnownFeatureTags.GlyphCompositionDecomposition); collection[idx].CodePoint = s; return idx; } @@ -496,7 +496,7 @@ private int InsertDottedCircle(GlyphSubstitutionCollection collection, GlyphShap glyphs[0] = id; } - collection.Replace(index, glyphs, FeatureTags.GlyphCompositionDecomposition); + collection.Replace(index, glyphs, KnownFeatureTags.GlyphCompositionDecomposition); return index + 1; } diff --git a/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/HebrewShaper.cs b/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/HebrewShaper.cs index 33320967..ab4fd13d 100644 --- a/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/HebrewShaper.cs +++ b/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/HebrewShaper.cs @@ -147,7 +147,7 @@ private static void ComposeHebrewForms(GlyphSubstitutionCollection collection, F if (composed != 0 && fontMetrics.TryGetGlyphId(new CodePoint(composed), out ushort composedGlyphId)) { // Replace the two glyphs with the composed form. - collection.Replace(i - 1, 2, composedGlyphId, FeatureTags.GlyphCompositionDecomposition); + collection.Replace(i - 1, 2, composedGlyphId, KnownFeatureTags.GlyphCompositionDecomposition); end--; i--; } diff --git a/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/IndicShaper.cs b/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/IndicShaper.cs index 1e833ba3..cfbe1a16 100644 --- a/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/IndicShaper.cs +++ b/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/IndicShaper.cs @@ -193,7 +193,7 @@ protected override void AssignFeatures(IGlyphShapingCollection collection, int i if (shouldDecompose) { - substitutionCollection.Replace(i, ids, FeatureTags.GlyphCompositionDecomposition); + substitutionCollection.Replace(i, ids, KnownFeatureTags.GlyphCompositionDecomposition); for (int j = 0; j < decompositions.Length; j++) { substitutionCollection[i + j].CodePoint = new(decompositions[j]); @@ -382,7 +382,7 @@ private void InitialReorder(IGlyphShapingCollection collection, int index, int c glyphs[0] = circleId; glyphs[1] = current.GlyphId; - substitutionCollection.Replace(i, glyphs, FeatureTags.GlyphCompositionDecomposition); + substitutionCollection.Replace(i, glyphs, KnownFeatureTags.GlyphCompositionDecomposition); // The dotted circle is now at position i (inherits original shaping info). // Update it to be a dotted circle base. diff --git a/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/MyanmarShaper.cs b/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/MyanmarShaper.cs index c8125d9a..99b3cdf9 100644 --- a/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/MyanmarShaper.cs +++ b/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/MyanmarShaper.cs @@ -220,7 +220,7 @@ private void InitialReorder(IGlyphShapingCollection collection, int index, int c glyphs[0] = current.GlyphId; glyphs[1] = circleId; - substitutionCollection.Replace(i, glyphs, FeatureTags.GlyphCompositionDecomposition); + substitutionCollection.Replace(i, glyphs, KnownFeatureTags.GlyphCompositionDecomposition); // Update shaping info for newly inserted data. GlyphShapingData dotted = substitutionCollection[i + 1]; diff --git a/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/ThaiShaper.cs b/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/ThaiShaper.cs index 8c4a7cb3..e1d197ea 100644 --- a/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/ThaiShaper.cs +++ b/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/ThaiShaper.cs @@ -241,7 +241,7 @@ private static int PreprocessSaraAm(GlyphSubstitutionCollection collection, Font // Decompose SARA AM into [NIKHAHIT, SARA AA]. // Replace puts NIKHAHIT at index i, SARA AA at index i+1. - collection.Replace(i, [nikhahitId, saraAAId], FeatureTags.GlyphCompositionDecomposition); + collection.Replace(i, [nikhahitId, saraAAId], KnownFeatureTags.GlyphCompositionDecomposition); collection[i].CodePoint = new CodePoint(nikhahitCodepoint); collection[i + 1].CodePoint = new CodePoint(saraAACodepoint); end++; diff --git a/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/UniversalShaper.cs b/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/UniversalShaper.cs index 7005e987..fda9bc50 100644 --- a/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/UniversalShaper.cs +++ b/src/SixLabors.Fonts/Tables/AdvancedTypographic/Shapers/UniversalShaper.cs @@ -163,7 +163,7 @@ private void DecomposeSplitVowels(IGlyphShapingCollection collection, int index, if (shouldDecompose) { - substitutionCollection.Replace(i, ids, FeatureTags.GlyphCompositionDecomposition); + substitutionCollection.Replace(i, ids, KnownFeatureTags.GlyphCompositionDecomposition); for (int j = 0; j < decompositions.Length; j++) { substitutionCollection[i + j].CodePoint = new(decompositions[j]); @@ -353,7 +353,7 @@ private void Reorder(IGlyphShapingCollection collection, int index, int count) glyphs[0] = current.GlyphId; glyphs[1] = circleId; - substitutionCollection.Replace(i, glyphs, FeatureTags.GlyphCompositionDecomposition); + substitutionCollection.Replace(i, glyphs, KnownFeatureTags.GlyphCompositionDecomposition); // Update shaping info for newly inserted data. GlyphShapingData dotted = substitutionCollection[i + 1]; diff --git a/src/SixLabors.Fonts/Tables/AdvancedTypographic/Tag.cs b/src/SixLabors.Fonts/Tables/AdvancedTypographic/Tag.cs index e650d84f..a6aa0f2c 100644 --- a/src/SixLabors.Fonts/Tables/AdvancedTypographic/Tag.cs +++ b/src/SixLabors.Fonts/Tables/AdvancedTypographic/Tag.cs @@ -30,10 +30,10 @@ namespace SixLabors.Fonts.Tables.AdvancedTypographic; public static implicit operator Tag(uint value) => new(value); /// - /// Implicitly converts a to a . + /// Implicitly converts a to a . /// /// The feature tag enum value. - public static implicit operator Tag(FeatureTags value) => new((uint)value); + public static implicit operator Tag(KnownFeatureTags value) => new((uint)value); /// /// Determines whether two instances are equal. diff --git a/src/SixLabors.Fonts/TextLayout.cs b/src/SixLabors.Fonts/TextLayout.cs index 4f8e05ca..a460eb6f 100644 --- a/src/SixLabors.Fonts/TextLayout.cs +++ b/src/SixLabors.Fonts/TextLayout.cs @@ -1061,7 +1061,7 @@ private static void SubstituteBidiMirrors(FontMetrics fontMetrics, GlyphSubstitu if (fontMetrics.TryGetGlyphId(mirror, out ushort glyphId)) { - collection.Replace(i, glyphId, FeatureTags.RightToLeftMirroredForms); + collection.Replace(i, glyphId, KnownFeatureTags.RightToLeftMirroredForms); } } @@ -1087,7 +1087,7 @@ private static void SubstituteBidiMirrors(FontMetrics fontMetrics, GlyphSubstitu if (fontMetrics.TryGetGlyphId(mirror, out ushort glyphId)) { - collection.Replace(i, glyphId, FeatureTags.VerticalAlternates); + collection.Replace(i, glyphId, KnownFeatureTags.VerticalAlternates); } } } diff --git a/tests/SixLabors.Fonts.Tests/Tables/AdvancedTypographic/Gsub/GSubTableTests.cs b/tests/SixLabors.Fonts.Tests/Tables/AdvancedTypographic/Gsub/GSubTableTests.cs index ac5f2cc2..6582bdcf 100644 --- a/tests/SixLabors.Fonts.Tests/Tables/AdvancedTypographic/Gsub/GSubTableTests.cs +++ b/tests/SixLabors.Fonts.Tests/Tables/AdvancedTypographic/Gsub/GSubTableTests.cs @@ -81,7 +81,7 @@ public void ContextualFractions_WithFractionSlash_Works() int[] expectedGlyphIndices = [580, 404, 453]; // act - TextRenderer.RenderTextTo(renderer, testStr, new TextOptions(font) { FeatureTags = new Tag[] { FeatureTags.Numerators, FeatureTags.Denominators } }); + TextRenderer.RenderTextTo(renderer, testStr, new TextOptions(font) { FeatureTags = new Tag[] { KnownFeatureTags.Numerators, KnownFeatureTags.Denominators } }); // assert Assert.Equal(expectedGlyphIndices.Length, renderer.GlyphKeys.Count); @@ -101,7 +101,7 @@ public void ContextualFractions_WithSlash_Works() int[] expectedGlyphIndices = [580, 404, 453]; // act - TextRenderer.RenderTextTo(renderer, testStr, new TextOptions(font) { FeatureTags = new Tag[] { FeatureTags.Fractions } }); + TextRenderer.RenderTextTo(renderer, testStr, new TextOptions(font) { FeatureTags = new Tag[] { KnownFeatureTags.Fractions } }); // assert Assert.Equal(expectedGlyphIndices.Length, renderer.GlyphKeys.Count); @@ -357,7 +357,7 @@ public void OldStyleFiguresFeature_Works() // act TextRenderer.RenderTextTo(renderer, testStr, new TextOptions(font) { - FeatureTags = new List { FeatureTags.OldstyleFigures } + FeatureTags = new List { KnownFeatureTags.OldstyleFigures } }); // assert diff --git a/tests/SixLabors.Fonts.Tests/TextOptionsTests.cs b/tests/SixLabors.Fonts.Tests/TextOptionsTests.cs index db022643..bae45ecd 100644 --- a/tests/SixLabors.Fonts.Tests/TextOptionsTests.cs +++ b/tests/SixLabors.Fonts.Tests/TextOptionsTests.cs @@ -313,7 +313,7 @@ public void NonDefaultClone() DecorationPositioningMode = DecorationPositioningMode.GlyphFont, WrappingLength = 42F, Tracking = 66F, - FeatureTags = new List { FeatureTags.OldstyleFigures } + FeatureTags = new List { KnownFeatureTags.OldstyleFigures } }; TextOptions actual = new(expected);