internal void InternalDraw(ref StringProxy text, SpriteBatch spriteBatch, Vector2 position, Color color, float rotation, Vector2 origin, ref Vector2 scale, SpriteEffects spriteEffects, float depth) { var baseOffset = origin; //baseOffset.Y += globalBaseOffsetY; // If the text is mirrored, offset the start position accordingly. if (spriteEffects != SpriteEffects.None) { baseOffset -= MeasureString(ref text)*axisIsMirroredTable[(int) spriteEffects & 3]; } var localScale = scale; // Draw each character in turn. ForEachGlyph(ref text, (ref SpriteFontData.Glyph glyph, float x, float y) => { var offset = new Vector2(x, y + glyph.Offset.Y); Vector2.Modulate(ref offset, ref axisDirectionTable[(int) spriteEffects & 3], out offset); Vector2.Add(ref offset, ref baseOffset, out offset); if (spriteEffects != SpriteEffects.None) { // For mirrored characters, specify bottom and/or right instead of top left. var glyphRect = new Vector2(glyph.Subrect.Right - glyph.Subrect.Left, glyph.Subrect.Top - glyph.Subrect.Bottom); Vector2.Modulate(ref glyphRect, ref axisIsMirroredTable[(int) spriteEffects & 3], out offset); } var destination = new RectangleF(position.X, position.Y, localScale.X, localScale.Y); Rectangle? sourceRectangle = glyph.Subrect; spriteBatch.DrawSprite(textures[glyph.BitmapIndex], ref destination, true, ref sourceRectangle, color, rotation, ref offset, spriteEffects, depth); }); }