private void Initialize(GraphicsDevice graphicsDevice, FontStb font, float height) { this.graphicsDevice = graphicsDevice; this.font = font; this.height = height; Glyphs = new Dictionary <char, Glyph>(); Glyph[] Glyph = font.GetGlyphsFromCodepoint(height, new int[] { 'A', '国' }, 1f, 1f); defaultGlyph = Glyph[0]; defaultGlyphCn = Glyph[1]; }
private void GetGlyph(char[] charArray) { List <char> chars = charArray.ToList(); for (int i = 0; i < chars.Count; i++) { if (Glyphs.ContainsKey(chars[i]) || chars.IndexOf(chars[i]) < i) { chars.RemoveAt(i); i--; } } if (chars.Count == 0) { return; } Glyph[] GlyphArray = font.GetGlyphsFromCodepoint(height, chars.ToCodePointArray(), 1f, 1f); for (int i = 0; i < chars.Count; i++) { Glyphs.Add(chars[i], GlyphArray[i]); } }
private void GetGlyph() { Glyphs = font.GetGlyphsFromCodepoint(height, text.ToCodePointArray(), 1f, 1f); }