コード例 #1
0
        public Vector2 MeasureString(string text)
        {
            Bounds bounds = new Bounds();

            _fontSystem.TextBounds(0, 0, text, ref bounds);

            return(new Vector2(bounds.X2, bounds.Y2));
        }
コード例 #2
0
        public Bounds DrawStringReturnBounds(SpriteBatch batch, string text, Vector2 pos, Color color, Vector2 scale, float depth)
        {
            _fontSystem.Color = color;
            _fontSystem.Scale = scale;

            var    result = _fontSystem.DrawText(batch, pos.X, pos.Y, text, depth);
            Bounds bounds = new Bounds();

            _fontSystem.TextBounds(pos.X, pos.Y, text, ref bounds);

            _fontSystem.Scale = Vector2.One;

            return(bounds);
        }