public TextGlyph(SpriteFont font, char c) { this.font = font; this.c = c; this.glyph = font.GetGlyph(c); this.ascent = font.Ascent; this.box.Size = new Point2D((int)glyph.Advance, font.Height); }
public bool GetGlyph(char ch, out Glyph result) { #if PSM Microsoft.Xna.Framework.Graphics.SpriteFont.Glyph temp; if (!Font.GetGlyph(ch, out temp)) { result = default(Glyph); return(false); } result = new Glyph { Character = ch, Texture = Texture, BoundsInTexture = temp.BoundsInTexture, Cropping = temp.Cropping, LeftSideBearing = temp.LeftSideBearing, RightSideBearing = temp.RightSideBearing, WidthIncludingBearings = temp.WidthIncludingBearings, Width = temp.Width }; return(true); #else var characterIndex = Fields.Characters.BinarySearch(ch); if (characterIndex < 0) { characterIndex = DefaultCharacterIndex; } if (characterIndex < 0) { result = default(Glyph); return(false); } result = MakeGlyphForCharacter(ch, characterIndex); return(true); #endif }