Skip to content

Commit

Permalink
Fixed SetPointSize LOGFONT passed by value with a ref (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
5cover authored Oct 24, 2022
1 parent f60a379 commit e3d3075
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion PInvoke/User32/Extensions/LOGFONTExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static class LOGFONTExtension
/// <summary>Sets the point size of the font.</summary>
/// <param name="lf">The LOGFONT structure.</param>
/// <param name="value">The point size of the font.</param>
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);
}
Expand Down

0 comments on commit e3d3075

Please sign in to comment.