[Libreoffice-commits] core.git: vcl/quartz
Tomofumi Yagi
yagit at mknada.sakura.ne.jp
Tue Feb 18 07:43:20 CET 2014
vcl/quartz/ctfonts.cxx | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
New commits:
commit cda903f83831341f44833b94e7d38e598f5a7198
Author: Tomofumi Yagi <yagit at mknada.sakura.ne.jp>
Date: Sat Feb 15 11:48:20 2014 +0900
fdo#72042: Fix for "Font names are not localized (Mac OS X)"
This patch will bring the behavior of 4.0 to master(4.3).
This patch has 1 changes on implementation of vcl/quartz/ctfonts.cxx.
We will use CTFontDescriptorCopyLocalizedAttribute() API,If possible.
So DevFontFromCTFontDescriptor() can return the localized fontname.
Change-Id: I7eb5bda4fa69540fb32de573190a30bcb2c01cd2
Reviewed-on: https://gerrit.libreoffice.org/8071
Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index fffd680..9c37c65 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -305,8 +305,17 @@ ImplDevFontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool
rDFA.mbSubsettable = true;
// get font name
- CFStringRef pFamilyName = (CFStringRef)CTFontDescriptorCopyAttribute( pFD, kCTFontFamilyNameAttribute );
+ const OUString aUILang = Application::GetSettings().GetUILanguageTag().getLanguage();
+ CFStringRef pUILang = CFStringCreateWithCharacters( kCFAllocatorDefault, aUILang.getStr(), aUILang.getLength() );
+ CFStringRef pLang = NULL;
+ CFStringRef pFamilyName = (CFStringRef)CTFontDescriptorCopyLocalizedAttribute( pFD, kCTFontFamilyNameAttribute, &pLang );
+ if ( CFStringCompare( pUILang, pLang, 0 ) != kCFCompareEqualTo )
+ {
+ CFRelease( pFamilyName );
+ pFamilyName = (CFStringRef)CTFontDescriptorCopyAttribute( pFD, kCTFontFamilyNameAttribute );
+ }
rDFA.SetFamilyName( GetOUString( pFamilyName ) );
+
// get font style
CFStringRef pStyleName = (CFStringRef)CTFontDescriptorCopyAttribute( pFD, kCTFontStyleNameAttribute );
rDFA.SetStyleName( GetOUString( pStyleName ) );
More information about the Libreoffice-commits
mailing list