internal void InternalDrawGlyph(ref InternalDrawCommand parameters, ref Vector2 fontSize, ref Glyph glyph, float x, float y, float nextx) { if (char.IsWhiteSpace((char)glyph.Character) || glyph.Subrect.Width == 0 || glyph.Subrect.Height == 0) { return; } var spriteEffects = parameters.SpriteEffects; var offset = new Vector2(x, y + GetBaseOffsetY(fontSize.Y) + glyph.Offset.Y); Vector2.Modulate(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.Modulate(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); RectangleF?sourceRectangle = glyph.Subrect; parameters.SpriteBatch.DrawSprite(Textures[glyph.BitmapIndex], ref destination, true, ref sourceRectangle, parameters.Color, parameters.Rotation, ref offset, spriteEffects, ImageOrientation.AsIs, parameters.Depth, Swizzle, true); }
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); }
internal void InternalDraw(ref StringProxy text, ref InternalDrawCommand drawCommand, TextAlignment alignment) { // If the text is mirrored, offset the start position accordingly. if (drawCommand.SpriteEffects != SpriteEffects.None) { drawCommand.Origin -= MeasureString(ref text, ref drawCommand.FontSize) * AxisIsMirroredTable[(int)drawCommand.SpriteEffects & 3]; } // Draw each character in turn. ForEachGlyph(ref text, ref drawCommand.FontSize, InternalDrawGlyph, ref drawCommand, alignment, true); }
internal void InternalDraw(CommandList commandList, ref StringProxy text, ref InternalDrawCommand drawCommand, TextAlignment alignment, TextVerticalAlignment vert_alignment, float lineAdjustment) { // If the text is mirrored, offset the start position accordingly. if (drawCommand.SpriteEffects != SpriteEffects.None) { drawCommand.Origin -= MeasureString(ref text, ref drawCommand.FontSize, lineAdjustment) * AxisIsMirroredTable[(int)drawCommand.SpriteEffects & 3]; } // Draw each character in turn. ForEachGlyph(commandList, ref text, ref drawCommand.FontSize, internalDrawGlyphAction, ref drawCommand, alignment, vert_alignment, true, null, lineAdjustment); }
internal void InternalDraw(ref StringProxy text, ref InternalDrawCommand drawCommand) { //origin.Y += globalBaseOffsetY; // If the text is mirrored, offset the start position accordingly. if (drawCommand.spriteEffects != SpriteEffects.None) { drawCommand.origin -= MeasureString(ref text) * axisIsMirroredTable[(int)drawCommand.spriteEffects & 3]; } // Draw each character in turn. ForEachGlyph(ref text, drawGlyphDelegate, ref drawCommand); }
internal void InternalDrawGlyph(ref InternalDrawCommand parameters, in Vector2 fontSize, in Glyph glyph, float x, float y, float nextx, ref Vector2 auxiliaryScaling)