Extending wxFont API & OSX Core Text Implementation (#877)

* Switch to pure Core Text Implementation, Start extended Font API

* mac fixes

* First msw implementation

* Fixing paste error

* fixing typo

* Rearranging lines to former fallthrough order

* Blind fixes for covering new abstract methods

* Blind gtk implementations

* Fixing according to travis ..

* Removing method defined in base

* formatting adaptions

* Extending the schema definition for new weights

* fixing typo, using wxRound, other fixes according to comments

* changes according to suggestions

* fixing init order, before the init of m_info was overridden by Init()

* redo

* redo

* redo

* Cleanup

Removing obsolete code snippets, proper traces for font names

* Moving common code

Only the Get/SetNumericWeight calls should now be implemented in the native part, the ‚old‘ Get/SetWeight are common code and use the numeric counterparts.

* Updating docs

* commit wa missing changes.txt

* Doc fixes

* Full stops added
This commit is contained in:
Stefan Csomor
2018-09-01 19:42:18 +02:00
committed by GitHub
parent d2c77146db
commit 4580cdb9ad
22 changed files with 1210 additions and 800 deletions

View File

@@ -61,13 +61,27 @@ enum wxFontStyle
/**
Font weights.
The values of this enum correspond to the CSS font weight specifications,
see https://www.w3.org/TR/css-fonts-4/#font-weight-prop, with the addition of
one font weight bolder than heavy
*/
enum wxFontWeight
{
wxFONTWEIGHT_NORMAL = wxNORMAL, //!< Normal font.
wxFONTWEIGHT_LIGHT = wxLIGHT, //!< Light font.
wxFONTWEIGHT_BOLD = wxBOLD, //!< Bold font.
wxFONTWEIGHT_MAX
wxFONTWEIGHT_INVALID = 0, //!< Invalid font weight. @since 3.1.2
wxFONTWEIGHT_THIN = 100, //!< Thin font (weight = 100). @since 3.1.2
wxFONTWEIGHT_EXTRALIGHT = 200, //!< Extra Light (Ultra Light) font (weight = 200). @since 3.1.2
wxFONTWEIGHT_LIGHT = 300, //!< Light font (weight = 300).
wxFONTWEIGHT_NORMAL = 400, //!< Normal font (weight = 400).
wxFONTWEIGHT_MEDIUM = 500, //!< Medium font (weight = 500). @since 3.1.2
wxFONTWEIGHT_SEMIBOLD = 600, //!< Semi Bold (Demi Bold) font (weight = 600). @since 3.1.2
wxFONTWEIGHT_BOLD = 700, //!< Bold font (weight = 700).
wxFONTWEIGHT_EXTRABOLD = 800, //!< Extra Bold (Ultra Bold) font (weight = 800). @since 3.1.2
wxFONTWEIGHT_HEAVY = 900, //!< Heavy (Black) font (weight = 900). @since 3.1.2
wxFONTWEIGHT_EXTRAHEAVY = 1000, //!< Extra Heavy font (weight = 1000). @since 3.1.2
wxFONTWEIGHT_MAX = wxFONTWEIGHT_EXTRAHEAVY
};
/**
@@ -698,12 +712,24 @@ public:
static bool AddPrivateFont(const wxString& filename);
/**
Gets the point size.
Gets the point size as an integer number.
@see SetPointSize()
This function is kept for compatibility reasons. New code should use
GetFractionalPointSize() and support fractional point sizes.
@see SetPointSize(), @see GetFractionalPointSize()
*/
virtual int GetPointSize() const;
/**
Gets the point size as a floating number.
@see SetPointSize(float)
@since 3.1.2
*/
virtual float GetFractionalPointSize() const;
/**
Gets the pixel size.
@@ -745,6 +771,18 @@ public:
*/
virtual wxFontWeight GetWeight() const;
/**
Gets the font weight as an integer value.
See ::wxFontWeight for a list of valid weight identifiers and their corresponding integer value.
@see SetWeight()
@see SetNumericWeight()
@since 3.1.2
*/
virtual int GetNumericWeight() const;
/**
Returns @true if the font is a fixed width (or monospaced) font,
@false if it is a proportional one or font is invalid.
@@ -1019,7 +1057,7 @@ public:
bool SetNativeFontInfoUserDesc(const wxString& info);
void SetNativeFontInfo(const wxNativeFontInfo& info);
/**
Sets the point size.
@@ -1027,11 +1065,13 @@ public:
(25.4 mm): it is approximately 0.0139 inch or 352.8 um.
@param pointSize
Size in points.
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()
*/
virtual void SetPointSize(int pointSize);
virtual void SetPointSize(float pointSize);
/**
Sets the pixel size.
@@ -1114,6 +1154,19 @@ public:
*/
virtual void SetWeight(wxFontWeight weight);
/**
Sets the font weight using an integer value.
See ::wxFontWeight for a list of valid weight identifiers and their
corresponding integer value.
@param weight
An integer value int the range 1-1000.
@see GetNumericWeight()
*/
virtual void SetNumericWeight(int weight);
//@}
@@ -1186,7 +1239,7 @@ public:
const wxString& faceName = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
static wxFont *New(const wxNativeFontInfo& nativeInfo);
static wxFont *New(const wxString& nativeInfoString);
@@ -1265,7 +1318,7 @@ public:
/**
Finds a font of the given specification, or creates one and adds it to the
list. See the @ref wxFont "wxFont constructor" for details of the arguments.
@since 3.1.1
*/
wxFont* FindOrCreateFont(const wxFontInfo& fontInfo);