diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-09-07 14:33:54 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-09-07 14:37:56 +0200 |
commit | fc169270eaeb8156d40740cd088cd8ed958ea99c (patch) | |
tree | 368c844394526157226afd4a73dbebb0a9ccfc2f /vcl/generic | |
parent | e1276e83e0e914eab8966a189948d2238c82a1b6 (diff) |
move the code for adding temporary fonts to a separate class
I'm a bit confused on how this stuff is separated between platforms,
so better do it this way.
Change-Id: I2dbd9baef587c81ee37b509bde272ef970f5b118
Diffstat (limited to 'vcl/generic')
-rw-r--r-- | vcl/generic/fontmanager/fontmanager.cxx | 45 |
1 files changed, 3 insertions, 42 deletions
diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx index 7b9294aeecdf..209970d7cd5f 100644 --- a/vcl/generic/fontmanager/fontmanager.cxx +++ b/vcl/generic/fontmanager/fontmanager.cxx @@ -43,8 +43,7 @@ #include "vcl/fontmanager.hxx" #include "vcl/strhelper.hxx" #include "vcl/ppdparser.hxx" -#include <vcl/svapp.hxx> -#include <vcl/outdev.hxx> +#include <vcl/temporaryfonts.hxx> #include "tools/urlobj.hxx" #include "tools/stream.hxx" @@ -53,7 +52,6 @@ #include "osl/file.hxx" #include "osl/process.h" -#include <rtl/bootstrap.hxx> #include "rtl/tencinfo.h" #include "rtl/ustrbuf.hxx" #include "rtl/strbuf.hxx" @@ -1037,7 +1035,7 @@ PrintFontManager::~PrintFontManager() delete m_pAtoms; if( m_pFontCache ) delete m_pFontCache; - cleanTemporaryFonts(); + TemporaryFonts::clear(); } // ------------------------------------------------------------------------- @@ -1664,7 +1662,7 @@ void PrintFontManager::initialize() CALLGRIND_ZERO_STATS(); #endif - cleanTemporaryFonts(); + TemporaryFonts::clear(); long aDirEntBuffer[ (sizeof(struct dirent)+_PC_NAME_MAX)+1 ]; @@ -3063,41 +3061,4 @@ bool PrintFontManager::readOverrideMetrics() return true; } -void PrintFontManager::cleanTemporaryFonts() -{ - OUString path = "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}"; - rtl::Bootstrap::expandMacros( path ); - path += "/user/temp/fonts/"; - osl::Directory dir( path ); - dir.reset(); - for(;;) - { - osl::DirectoryItem item; - if( dir.getNextItem( item ) != osl::Directory::E_None ) - break; - osl::FileStatus status( osl_FileStatus_Mask_FileURL ); - if( item.getFileStatus( status ) == osl::File::E_None ) - osl::File::remove( status.getFileURL()); - } -} - -OUString PrintFontManager::fileUrlForTemporaryFont( const OUString& fontName, const char* fontStyle ) -{ - OUString path = "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE( "bootstrap") "::UserInstallation}"; - rtl::Bootstrap::expandMacros( path ); - path += "/user/temp/fonts/"; - osl::Directory::createPath( path ); - OUString filename = fontName; - filename += OStringToOUString( fontStyle, RTL_TEXTENCODING_ASCII_US ); - filename += ".ttf"; // TODO is it always ttf? - return path + filename; -} - -void PrintFontManager::activateTemporaryFont( const OUString& fontName, const OUString& fileUrl ) -{ - OutputDevice *pDevice = Application::GetDefaultDevice(); - pDevice->AddTempDevFont( fileUrl, fontName ); - pDevice->ImplUpdateAllFontData( true ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |