[Libreoffice-commits] core.git: vcl/coretext
Caolán McNamara
caolanm at redhat.com
Tue Aug 27 08:45:08 PDT 2013
vcl/coretext/salgdi2.cxx | 56 +++++++++++++++++++++++------------------------
1 file changed, 28 insertions(+), 28 deletions(-)
New commits:
commit 8efbafaf8681d39c8c3674368e02ddd572ba5d32
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Aug 27 16:40:53 2013 +0100
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
diff --git a/vcl/coretext/salgdi2.cxx b/vcl/coretext/salgdi2.cxx
index 778f042..d69c26d 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);
}
// -----------------------------------------------------------------------
More information about the Libreoffice-commits
mailing list