public static int GetTextMetrics(HandleRef hDC, ref System.Windows.Forms.NativeMethods.TEXTMETRIC lptm)
 {
     if (Marshal.SystemDefaultCharSize == 1)
     {
         System.Windows.Forms.NativeMethods.TEXTMETRICA textmetrica = new System.Windows.Forms.NativeMethods.TEXTMETRICA();
         int textMetricsA = GetTextMetricsA(hDC, ref textmetrica);
         lptm.tmHeight           = textmetrica.tmHeight;
         lptm.tmAscent           = textmetrica.tmAscent;
         lptm.tmDescent          = textmetrica.tmDescent;
         lptm.tmInternalLeading  = textmetrica.tmInternalLeading;
         lptm.tmExternalLeading  = textmetrica.tmExternalLeading;
         lptm.tmAveCharWidth     = textmetrica.tmAveCharWidth;
         lptm.tmMaxCharWidth     = textmetrica.tmMaxCharWidth;
         lptm.tmWeight           = textmetrica.tmWeight;
         lptm.tmOverhang         = textmetrica.tmOverhang;
         lptm.tmDigitizedAspectX = textmetrica.tmDigitizedAspectX;
         lptm.tmDigitizedAspectY = textmetrica.tmDigitizedAspectY;
         lptm.tmFirstChar        = (char)textmetrica.tmFirstChar;
         lptm.tmLastChar         = (char)textmetrica.tmLastChar;
         lptm.tmDefaultChar      = (char)textmetrica.tmDefaultChar;
         lptm.tmBreakChar        = (char)textmetrica.tmBreakChar;
         lptm.tmItalic           = textmetrica.tmItalic;
         lptm.tmUnderlined       = textmetrica.tmUnderlined;
         lptm.tmStruckOut        = textmetrica.tmStruckOut;
         lptm.tmPitchAndFamily   = textmetrica.tmPitchAndFamily;
         lptm.tmCharSet          = textmetrica.tmCharSet;
         return(textMetricsA);
     }
     return(GetTextMetricsW(hDC, ref lptm));
 }
 public static extern int GetTextMetricsA(HandleRef hDC, [In, Out] ref System.Windows.Forms.NativeMethods.TEXTMETRICA lptm);
 public static int GetTextMetrics(HandleRef hDC, ref System.Windows.Forms.NativeMethods.TEXTMETRIC lptm)
 {
     if (Marshal.SystemDefaultCharSize == 1)
     {
         System.Windows.Forms.NativeMethods.TEXTMETRICA textmetrica = new System.Windows.Forms.NativeMethods.TEXTMETRICA();
         int textMetricsA = GetTextMetricsA(hDC, ref textmetrica);
         lptm.tmHeight = textmetrica.tmHeight;
         lptm.tmAscent = textmetrica.tmAscent;
         lptm.tmDescent = textmetrica.tmDescent;
         lptm.tmInternalLeading = textmetrica.tmInternalLeading;
         lptm.tmExternalLeading = textmetrica.tmExternalLeading;
         lptm.tmAveCharWidth = textmetrica.tmAveCharWidth;
         lptm.tmMaxCharWidth = textmetrica.tmMaxCharWidth;
         lptm.tmWeight = textmetrica.tmWeight;
         lptm.tmOverhang = textmetrica.tmOverhang;
         lptm.tmDigitizedAspectX = textmetrica.tmDigitizedAspectX;
         lptm.tmDigitizedAspectY = textmetrica.tmDigitizedAspectY;
         lptm.tmFirstChar = (char) textmetrica.tmFirstChar;
         lptm.tmLastChar = (char) textmetrica.tmLastChar;
         lptm.tmDefaultChar = (char) textmetrica.tmDefaultChar;
         lptm.tmBreakChar = (char) textmetrica.tmBreakChar;
         lptm.tmItalic = textmetrica.tmItalic;
         lptm.tmUnderlined = textmetrica.tmUnderlined;
         lptm.tmStruckOut = textmetrica.tmStruckOut;
         lptm.tmPitchAndFamily = textmetrica.tmPitchAndFamily;
         lptm.tmCharSet = textmetrica.tmCharSet;
         return textMetricsA;
     }
     return GetTextMetricsW(hDC, ref lptm);
 }