[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - 2 commits - vcl/coretext

Khaled Hosny khaledhosny at eglug.org
Mon Jun 3 15:01:47 PDT 2013


 vcl/coretext/salgdi2.cxx |   87 +++++++++--------------------------------------
 1 file changed, 17 insertions(+), 70 deletions(-)

New commits:
commit eddf277c992b80282e0b49325b3138de5a3a2509
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Mon Jun 3 23:01:56 2013 +0200

    Drop ENABLE_CORETEXT
    
    This file is Core Text only already.
    
    Change-Id: Ic4c1f44296eaae582091e515d3ca1b4aa227301e

diff --git a/vcl/coretext/salgdi2.cxx b/vcl/coretext/salgdi2.cxx
index ba076a7..2f7da5b 100644
--- a/vcl/coretext/salgdi2.cxx
+++ b/vcl/coretext/salgdi2.cxx
@@ -38,11 +38,7 @@
 
 #include "coretext/salgdi2.h"
 #include "aqua/salframe.h"
-#ifdef ENABLE_CORETEXT
 #include "ctfonts.hxx"
-#else
-#include "atsfonts.hxx"
-#endif
 
 #include "fontsubset.hxx"
 #include "impfont.hxx"
@@ -426,15 +422,9 @@ void AquaSalGraphics::GetDevFontList( ImplDevFontList* pFontList )
     // through it as should be all event handlers
 
     SalData* pSalData = GetSalData();
-#ifdef ENABLE_CORETEXT
     SystemFontList* GetCoretextFontList(void); // forward declaration
     if( !pSalData->mpFontList )
         pSalData->mpFontList = GetCoretextFontList();
-#else
-    SystemFontList* GetAtsFontList(void);      // forward declaration
-    if( !pSalData->mpFontList )
-        pSalData->mpFontList = GetAtsFontList();
-#endif
 
     // Copy all PhysicalFontFace objects contained in the SystemFontList
     pSalData->mpFontList->AnnounceFonts( *pFontList );
@@ -854,33 +844,6 @@ SystemFontData AquaSalGraphics::GetSysFontData( int /* nFallbacklevel */ ) const
     SystemFontData aSysFontData;
     aSysFontData.nSize = sizeof( SystemFontData );
 
-#ifndef ENABLE_CORETEXT
-    // NOTE: Native ATSU font fallbacks are used, not the VCL fallbacks.
-    ATSUFontID fontId;
-    OSStatus err;
-    err = ATSUGetAttribute( maATSUStyle, kATSUFontTag, sizeof(fontId), &fontId, 0 );
-    if (err) fontId = 0;
-    aSysFontData.aATSUFontID = (void *) fontId;
-
-    Boolean bFbold;
-    err = ATSUGetAttribute( maATSUStyle, kATSUQDBoldfaceTag, sizeof(bFbold), &bFbold, 0 );
-    if (err) bFbold = FALSE;
-    aSysFontData.bFakeBold = (bool) bFbold;
-
-    Boolean bFItalic;
-    err = ATSUGetAttribute( maATSUStyle, kATSUQDItalicTag, sizeof(bFItalic), &bFItalic, 0 );
-    if (err) bFItalic = FALSE;
-    aSysFontData.bFakeItalic = (bool) bFItalic;
-
-    ATSUVerticalCharacterType aVerticalCharacterType;
-    err = ATSUGetAttribute( maATSUStyle, kATSUVerticalCharacterTag, sizeof(aVerticalCharacterType), &aVerticalCharacterType, 0 );
-    if (!err && aVerticalCharacterType == kATSUStronglyVertical) {
-        aSysFontData.bVerticalCharacterType = true;
-    } else {
-        aSysFontData.bVerticalCharacterType = false;
-    }
-#endif
-
     aSysFontData.bAntialias = !mbNonAntialiasedText;
 
     return aSysFontData;
commit b0dc4032e746575cc3a66155782a57774890e94d
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Mon Jun 3 23:55:58 2013 +0200

    Use Core Text font manager instead of deprecated ATS
    
    Change-Id: I660a895a227da3d28a0b410c56f2395961a5bc4f

diff --git a/vcl/coretext/salgdi2.cxx b/vcl/coretext/salgdi2.cxx
index 74c906f..ba076a7 100644
--- a/vcl/coretext/salgdi2.cxx
+++ b/vcl/coretext/salgdi2.cxx
@@ -58,11 +58,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 )
@@ -381,22 +376,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;
 }
@@ -464,26 +454,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;
 }
 


More information about the Libreoffice-commits mailing list