summaryrefslogtreecommitdiff
path: root/vcl/generic
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-09-03 16:15:18 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-09-03 17:01:38 +0100
commitfeddd3d87077abb2d5435804a9a4859286f6d86f (patch)
treefe5d61ee70ac4f940c33b61bdfca67bbf7b9a000 /vcl/generic
parent402603793360fb058f84e2aa88d5fdcd6131334d (diff)
Refetch fonts if new ones installed or old ones deinstalled
i.e. honour gtk-fontconfig-timestamp so that if we request a font from packagekit to be installed, then we can auto-use it when it appears. Change-Id: Id0d914a3f9cd589d9e8a87bf9be4b6e47de2e191
Diffstat (limited to 'vcl/generic')
-rw-r--r--vcl/generic/fontmanager/fontconfig.cxx19
-rw-r--r--vcl/generic/fontmanager/fontmanager.cxx4
-rw-r--r--vcl/generic/glyphs/glyphcache.cxx7
-rw-r--r--vcl/generic/print/genpspgraphics.cxx5
4 files changed, 31 insertions, 4 deletions
diff --git a/vcl/generic/fontmanager/fontconfig.cxx b/vcl/generic/fontmanager/fontconfig.cxx
index 57a17c94f335..a98e52949e15 100644
--- a/vcl/generic/fontmanager/fontconfig.cxx
+++ b/vcl/generic/fontmanager/fontconfig.cxx
@@ -128,6 +128,8 @@ public:
FcFontSet* getFontSet();
+ void clear();
+
public:
FcResult LocalizedElementFromPattern(FcPattern* pPattern, FcChar8 **family,
const char *elementtype, const char *elementlangtype);
@@ -263,8 +265,7 @@ FcFontSet* FontCfgWrapper::getFontSet()
FontCfgWrapper::~FontCfgWrapper()
{
- if( m_pOutlineSet )
- FcFontSetDestroy( m_pOutlineSet );
+ clear();
//To-Do: get gtk vclplug smoketest to pass
//FcFini();
}
@@ -402,12 +403,24 @@ FcResult FontCfgWrapper::LocalizedElementFromPattern(FcPattern* pPattern, FcChar
return eElementRes;
}
+void FontCfgWrapper::clear()
+{
+ m_aFontNameToLocalized.clear();
+ m_aLocalizedToCanonical.clear();
+ if( m_pOutlineSet )
+ {
+ FcFontSetDestroy( m_pOutlineSet );
+ m_pOutlineSet = NULL;
+ }
+}
+
/*
* PrintFontManager::initFontconfig
*/
void PrintFontManager::initFontconfig()
{
- FontCfgWrapper::get();
+ FontCfgWrapper& rWrapper = FontCfgWrapper::get();
+ rWrapper.clear();
}
namespace
diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx
index 090cabbf107c..8199fc332d69 100644
--- a/vcl/generic/fontmanager/fontmanager.cxx
+++ b/vcl/generic/fontmanager/fontmanager.cxx
@@ -1673,7 +1673,9 @@ void PrintFontManager::initialize()
#endif
}
- // initialize may be called twice in the future
+ // initialize can be called more than once, e.g.
+ // gtk-fontconfig-timestamp changes to reflect new font installed and
+ // PrintFontManager::initialize called again
{
for( ::boost::unordered_map< fontID, PrintFont* >::const_iterator it = m_aFonts.begin(); it != m_aFonts.end(); ++it )
delete (*it).second;
diff --git a/vcl/generic/glyphs/glyphcache.cxx b/vcl/generic/glyphs/glyphcache.cxx
index 923ca476895f..2ed37a79b14c 100644
--- a/vcl/generic/glyphs/glyphcache.cxx
+++ b/vcl/generic/glyphs/glyphcache.cxx
@@ -186,6 +186,13 @@ void GlyphCache::AnnounceFonts( ImplDevFontList* pList ) const
mpFtManager->AnnounceFonts( pList );
}
+void GlyphCache::ClearFontCache()
+{
+ InvalidateAllGlyphs();
+ if (mpFtManager)
+ mpFtManager->ClearFontList();
+}
+
// -----------------------------------------------------------------------
ServerFont* GlyphCache::CacheFont( const FontSelectPattern& rFontSelData )
diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx
index 78a6c1e046b6..c71103377ddb 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -912,6 +912,11 @@ void GenPspGraphics::GetDevFontList( ImplDevFontList *pList )
SalGenericInstance::RegisterFontSubstitutors( pList );
}
+void GenPspGraphics::ClearDevFontCache()
+{
+ GlyphCache::GetInstance().ClearFontCache();
+}
+
void GenPspGraphics::GetDevFontSubstList( OutputDevice* pOutDev )
{
const psp::PrinterInfo& rInfo = psp::PrinterInfoManager::get().getPrinterInfo( m_pJobData->m_aPrinterName );