Centralize backwards compatibility code in wxFont

Add wxFontBase::AccountForCompatValues() and use it in all ports instead
of redoing the same comparison with wxDEFAULT in all of them.

This is done not so much to avoid the code duplication, which was
minimal anyhow, but to make the code more clear and make it easier to
remove it from all ports at once in the bright (but remote) future when
we don't need these compatibility hacks any more.

Also document that wxDEFAULT and wxNORMAL are only handled specially in
the old-style ctor taking the individual font components and not the new
one using wxFontInfo and extend the unit test to check this.
This commit is contained in:
Vadim Zeitlin
2018-09-06 02:32:53 +02:00
parent b84db46feb
commit 08e5acedcc
10 changed files with 54 additions and 42 deletions

View File

@@ -503,7 +503,10 @@ public:
historical reasons, the value 70 here is interpreted at @c
wxDEFAULT and results in creation of the font with the default size
and not of a font with the size of 70pt. If you really need the
latter, please use SetPointSize(70).
latter, please use SetPointSize(70). Note that this constructor and
the matching Create() method overload are the only places in wxFont
API handling @c wxDEFAULT specially: neither SetPointSize() nor the
constructor taking wxFontInfo handle this value in this way.
@param family
The font family: a generic portable way of referring to fonts without specifying a
facename. This parameter must be one of the ::wxFontFamily enumeration values.