Esempio n. 1
0
 public void CopyFrom(FontData font)
 {
     Family  = font.Family;
     Size    = font.Size;
     Style   = font.Style;
     Weight  = font.Weight;
     Stretch = font.Stretch;
 }
Esempio n. 2
0
        public Size MeasureString(string text, FontData font, Size size)
        {
            var w    = size.Width;
            var fact = font.Size / 10 * .7;
            var h    = size.Height;

            if (w == 0)
            {
                foreach (var c in text)
                {
                    var s = fontMeasure.Measure(c);
                    w += s.Width * fact;
                    //h = Math.Max(h, s.Height * fact);
                }
            }

            return(new Size(w, h));
        }
Esempio n. 3
0
        public Size MeasureString0(string text, FontData font, Size size)
        {
            var w = size.Width;

            if (w == 0)
            {
                foreach (var c in text)
                {
                    if (smallChars.Contains(c))
                    {
                        w += (font.Size / 2);
                    }
                    else
                    {
                        w += font.Size * .7;
                    }
                }
            }
            var h = size.Height;

            return(new Size(w, h));
        }
Esempio n. 4
0
 public static Font ToXwt(this FontData backend)
 {
     return(CreateFrontend <Font>(backend));
 }