Ejemplo n.º 1
0
        public Vector2 <float> MeasureText(string text)
        {
            mgr.PushState();
            mgr.SetFont(Name);
            Vector2 <float> sz = new Vector2 <float> (mgr.MeasureTextWidth(text), mgr.GetFontHeight(Name));

            mgr.PopState();
            return(sz);
        }
Ejemplo n.º 2
0
        public void DrawText(Font font, string text, WWUtils.Math.Vector2 <float> position, WWUtils.Math.Vector2 <float> Handle, float rotation, WWUtils.Math.Vector2 <float> scale, WWUtils.Math.Vector3 <byte> color)
        {
            FontImpl fnt = font as FontImpl;

            mgr.PushState();
            mgr.SetFont(fnt.Name);
            mgr.SetFillColor(color.X, color.Y, color.Z);
            mgr.Translate((int)-Handle.X, (int)-Handle.Y);
            mgr.Rotate(rotation);
            mgr.Scale(scale.X, scale.Y);
            // need to add text height because CanvasManager palces baseline at origin
            mgr.FillText(text, (int)position.X, (int)(position.Y + mgr.GetFontHeight(fnt.Name)));
            mgr.PopState();
        }