diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-01-20 11:29:37 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-01-20 13:32:33 +0000 |
commit | 40809ce46999e9cedb2fe5db8e9d53ebb6c182bf (patch) | |
tree | 23c94dda89763315783e7e85e77fdd30ca431353 /vcl | |
parent | 20142afafc809890d5e8dcfd4103c46319a488df (diff) |
move OutputDevice:: Clear/Refresh inside AddTempDevFont
and drop now redundant
ImplClearFontData(true);
mpFontCache->Invalidate();
which is done on entry
Change-Id: I217c203980e5fd6a54b85f1b1376ecc2b92181db
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/embeddedfontshelper.cxx | 2 | ||||
-rw-r--r-- | vcl/source/outdev/font.cxx | 21 |
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; } |