Implement the new {Get,Set}{FractionalPointSize,NumericWeight} methods.
Also change wxLoadQueryFont() to use wxNativeFontInfo methods as a side
effect, to reduce code duplication and reuse the existing support for
numeric weights and fractional point sizes in wxNativeFontInfo.
There is no chance of wxGraphicsContext ever being supported in this
legacy port, but at least disable it automatically instead of requiring
to specify --disable-graphics-ctx on the command line.
Replace AccountForCompatValues() with InfoFromLegacyParams() which
directly constructs wxFontInfo from the old-style parameters, applying
all the compatibility hacks internally.
There are no real changes in this commit, just simplify the code further
and make wxFontInfo more central.
This actually implements support for the fractional font sizes, as
previously the fractional part was lost when passing by the legacy
Create() taking only integer size.
Live changes don't work correctly in all ports, notably wxQt, which
doesn't seem to generate the events correctly for wxSpinCtrl, so add a
button to apply the changes.
This could be seen as a better UI anyhow.
Support the entire [0, 99] range used by Qt instead of just some
selected values while still mapping all the predefined symbols to their
corresponding wx equivalents.
It might be better to just remove it completely as legacy code is
unlikely to be built with wxQt, but for now at least deprecate it to
make this consistent with the other ports.
wxFontInfo is the preferred way to create wxFont objects, so rewrite the
internal classes to use it directly and implement the other ctors as
wrappers for the one taking wxFontInfo.
Reuse the same code for determining the default font size to use if it
wasn't specified in all major ports.
In particular, make wxGTK behaviour compatible with the rest and use the
normal font size in this case instead of the hardcoded value of 12pt.
Only accept fractional point sizes and numeric weights via wxFont ctor
using wxFontInfo and avoid having specific ctor/Create() overloads for
the different combinations of font properties: this is not portable (as
these ctors don't exist in the other ports) and unsustainable due to the
very real potential of combinatorial explosion as more properties are
added.
As a side-effect, fix support for stricken-through fonts under Mac,
which was broken, by adding the missing wxFontInfo::IsStrikethrough()
call.
This reverts part of 573e887a4c, see
https://github.com/wxWidgets/wxWidgets/pull/666 because it broke the use
of the generic dialogs in the sample under MSW (they were not used any
more, even if they were supposed to) and the explanation in the original
commit message doesn't seem correct: the WXUSINGDLL check is precisely
supposed to check if we're using a static build of wxWidgets (presumably
because of DLL export complications when not using it) and seems to work
as expected.
This allows to test generic dialogs in the sample again under MSW.
This is similar to a recent commit which moved float to int point size
conversions to wxFontInfo and is done for the same reasons: wxFont and
wxNativeFontInfo can depend on wxFontInfo, but the converse is not true.
No real changes.
No real changes, just use wxFont ctor taking wxFontInfo instead of a
Mac-specific ctor.
This is more clear and will continue to work after Mac-specific ctor is
removed.
This will be important when new fields are added to wxNativeFontInfo as
the ctor will be extended to initialize them, while this code wouldn't
do it.
No real changes yet.
They will be also needed in wxFontInfo soon, so move them there and use
these functions from both wxFont and wxNativeFontInfo, as they can
depend on wxFontInfo but not the other way round.
No real changes.
These functions can be useful outside of src/common/fontcmn.cpp and,
potentially, even in the user code, so make them public methods of
wxFont.
No real changes, just add asserts verifying input argument value to
GetWeightClosestToNumericValue().
Implement the new wxFont pure virtual methods in this port version of
this class.
Neither arbitrary weights nor fractional point sizes are actually
supported in this port however.
Store the weight as int, not wxFontWeight, and rely on the same wrappers
as all the other ports in the port not having native wxNativeFontInfo.
This is a prerequisite for fixing wxDFB and other Unix ports not using
Pango.
Define {Get,Set}FractionalPointSize() in wxX11 wxFont implementation.
Note that only Pango-based version really supports floating point sizes
as XLFD can't express them.
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.