[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/generic

Khaled Hosny khaledhosny at eglug.org
Fri Aug 23 21:34:21 PDT 2013


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

New commits:
commit 93e590627587f4023e03338696e35751b5a6ce52
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
    Reviewed-on: https://gerrit.libreoffice.org/5599
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index 9031ab7..833cf4f 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -122,6 +122,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];
@@ -353,8 +356,11 @@ bool HbLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
 
     SAL_INFO("vcl.harfbuzz.layout", "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);
@@ -399,8 +405,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