using System; using System.Collections.Generic; namespace RTLTMPro { /// /// Sets up and creates the conversion table /// public static class GlyphTable { private static readonly Dictionary MapList; /// /// Setting up the conversion table /// static GlyphTable() { //using GetNames instead of GetValues to be able to match enums var isolatedValues = Enum.GetNames(typeof(ArabicIsolatedLetters)); MapList = new Dictionary(isolatedValues.Length); foreach (var value in isolatedValues) MapList.Add((char)(int) Enum.Parse(typeof(ArabicGeneralLetters),value), (char) (int)Enum.Parse(typeof(ArabicIsolatedLetters),value)); } public static char Convert(char toBeConverted) { return MapList.TryGetValue(toBeConverted, out var convertedValue) ? convertedValue : toBeConverted; } } }