示例#1
0
        public SizeF MeasureText(string text, FontInfo font)
        {
            var state = Graphics.TextRenderingHint;

            try
            {
                Graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
                return(Graphics.MeasureString(text, FontResolver.Resolve(font), new SizeF(int.MaxValue, int.MaxValue), StringFormat.GenericTypographic));
            }
            finally
            {
                Graphics.TextRenderingHint = state;
            }
        }
示例#2
0
        private float CalculateSpaceSize(FontInfo font)
        {
            var xfont = FontResolver.Resolve(font);

            return(Graphics.MeasureString("x x", xfont).Width - Graphics.MeasureString("xx", xfont).Width);
        }