Exemple #1
0
        public static Size MeasureText(Graphics graphics, string text, Font font, Size proposedSize, TextFormatFlags flags)
        {
Retry:
            try
            {
                if (!Program.Config.EnableDirectWrite || fallback)
                {
                    return(TextRenderer.MeasureText(graphics, text, font, proposedSize, flags));
                }
                else
                {
                    return(DirectWriteTextRenderer.MeasureText(graphics, text, font, proposedSize, flags));
                }
            }
            catch (FileNotFoundException exception)
            {
                if (Fallback())
                {
                    goto Retry;
                }
                ShowError(exception);
                throw;
            }
        }
Exemple #2
0
        public static Size MeasureText(string text, Font font)
        {
Retry:
            try
            {
                if (!Program.Config.EnableDirectWrite || fallback)
                {
                    return(TextRenderer.MeasureText(text, font));
                }
                else
                {
                    return(DirectWriteTextRenderer.MeasureText(text, font));
                }
            }
            catch (FileNotFoundException exception)
            {
                if (Fallback())
                {
                    goto Retry;
                }
                ShowError(exception);
                throw;
            }
        }