[Libreoffice-commits] core.git: vcl/generic

Khaled Hosny khaledhosny at eglug.org
Thu Aug 22 14:01:11 PDT 2013


 vcl/generic/glyphs/gcach_layout.cxx |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 94a742fbc092eb75dbcffcbce0ac96679c90add4
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Thu Aug 22 22:57:54 2013 +0200

    Don't re-create Unicode and font functions for every text run
    
    Change-Id: I35ba21d753adfc619656d4473b214485dc00faba

diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index cc22bad..fd3ca36 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -137,6 +137,9 @@ std::ostream &operator <<(std::ostream& s, ServerFont* pFont)
     return s;
 }
 
+static hb_font_funcs_t* pHbFontFuncs = NULL;
+static hb_unicode_funcs_t* pHbUnicodeFuncs = NULL;
+
 static hb_blob_t *getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pUserData)
 {
     char pTagName[5];
@@ -368,8 +371,11 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
 
     SAL_INFO("vcl.harfbuzz", "layout(" << this << ",rArgs=" << rArgs << ")");
 
+    if (pHbFontFuncs == NULL)
+        pHbFontFuncs = getFontFuncs();
+
     hb_font_t *pHbFont = hb_font_create(mpHbFace);
-    hb_font_set_funcs(pHbFont, getFontFuncs(), &rFont, NULL);
+    hb_font_set_funcs(pHbFont, pHbFontFuncs, &rFont, NULL);
     hb_font_set_scale(pHbFont,
             ((uint64_t) aFtFace->size->metrics.x_scale * (uint64_t) fUnitsPerEM) >> 16,
             ((uint64_t) aFtFace->size->metrics.y_scale * (uint64_t) fUnitsPerEM) >> 16);
@@ -414,8 +420,11 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
         LanguageTag aLangTag(rArgs.meLanguage);
         OString sLanguage = OUStringToOString(aLangTag.getLanguage(), RTL_TEXTENCODING_UTF8);
 
+        if (pHbUnicodeFuncs == NULL)
+            pHbUnicodeFuncs = getUnicodeFuncs();
+
         hb_buffer_t *pHbBuffer = hb_buffer_create();
-        hb_buffer_set_unicode_funcs(pHbBuffer, getUnicodeFuncs());
+        hb_buffer_set_unicode_funcs(pHbBuffer, pHbUnicodeFuncs);
         hb_buffer_set_direction(pHbBuffer, bRightToLeft ? HB_DIRECTION_RTL: HB_DIRECTION_LTR);
         hb_buffer_set_script(pHbBuffer, hb_icu_script_to_script(eScriptCode));
         hb_buffer_set_language(pHbBuffer, hb_language_from_string(sLanguage.getStr(), -1));


More information about the Libreoffice-commits mailing list