summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2013-06-03 23:55:58 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2013-06-03 23:58:10 +0200
commit5e33f1c09b5dcfaa9cabdf1711c9a173514a1c7b (patch)
treed0738f41b4b621c932769f2e0af852212973c6a9 /vcl
parent06fe77331d1ad8eb2e5a158bb1cb083daaf1f910 (diff)
Use Core Text font manager instead of deprecated ATS
Change-Id: I660a895a227da3d28a0b410c56f2395961a5bc4f
Diffstat (limited to 'vcl')
-rw-r--r--vcl/coretext/salgdi2.cxx50
1 files changed, 17 insertions, 33 deletions
diff --git a/vcl/coretext/salgdi2.cxx b/vcl/coretext/salgdi2.cxx
index c54391230813..2f7da5bab0e0 100644
--- a/vcl/coretext/salgdi2.cxx
+++ b/vcl/coretext/salgdi2.cxx
@@ -54,11 +54,6 @@ SystemFontList::~SystemFontList( void )
{}
-// ATSUI is deprecated in 10.6 (or already 10.5?)
-#if HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY
-#pragma GCC diagnostic warning "-Wdeprecated-declarations"
-#endif
-
// =======================================================================
ImplMacTextStyle::ImplMacTextStyle( const FontSelectPattern& rReqFont )
@@ -377,22 +372,17 @@ sal_uLong AquaSalGraphics::GetKernPairs( sal_uLong, ImplKernPairData* )
static bool AddTempFontDir( const char* pDir )
{
- FSRef aPathFSRef;
- Boolean bIsDirectory = true;
- OSStatus eStatus = FSPathMakeRef( reinterpret_cast<const UInt8*>(pDir), &aPathFSRef, &bIsDirectory );
- DBG_ASSERTWARNING( (eStatus==noErr) && bIsDirectory, "vcl AddTempFontDir() with invalid directory name!" );
- if( eStatus != noErr )
- return false;
+ CFStringRef rDir = CFStringCreateWithCString(NULL, pDir, kCFStringEncodingUTF8);
+ CFURLRef rDirURL = CFURLCreateWithFileSystemPath(NULL, rDir, kCFURLPOSIXPathStyle, true);
- // TODO: deactivate ATSFontContainerRef when closing app
- ATSFontContainerRef aATSFontContainer;
+ CFErrorRef error;
+ bool success = CTFontManagerRegisterFontsForURL(rDirURL, kCTFontManagerScopeProcess, &error);
- const ATSFontContext eContext = kATSFontContextLocal; // TODO: *Global???
- eStatus = ::ATSFontActivateFromFileReference( &aPathFSRef,
- eContext, kATSFontFormatUnspecified, NULL, kATSOptionFlagsDefault,
- &aATSFontContainer );
- if( eStatus != noErr )
+ if (!success)
+ {
+ CFRelease(error);
return false;
+ }
return true;
}
@@ -454,26 +444,20 @@ bool AquaSalGraphics::AddTempDevFont( ImplDevFontList*,
{
OUString aUSytemPath;
OSL_VERIFY( !osl::FileBase::getSystemPathFromFileURL( rFontFileURL, aUSytemPath ) );
-
- FSRef aNewRef;
- Boolean bIsDirectory = true;
OString aCFileName = OUStringToOString( aUSytemPath, RTL_TEXTENCODING_UTF8 );
- OSStatus eStatus = FSPathMakeRef( (UInt8*)aCFileName.getStr(), &aNewRef, &bIsDirectory );
- DBG_ASSERT( (eStatus==noErr) && !bIsDirectory, "vcl AddTempDevFont() with invalid fontfile name!" );
- if( eStatus != noErr )
- return false;
- ATSFontContainerRef oContainer;
+ CFStringRef rDir = CFStringCreateWithCString(NULL, aCFileName.getStr(), kCFStringEncodingUTF8);
+ CFURLRef rDirURL = CFURLCreateWithFileSystemPath(NULL, rDir, kCFURLPOSIXPathStyle, true);
+
+ CFErrorRef error;
+ bool success = CTFontManagerRegisterFontsForURL(rDirURL, kCTFontManagerScopeProcess, &error);
- const ATSFontContext eContext = kATSFontContextLocal; // TODO: *Global???
- eStatus = ::ATSFontActivateFromFileReference( &aNewRef,
- eContext, kATSFontFormatUnspecified, NULL, kATSOptionFlagsDefault,
- &oContainer );
- if( eStatus != noErr )
+ if (!success)
+ {
+ CFRelease(error);
return false;
+ }
- // TODO: ATSFontDeactivate( oContainer ) when fonts are no longer needed
- // TODO: register new ImplMacFontdata in pFontList
return true;
}