From f9abeeed90c253114201881cbb4575fbb833cd2d Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Fri, 25 Apr 2014 21:03:37 +0000 Subject: [PATCH] backport, get rid of performance warnings "For best performance, only use PostScript names when calling this API", see #15999 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76397 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/carbon/font.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/osx/carbon/font.cpp b/src/osx/carbon/font.cpp index ed790206c1..fd26c73c80 100644 --- a/src/osx/carbon/font.cpp +++ b/src/osx/carbon/font.cpp @@ -1309,4 +1309,23 @@ void wxNativeFontInfo::SetStrikethrough(bool WXUNUSED(strikethrough)) { } +void wxNativeFontInfo::UpdateNamesMap(const wxString& familyName, CTFontDescriptorRef descr) +{ + if ( gs_FontFamilyToPSName.find(familyName) == gs_FontFamilyToPSName.end() ) + { + wxCFStringRef psName( (CFStringRef) CTFontDescriptorCopyAttribute(descr, kCTFontNameAttribute)); + gs_FontFamilyToPSName[familyName] = psName.AsString(); + } +} + +void wxNativeFontInfo::UpdateNamesMap(const wxString& familyName, CTFontRef font) +{ + if ( gs_FontFamilyToPSName.find(familyName) == gs_FontFamilyToPSName.end() ) + { + wxCFRef descr(CTFontCopyFontDescriptor( font )); + UpdateNamesMap(familyName, descr); + } +} + +