public Vector2 DrawText(UniversalFont font, SharedString text, Rectangle target, TextAlign align, Color color, float spacing, float lineHeight, float scale, TextRotation rotation = TextRotation.None) { lock (text) { return(DrawText(font, text.StringBuilder, target, align, color, spacing, lineHeight, scale, rotation)); } }
public Vector2 DrawText(UniversalFont font, StringBuilder text, Rectangle target, TextAlign align, Color[] colors, float opacity, float spacing, float lineHeight, float scale) { if (font == null || text == null) { return(Vector2.Zero); } Font = font; Vector2 size = _font.MeasureString(text, spacing, lineHeight) * scale; Vector2 position = TextPosition(ref target, align, size, TextRotation.None); if (_font.SitanaFont != null) { PrimitiveType = PrimitiveType.TriangleList; PrimitiveBatchNeeded(); _font.SitanaFont.Draw(_primitiveBatch, text, position, colors, opacity, spacing, lineHeight, scale); } else { throw new Exception("Only Sitana Font supports colored text."); } return(size); }
public Vector2 DrawText(UniversalFont font, StringBuilder text, Rectangle target, TextAlign align, Color color, float spacing, float lineHeight, float scale, TextRotation rotation = TextRotation.None) { if (font == null || text == null) { return(Vector2.Zero); } Font = font; Vector2 size = _font.MeasureString(text, spacing, lineHeight) * scale; Vector2 position = TextPosition(ref target, align, size, rotation); if (_font.SitanaFont != null) { PrimitiveType = PrimitiveType.TriangleList; PrimitiveBatchNeeded(); _font.SitanaFont.Draw(_primitiveBatch, text, position, color, spacing, lineHeight, scale, rotation); } else { Vector2 origin = TextOrigin(align, size); position.X += origin.X * scale; SpriteBatchIsNeeded(); _spriteBatch.DrawString(_font.SpriteFont, text, position, color, 0, origin, scale, SpriteEffects.None, 0); } return(size); }
void Get() { if (UiUnit.FontUnit != _lastUnit) { _universalFont = _fontFace.Find(_fontSize, out _scale); _lastUnit = UiUnit.FontUnit; } }
public Vector2 DrawText(UniversalFont font, SharedString text, Point position, TextAlign align, Color color, float spacing, float lineHeight, float scale) { Rectangle target = new Rectangle(position.X, position.Y, 0, 0); lock (text) { return(DrawText(font, text.StringBuilder, target, align, color, spacing, lineHeight, scale, TextRotation.None)); } }
public Vector2 DrawText(UniversalFont font, StringBuilder text, Rectangle target, TextAlign align, Color[] colors, float opacity) { return(DrawText(font, text, target, align, colors, opacity, 0, 0, 1)); }
public Vector2 DrawText(UniversalFont font, StringBuilder text, Rectangle target, TextAlign align, Color color) { return(DrawText(font, text, target, align, color, 0, 0, 1, TextRotation.None)); }
public Vector2 DrawText(UniversalFont font, SharedString text, Point position, TextAlign align, Color color) { return(DrawText(font, text, position, align, color, 0, 0, 1)); }
public Vector2 DrawText(UniversalFont font, string text, Point position, TextAlign align, Color color, float spacing, float lineHeight, float scale) { Rectangle target = new Rectangle(position.X, position.Y, 0, 0); return(DrawText(font, text, target, align, color, spacing, lineHeight, scale)); }
public Vector2 DrawText(UniversalFont font, StringBuilder text, Point position, TextAlign align, Color color) { Rectangle target = new Rectangle(position.X, position.Y, 0, 0); return(DrawText(font, text, target, align, color)); }
public Vector2 DrawText(UniversalFont font, SharedString text, Rectangle target, TextAlign align, Color color, TextRotation rotation = TextRotation.None) { return(DrawText(font, text, target, align, color, 0, 0, 1)); }
internal void Add(int size, UniversalFont font) { Fonts.Add(size, new Tuple <UniversalFont, int>(font, size)); _minSize = Math.Min(size, _minSize); _maxSize = Math.Max(size, _maxSize); }