Add wxFont::SetFractionalPointSize()

Changing SetPointSize() argument type from int to float wasn't 100%
backwards-compatible as it notably started resulting in warnings (from
at least MSVC) about conversions from int to float in the existing code.

To avoid these warnings and for symmetry with GetFractionalPointSize(),
add SetFractionalPointSize() taking float argument and preserve the
argument of type int in SetPointSize() for compatibility.

SetPointSize() is now just a wrapper forwarding to the more general
SetFractionalPointSize().

Notice that the other ports still remain broken, this commit only
updates the currently working wxGTK, wxMac and wxMSW.
This commit is contained in:
Vadim Zeitlin
2018-09-06 01:40:47 +02:00
parent e05a732666
commit c98879e379
9 changed files with 52 additions and 26 deletions

View File

@@ -1062,19 +1062,29 @@ public:
void SetNativeFontInfo(const wxNativeFontInfo& info);
/**
Sets the point size.
Sets the font size in points to an integer value.
This is a legacy version of the function only supporting integer point
sizes. It can still be used, but to avoid unnecessarily restricting the
font size in points to integer values, consider using the new (added in
wxWidgets 3.1.2) SetFractionalPointSize() function instead.
*/
virtual void SetPointSize(int pointSize);
/**
Sets the font size in points.
The <em>point size</em> is defined as 1/72 of the Anglo-Saxon inch
(25.4 mm): it is approximately 0.0139 inch or 352.8 um.
@param pointSize
Size in points. This can also be a fractional point size like 11.5.
Note that until wxWidgets 3.1.2, the size had to be an integer number
(and the type of this parameter was @c int).
@see GetPointSize()
@see GetFractionalPointSize(), SetPointSize()
@since 3.1.2
*/
virtual void SetPointSize(float pointSize);
virtual void SetFractionalPointSize(float pointSize);
/**
Sets the pixel size.