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)
This commit is contained in:
Vadim Zeitlin 2023-01-14 17:24:28 +01:00
parent 4e272ccaa6
commit 94997a44d6
2 changed files with 2 additions and 1 deletions

View File

@ -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).

View File

@ -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