diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-08-27 16:40:53 +0100 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2013-08-27 15:53:38 +0000 |
commit | 31fbd9d8b65c7eb9ad618fd68f331a32760c468e (patch) | |
tree | 11a8eebd280c337e2bc69d554f0a90637572ed03 /vcl | |
parent | ef0a7a309d03c83f59a32595132f3f3e4c9893c0 (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.
(cherry picked from commit 8efbafaf8681d39c8c3674368e02ddd572ba5d32)
Conflicts:
vcl/coretext/salgdi2.cxx
Change-Id: I430c91b48d96fb8d62e3b073898b72cf2b8ddea6
Reviewed-on: https://gerrit.libreoffice.org/5647
Reviewed-by: Thorsten Behrens <tbehrens@suse.com>
Tested-by: Thorsten Behrens <tbehrens@suse.com>
Diffstat (limited to 'vcl')
-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 5cf0f87bd3e8..ed6dd90904f6 100644 --- a/vcl/coretext/salgdi2.cxx +++ b/vcl/coretext/salgdi2.cxx @@ -346,9 +346,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; @@ -363,24 +367,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( "/share/fonts/truetype/" ); - return AddTempFontDir( aBrandFontDir.getStr() ); + AddTempFontDir( aBrandStr + "/share/fonts/truetype/" ); } void AquaSalGraphics::GetDevFontList( ImplDevFontList* pFontList ) @@ -417,23 +433,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); } // ----------------------------------------------------------------------- |