internal void InternalDrawGlyph(ref InternalDrawCommand parameters, ref SpriteFontData.Glyph glyph, float x, float y, float nextx) { if (char.IsWhiteSpace((char)glyph.Character)) { return; } var spriteEffects = parameters.spriteEffects; var offset = new Vector2(x, y + glyph.Offset.Y); Vector2.Multiply(ref offset, ref axisDirectionTable[(int)spriteEffects & 3], out offset); Vector2.Add(ref offset, ref parameters.origin, out offset); offset.X = (float)Math.Round(offset.X); offset.Y = (float)Math.Round(offset.Y); 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.Multiply(ref glyphRect, ref axisIsMirroredTable[(int)spriteEffects & 3], out offset); } var destination = new RectangleF(parameters.position.X, parameters.position.Y, parameters.scale.X, parameters.scale.Y); Rectangle?sourceRectangle = glyph.Subrect; parameters.spriteBatch.DrawSprite(textures[glyph.BitmapIndex], ref destination, true, ref sourceRectangle, parameters.color, parameters.rotation, ref offset, spriteEffects, parameters.depth); }
private void MeasureStringGlyph(ref Vector2 result, ref SpriteFontData.Glyph glyph, float x, float y, float nextx) { float h = y + LineSpacing; if (nextx > result.X) { result.X = nextx; } if (h > result.Y) { result.Y = h; } }
private void MeasureStringGlyph(ref Vector2 result, ref SpriteFontData.Glyph glyph, float x, float y) { float w = x + (glyph.Subrect.Right - glyph.Subrect.Left) + Spacing; float h = y + Math.Max((glyph.Subrect.Bottom - glyph.Subrect.Top) + glyph.Offset.Y, LineSpacing); if (w > result.X) { result.X = w; } if (h > result.Y) { result.Y = h; } }