Make converters between wxFontWeight and raw values public

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().
This commit is contained in:
Vadim Zeitlin
2018-09-07 03:05:34 +02:00
parent 4e0b4e5939
commit 6dd9f4208e
3 changed files with 81 additions and 51 deletions

View File

@@ -1221,6 +1221,34 @@ public:
*/
static void SetDefaultEncoding(wxFontEncoding encoding);
/**
Get the raw weight value corresponding to the given symbolic constant.
For compatibility, this function handles the values @c wxNORMAL, @c
wxLIGHT and @c wxBOLD, that have values 90, 91 and 92, specially and
converts them to the corresponding @c wxFONTWEIGHT_XXX weight value.
@param weight
A valid element of wxFontWeight enum, i.e. this argument can't have
value ::wxFONTWEIGHT_INVALID.
@return Numeric weight, between 1 and 1000.
@since 3.1.2
*/
static int GetNumericWeightOf(wxFontWeight weight);
/**
Get the symbolic weight closest to the given raw weight value.
@param numWeight
A valid raw weight value, i.e. a value in the range 1 to 1000,
inclusive.
@return A valid element of wxFontWeight enum.
@since 3.1.2
*/
static wxFontWeight GetWeightClosestToNumericValue(int numWeight);
//@{
/**
This function takes the same parameters as the relative