Example #1
0
        internal static Graphics.Size MeasureText(DrawingContext dc, string text, string fontName, double fontSize, Drawing.Text.FontStyles style)
        {
            ResourcePoolManager resManager = dc.Renderer.ResourcePoolManager;

            FormattedText ft = new FormattedText(text, System.Threading.Thread.CurrentThread.CurrentCulture,
                                                 FlowDirection.LeftToRight, resManager.GetTypeface(fontName),
                                                 fontSize * PlatformUtility.GetDPI() / 72.0, null);

            return(new Graphics.Size(ft.Width, ft.Height));
        }