[ooo-build-commit] patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Aug 11 13:37:04 PDT 2009


 patches/dev300/apply                                  |    3 +
 patches/dev300/fontconfig-cache-pre-substitution.diff |   36 ++++++++++++++++++
 2 files changed, 39 insertions(+)

New commits:
commit 3702798e93ad4ae5442d022de187ab3e5a125edf
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Aug 11 16:31:19 2009 -0400

    Cache fontconfig's pre-match substitution results.
    
    * patches/dev300/apply:
    * patches/dev300/fontconfig-cache-pre-substitution.diff: cache
      fontconfig's pre-match substitution results to avoid calling
      fontconfig API each and every time.  This drastically improves
      font rendering performance especially when it involves CJK
      fonts. (n#529532)

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 3b5a609..02d3153 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -3164,6 +3164,9 @@ normalize-template-paths-fix.diff, n#512146, thorsten
 # decode hex-encoded unicode chars in URI in Edit Links dialog.
 edit-links-decode-unicode-uri.diff, i#104166, kohei
 
+# cache fontconfig's pre-substitution result for better rendering performance.
+fontconfig-cache-pre-substitution.diff, n#529532, kohei
+
 [ OOXML ]
 oox-pptx-import-fix-placeholder-text-style.diff, n#479834, rodo
 oox-pptx-import-fix-text-body-properties-priority.diff, n#403402, rodo
diff --git a/patches/dev300/fontconfig-cache-pre-substitution.diff b/patches/dev300/fontconfig-cache-pre-substitution.diff
new file mode 100644
index 0000000..3c6dc25
--- /dev/null
+++ b/patches/dev300/fontconfig-cache-pre-substitution.diff
@@ -0,0 +1,36 @@
+diff --git vcl/unx/source/gdi/salgdi3.cxx vcl/unx/source/gdi/salgdi3.cxx
+index 4e165ff..7fc8085 100644
+--- vcl/unx/source/gdi/salgdi3.cxx
++++ vcl/unx/source/gdi/salgdi3.cxx
+@@ -1988,6 +1988,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
+@@ -2116,8 +2121,19 @@ 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 rtl::OUString aOUName = GetFcSubstitute( rFontSelData, aDummy );
++
++    maCachedFontMap.insert(
++        CachedFontMapType::value_type(rFontSelData.maTargetName, aOUName));
++
+     if( !aOUName.getLength() )
+         return false;
+     const String aName( aOUName );


More information about the ooo-build-commit mailing list