diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-08-27 16:40:53 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-08-27 16:44:45 +0100 |
commit | 8efbafaf8681d39c8c3674368e02ddd572ba5d32 (patch) | |
tree | 29b0f5ed6432045d042ff1d532d64b63b588498b | |
parent | 1b7ac34ea6c1ee8b06ef4cb2ac1791b70189e5cf (diff) |
Related: fdo#68192 register bundled fonts
We have to register them one at a time, like windows, this means we detect our
bundled opensymbol which makes the "format->bullets and numbering" preview work
again.
Doesn't however fix fdo#68192 yet, more magic smoke required.
Change-Id: I430c91b48d96fb8d62e3b073898b72cf2b8ddea6
-rw-r--r-- | vcl/coretext/salgdi2.cxx | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/vcl/coretext/salgdi2.cxx b/vcl/coretext/salgdi2.cxx index 778f0426ceaf..d69c26d66278 100644 --- a/vcl/coretext/salgdi2.cxx +++ b/vcl/coretext/salgdi2.cxx @@ -348,9 +348,13 @@ sal_uLong AquaSalGraphics::GetKernPairs( sal_uLong, ImplKernPairData* ) // ----------------------------------------------------------------------- -static bool AddTempFontDir( const char* pDir ) +static bool AddTempDevFont(const OUString& rFontFileURL) { - CFStringRef rDir = CFStringCreateWithCString(NULL, pDir, kCFStringEncodingUTF8); + OUString aUSytemPath; + OSL_VERIFY( !osl::FileBase::getSystemPathFromFileURL( rFontFileURL, aUSytemPath ) ); + OString aCFileName = OUStringToOString( aUSytemPath, RTL_TEXTENCODING_UTF8 ); + + CFStringRef rDir = CFStringCreateWithCString(NULL, aCFileName.getStr(), kCFStringEncodingUTF8); CFURLRef rDirURL = CFURLCreateWithFileSystemPath(NULL, rDir, kCFURLPOSIXPathStyle, true); CFErrorRef error; @@ -365,24 +369,36 @@ static bool AddTempFontDir( const char* pDir ) return true; } -static bool AddLocalTempFontDirs( void ) +static void AddTempFontDir( const OUString &rFontDirUrl ) +{ + osl::Directory aFontDir( rFontDirUrl ); + osl::FileBase::RC rcOSL = aFontDir.open(); + if( rcOSL == osl::FileBase::E_None ) + { + osl::DirectoryItem aDirItem; + + while( aFontDir.getNextItem( aDirItem, 10 ) == osl::FileBase::E_None ) + { + osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileURL ); + rcOSL = aDirItem.getFileStatus( aFileStatus ); + if ( rcOSL == osl::FileBase::E_None ) + AddTempDevFont(aFileStatus.getFileURL()); + } + } +} + +static void AddLocalTempFontDirs() { static bool bFirst = true; if( !bFirst ) - return false; + return; bFirst = false; // add private font files OUString aBrandStr( "$BRAND_BASE_DIR" ); rtl_bootstrap_expandMacros( &aBrandStr.pData ); - OUString aBrandSysPath; - OSL_VERIFY( osl_getSystemPathFromFileURL( aBrandStr.pData, &aBrandSysPath.pData ) == osl_File_E_None ); - - OStringBuffer aBrandFontDir( aBrandSysPath.getLength()*2 ); - aBrandFontDir.append( OUStringToOString( aBrandSysPath, RTL_TEXTENCODING_UTF8 ) ); - aBrandFontDir.append( "/" LIBO_SHARE_FOLDER "/fonts/truetype/" ); - return AddTempFontDir( aBrandFontDir.getStr() ); + AddTempFontDir( aBrandStr + "/" LIBO_SHARE_FOLDER "/fonts/truetype/" ); } void AquaSalGraphics::GetDevFontList( ImplDevFontList* pFontList ) @@ -419,23 +435,7 @@ void AquaSalGraphics::ClearDevFontCache() bool AquaSalGraphics::AddTempDevFont( ImplDevFontList*, const OUString& rFontFileURL, const OUString& /*rFontName*/ ) { - OUString aUSytemPath; - OSL_VERIFY( !osl::FileBase::getSystemPathFromFileURL( rFontFileURL, aUSytemPath ) ); - OString aCFileName = OUStringToOString( aUSytemPath, RTL_TEXTENCODING_UTF8 ); - - CFStringRef rDir = CFStringCreateWithCString(NULL, aCFileName.getStr(), kCFStringEncodingUTF8); - CFURLRef rDirURL = CFURLCreateWithFileSystemPath(NULL, rDir, kCFURLPOSIXPathStyle, true); - - CFErrorRef error; - bool success = CTFontManagerRegisterFontsForURL(rDirURL, kCTFontManagerScopeProcess, &error); - - if (!success) - { - CFRelease(error); - return false; - } - - return true; + return ::AddTempDevFont(rFontFileURL); } // ----------------------------------------------------------------------- |