summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/source/gdi/embeddedfontshelper.cxx2
-rw-r--r--vcl/source/outdev/font.cxx21
2 files changed, 19 insertions, 4 deletions
diff --git a/vcl/source/gdi/embeddedfontshelper.cxx b/vcl/source/gdi/embeddedfontshelper.cxx
index cd3e43db2c68..037cfcf9d0a0 100644
--- a/vcl/source/gdi/embeddedfontshelper.cxx
+++ b/vcl/source/gdi/embeddedfontshelper.cxx
@@ -181,9 +181,7 @@ OUString EmbeddedFontsHelper::fileUrlForTemporaryFont( const OUString& fontName,
void EmbeddedFontsHelper::activateFont( const OUString& fontName, const OUString& fileUrl )
{
OutputDevice *pDevice = Application::GetDefaultDevice();
- OutputDevice::ImplClearAllFontData(true);
pDevice->AddTempDevFont(fileUrl, fontName);
- OutputDevice::ImplRefreshAllFontData(true);
}
// Check if it's (legally) allowed to embed the font file into a document
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 769eca76a457..62dcfc59f60a 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -140,8 +140,26 @@ Size OutputDevice::GetDevFontSize( const vcl::Font& rFont, int nSizeIndex ) cons
return aSize;
}
+namespace
+{
+ struct UpdateFontsGuard
+ {
+ UpdateFontsGuard()
+ {
+ OutputDevice::ImplClearAllFontData(true);
+ }
+
+ ~UpdateFontsGuard()
+ {
+ OutputDevice::ImplRefreshAllFontData(true);
+ }
+ };
+}
+
bool OutputDevice::AddTempDevFont( const OUString& rFileURL, const OUString& rFontName )
{
+ UpdateFontsGuard aUpdateFontsGuard;
+
ImplInitFontList();
if( !mpGraphics && !AcquireGraphics() )
@@ -154,8 +172,7 @@ bool OutputDevice::AddTempDevFont( const OUString& rFileURL, const OUString& rFo
if( mpAlphaVDev )
mpAlphaVDev->AddTempDevFont( rFileURL, rFontName );
- ImplClearFontData(true);
- mpFontCache->Invalidate();
+ OutputDevice::ImplRefreshAllFontData(true);
return true;
}