public static List <char> GetCharactersToImport(SpriteFontAsset asset) { var characters = new List <char>(); var fontTypeSDF = asset.FontType as SignedDistanceFieldSpriteFontType; if (fontTypeSDF == null) { throw new ArgumentException("Tried to compile a dynamic sprite font with compiler for signed distance field fonts"); } // extract the list from the provided file if it exits if (File.Exists(fontTypeSDF.CharacterSet)) { string text; using (var streamReader = new StreamReader(fontTypeSDF.CharacterSet, Encoding.UTF8)) text = streamReader.ReadToEnd(); characters.AddRange(text); } // add character coming from character ranges characters.AddRange(CharacterRegion.Flatten(fontTypeSDF.CharacterRegions)); // remove duplicated characters characters = characters.Distinct().ToList(); return(characters); }
public static List <char> GetCharactersToImport(SpriteFontAsset asset) { var characters = new List <char>(); // extract the list from the provided file if it exits if (File.Exists(asset.CharacterSet)) { string text; using (var streamReader = new StreamReader(asset.CharacterSet, Encoding.UTF8)) text = streamReader.ReadToEnd(); characters.AddRange(text); } // add character coming from character ranges characters.AddRange(CharacterRegion.Flatten(asset.CharacterRegions)); // remove duplicated characters characters = characters.Distinct().ToList(); return(characters); }