Changed the Mac font implementation to use full font names instead of (#1416)

* Switch to using PostScriptNames internally, keeping font family name on public API

* solving roundTrip Problem of wxNativeFontInfo only
This commit is contained in:
Stefan Csomor
2019-07-28 14:41:55 +02:00
committed by GitHub
parent b9d668e8f1
commit b0a173a460
2 changed files with 89 additions and 76 deletions

View File

@@ -168,18 +168,18 @@ public:
void Free();
wxString GetFamilyName() const;
wxString GetStyleName() const;
static void UpdateNamesMap(const wxString& familyname, CTFontDescriptorRef descr);
static void UpdateNamesMap(const wxString& familyname, CTFontRef font);
// not all style attributes like condensed etc, are exposed in the public API methods
// for best fidelity PostScript names are useful, they are also used in the toString/fromString methods
wxString GetPostScriptName() const;
bool SetPostScriptName(const wxString& postScriptName);
static CGFloat GetCTWeight( CTFontRef font );
static CGFloat GetCTWeight( CTFontDescriptorRef font );
static CGFloat GetCTSlant( CTFontDescriptorRef font );
CTFontDescriptorRef GetCTFontDescriptor() const;
void RealizeResource() const;
private:
// attributes for regenerating a CTFontDescriptor, stay close to native values
// for better roundtrip fidelity
@@ -188,8 +188,8 @@ private:
CGFloat m_ctSize;
wxFontFamily m_family;
wxString m_styleName;
wxString m_familyName;
wxString m_postScriptName;
// native font description
wxCFRef<CTFontDescriptorRef> m_descriptor;