GetGlyph() 공개 메소드

public GetGlyph ( char character ) : Sprite,
character char
리턴 Sprite,
예제 #1
0
파일: TextGlyph.cs 프로젝트: k-t/SharpHaven
 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);
 }
예제 #2
0
            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
            }