Пример #1
0
 public ScriptMetrics this[Font font]
 {
     get
     {
         ScriptMetrics scriptMetrics;
         if (!dict.TryGetValue(font, out scriptMetrics))
         {
             scriptMetrics = new ScriptMetrics();
             dict.Add(font, scriptMetrics);
         }
         return(scriptMetrics);
     }
 }
Пример #2
0
 public ScriptMetrics this[Font font]
 {
     get
     {
         ScriptMetrics scriptMetrics;
         if (!dict.TryGetValue(font, out scriptMetrics))
         {
             scriptMetrics = new ScriptMetrics();
             dict.Add(font, scriptMetrics);
         }
         return scriptMetrics;
     }
 }
Пример #3
0
        public ScriptMetrics SelectFont(Font font)
        {
            if (currentFont != font)
            {
                NativeMethods.SelectObject(HDC, font.ToHfont());
                currentFont          = font;
                currentScriptMetrics = scriptMetricsCache[currentFont];

                if (!currentScriptMetrics.HaveMetrics)
                {
                    TEXTMETRIC textMetric;
                    NativeMethods.GetTextMetrics(HDC, out textMetric);

                    currentScriptMetrics.Height      = textMetric.tmHeight;
                    currentScriptMetrics.Descent     = textMetric.tmDescent;
                    currentScriptMetrics.HaveMetrics = true;
                }
            }

            return(currentScriptMetrics);
        }
Пример #4
0
        public ScriptMetrics SelectFont(Font font)
        {
            if (currentFont != font)
            {
                NativeMethods.SelectObject(HDC, font.ToHfont());
                currentFont = font;
                currentScriptMetrics = scriptMetricsCache[currentFont];

                if (!currentScriptMetrics.HaveMetrics)
                {
                    TEXTMETRIC textMetric;
                    NativeMethods.GetTextMetrics(HDC, out textMetric);

                    currentScriptMetrics.Height = textMetric.tmHeight;
                    currentScriptMetrics.Descent = textMetric.tmDescent;
                    currentScriptMetrics.HaveMetrics = true;
                }
            }
 
            return currentScriptMetrics;
        }