From e3d3075356a7200517f8190a7d246c3e6501d04d Mon Sep 17 00:00:00 2001 From: Scover Date: Mon, 24 Oct 2022 15:07:05 +0200 Subject: [PATCH] Fixed SetPointSize LOGFONT passed by value with a ref (#332) --- PInvoke/User32/Extensions/LOGFONTExtension.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PInvoke/User32/Extensions/LOGFONTExtension.cs b/PInvoke/User32/Extensions/LOGFONTExtension.cs index a8f333b18..dc7a8a174 100644 --- a/PInvoke/User32/Extensions/LOGFONTExtension.cs +++ b/PInvoke/User32/Extensions/LOGFONTExtension.cs @@ -16,7 +16,7 @@ public static class LOGFONTExtension /// Sets the point size of the font. /// The LOGFONT structure. /// The point size of the font. - public static void SetPointSize(this LOGFONT lf, float value) => lf.lfHeight = (int)Math.Round(-value * GetDevicePixelsPerInchY() / 72); + public static void SetPointSize(this ref LOGFONT lf, float value) => lf.lfHeight = Convert.ToInt32(-value * GetDevicePixelsPerInchY() / 72); private static int GetDevicePixelsPerInchY() => GetDeviceCaps(GetDC(GetDesktopWindow()), DeviceCap.LOGPIXELSY); }