예제 #1
0
        public Mesh[] GetMeshes(string text)
        {
            if (String.IsNullOrEmpty(text))
            {
                return(Array.Empty <Mesh>());
            }

            Mesh[] meshes = new Mesh[text.Length];

            for (int i = 0; i < text.Length; i++)
            {
                if (text[i] == ' ' || text[i] == '\r' || text[i] == '\n')
                {
                    continue;
                }

                int idx = CharIndices['?'];

                if (CharIndices.TryGetValue(text[i], out int found))
                {
                    idx = found;
                }

                meshes[i] = CharactersMeshes[idx];
            }

            return(meshes);
        }
예제 #2
0
 public Glyph this[char character]
 {
     get
     {
         if (CharIndices.TryGetValue(character, out int indice))
         {
             return(Table[indice]);
         }
         else if (CharIndices.TryGetValue('?', out indice))
         {
             return(Table[indice]);
         }
         else
         {
             throw new ArgumentException($"Unable to find character '{character}'. Neither the '?' character is available.", nameof(character));
         }
     }
 }