[ooo-build-commit] .: vcl/unx

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Sep 29 14:54:55 PDT 2010


 vcl/unx/source/gdi/salgdi3.cxx |   21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

New commits:
commit eb660a1b9ecbdae6535d521be545910adff4e9f2
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Sep 29 17:53:56 2010 -0400

    Ported fontconfig-cache-pre-substitution.diff from ooo-build.

diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index b9ac7b6..fc89fa7 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;
 


More information about the ooo-build-commit mailing list