summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomofumi Yagi <yagit@mknada.sakura.ne.jp>2014-02-15 11:48:20 +0900
committerNorbert Thiebaud <nthiebaud@gmail.com>2014-02-18 06:42:52 +0000
commitcda903f83831341f44833b94e7d38e598f5a7198 (patch)
tree5515ab1a845e96f568bae671ae18f7ca3e153a74
parent416d0453c5dcf2802eecdec59b6e85d5b097c55b (diff)
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@gmail.com> Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
-rw-r--r--vcl/quartz/ctfonts.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index fffd680a14ac..9c37c652f4c7 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 ) );