コード例 #1
0
 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));
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: UiFont.cs プロジェクト: prepare/Sitana
 void Get()
 {
     if (UiUnit.FontUnit != _lastUnit)
     {
         _universalFont = _fontFace.Find(_fontSize, out _scale);
         _lastUnit      = UiUnit.FontUnit;
     }
 }
コード例 #5
0
        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));
            }
        }
コード例 #6
0
 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));
 }
コード例 #7
0
 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));
 }
コード例 #8
0
 public Vector2 DrawText(UniversalFont font, SharedString text, Point position, TextAlign align, Color color)
 {
     return(DrawText(font, text, position, align, color, 0, 0, 1));
 }
コード例 #9
0
        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));
        }
コード例 #10
0
        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));
        }
コード例 #11
0
 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));
 }
コード例 #12
0
ファイル: FontFace.cs プロジェクト: prepare/Sitana
 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);
 }