public static Font ToClearType(this Font font) { var lf = new LOGFONT(); var hFont = font.ToHfont(); if (NativeMethods.GetObject(hFont, Marshal.SizeOf(lf), ref lf) == 0) { throw new Win32Exception(Marshal.GetLastWin32Error()); } NativeMethods.DeleteObject(hFont); lf.Quality = 6; // CLEARTYPE_COMPAT_QUALITY hFont = NativeMethods.CreateFontIndirect(ref lf); return(Font.FromHfont(hFont)); }
internal static extern int GetObject(IntPtr hObj, int cb, ref LOGFONT objdata);
internal static extern IntPtr CreateFontIndirect(ref LOGFONT pLogFont);