From 94997a44d69748f2a9f3f0a0f47553d97286f7d9 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 14 Jan 2023 17:24:28 +0100 Subject: [PATCH] Round the value returned from wxFont::GetPixelSize() in wxOSX It seems wrong to return height of 12 from this function when GetTextExtent() returns 12.9, so round the returned values instead of truncating them to int. This makes wxOSX more consistent with the other ports. (cherry picked from commit 9aceae8f28c642f7c75ec85a944335d985133112) --- docs/changes.txt | 1 + src/osx/carbon/font.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 74751d98fe..332b53a922 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -305,6 +305,7 @@ wxOSX: - Fix possible crash in menu item event handling (#23040). - Fix regression in text drawing when using clipping (#22629). - Don't round fractional point size when creating fonts (#23144). +- Do round size returned by wxFont::GetPixelS(). - Map wxFONTFAMILY_DEFAULT to wxFONTFAMILY_SWISS as in the other ports (#23158). - Generate wxEVT_DATAVIEW_COLUMN_HEADER_RIGHT_CLICK (#22833). - Fix wxDataViewCtrl::HitTest() (Vojtěch Bubník, #22789). diff --git a/src/osx/carbon/font.cpp b/src/osx/carbon/font.cpp index 6171320174..1c127a4e43 100644 --- a/src/osx/carbon/font.cpp +++ b/src/osx/carbon/font.cpp @@ -721,7 +721,7 @@ wxSize wxFont::GetPixelSize() const wxDouble width, height = 0; dc->GetTextExtent(wxT("g"), &width, &height, NULL, NULL); delete dc; - return wxSize((int)width, (int)height); + return wxSize(wxRound(width), wxRound(height)); #else return wxFontBase::GetPixelSize(); #endif