Switch to using float for point size in wxNativeFontInfo

Use float as the fundamental type for the font size and implement
wxNativeFontInfo::{Set,Get}PointSize() as wrappers around the new
{Set,Get}FractionalPointSize().

Update wxNativeFontInfo for all platforms and replace the use of its
SetPointSize() method with SetFractionalPointSize() in wxFont for the
platforms already supporting fractional point sizes (don't change the
others just yet).

Note that wxNativeFontInfo::{Get,Set}PointSize() are preserved for
backwards compatibility but shouldn't be used in any code inside the
library itself any more (again, this is not the case yet, but will be
soon).
This commit is contained in:
Vadim Zeitlin
2018-09-05 22:28:38 +02:00
parent 08e5acedcc
commit e05a732666
8 changed files with 40 additions and 48 deletions

View File

@@ -96,7 +96,7 @@ public:
{
if (GetFractionalPointSize() != size)
{
m_info.SetPointSize(size);
m_info.SetFractionalPointSize(size);
Free();
}
}
@@ -1028,11 +1028,6 @@ wxString wxNativeFontInfo::ToString() const
return s;
}
int wxNativeFontInfo::GetPointSize() const
{
return wxRound(GetFractionalPointSize());
}
float wxNativeFontInfo::GetFractionalPointSize() const
{
return m_ctSize;
@@ -1113,9 +1108,9 @@ bool wxNativeFontInfo::GetStrikethrough() const
// changing the font descriptor
void wxNativeFontInfo::SetPointSize(float pointsize)
void wxNativeFontInfo::SetFractionalPointSize(float pointsize)
{
if (GetPointSize() != pointsize)
if (GetFractionalPointSize() != pointsize)
{
m_ctSize = pointsize;