diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2010-09-29 17:53:56 -0400 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2010-09-29 17:53:56 -0400 |
commit | 79279751c2808294b9421c62376f5898ae0aa356 (patch) | |
tree | d6d94c5b6234d6c1b7e315914f569eac075faac1 /vcl | |
parent | 49b7f991a509528302d2d1987d3f6c38bd108798 (diff) |
Ported fontconfig-cache-pre-substitution.diff from ooo-build.
Notes
Notes:
split repo tag: libs-gui_linux-build-fridrich-20100930
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/source/gdi/salgdi3.cxx | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx index 6024b66f6010..6e3b2047f900 100644 --- a/vcl/unx/source/gdi/salgdi3.cxx +++ b/vcl/unx/source/gdi/salgdi3.cxx @@ -1993,6 +1993,11 @@ class FcPreMatchSubstititution { public: bool FindFontSubstitute( ImplFontSelectData& ) const; + +private: + typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > + CachedFontMapType; + mutable CachedFontMapType maCachedFontMap; }; class FcGlyphFallbackSubstititution @@ -2188,12 +2193,20 @@ bool FcPreMatchSubstititution::FindFontSubstitute( ImplFontSelectData &rFontSelD || 0 == rFontSelData.maSearchName.CompareIgnoreCaseToAscii( "opensymbol", 10) ) return false; + CachedFontMapType::const_iterator itr = maCachedFontMap.find(rFontSelData.maTargetName); + if (itr != maCachedFontMap.end()) + { + // Cached substitution pair + rFontSelData.maSearchName = itr->second; + return true; + } + rtl::OUString aDummy; const ImplFontSelectData aOut = GetFcSubstitute( rFontSelData, aDummy ); - // TODO: cache the font substitution suggestion - // FC doing it would be preferable because it knows the invariables - // e.g. FC knows the FC rule that all Arial gets replaced by LiberationSans - // whereas we would have to check for every size or attribute + + maCachedFontMap.insert( + CachedFontMapType::value_type(rFontSelData.maTargetName, aOut.maSearchName)); + if( !aOut.maSearchName.Len() ) return false; |