Revert "Upstream merge"
[framework/uifw/evas.git] / src / lib / engines / common / evas_font_ot.c
index 22de948..a907831 100644 (file)
@@ -245,17 +245,20 @@ _evas_common_font_ot_unicode_funcs_get(void)
 static void
 _evas_common_font_ot_shape(hb_buffer_t *buffer, RGBA_Font_Int *fi)
 {
-   hb_font_t   *hb_font, *hb_ft_font;
-
-   hb_ft_font = hb_ft_font_create(fi->src->ft.face, NULL);
-   hb_font = hb_font_create_sub_font(hb_ft_font);
+   /* Create hb_font if not previously created */
+   if (!fi->ft.hb_font)
+     {
+        hb_font_t *hb_ft_font;
 
-   hb_font_set_funcs(hb_font, _evas_common_font_ot_font_funcs_get(), fi, NULL);
+        hb_ft_font = hb_ft_font_create(fi->src->ft.face, NULL);
+        fi->ft.hb_font = hb_font_create_sub_font(hb_ft_font);
+        hb_font_destroy(hb_ft_font);
 
-   hb_shape(hb_font, buffer, NULL, 0);
+        hb_font_set_funcs(fi->ft.hb_font,
+              _evas_common_font_ot_font_funcs_get(), fi, NULL);
+     }
 
-   hb_font_destroy(hb_font);
-   hb_font_destroy(hb_ft_font);
+   hb_shape(fi->ft.hb_font, buffer, NULL, 0);
 }
 
 EAPI Eina_Bool
@@ -283,10 +286,19 @@ evas_common_font_ot_populate_text_props(const Eina_Unicode *text,
         slen = len;
      }
 
+#if HB_VERSION_CHECK(0,7,0)
+   buffer = hb_buffer_create(slen);
+#else
    buffer = hb_buffer_create();
+#endif
    hb_buffer_set_unicode_funcs(buffer, _evas_common_font_ot_unicode_funcs_get());
+#if HB_VERSION_CHECK(0,7,0)
    hb_buffer_set_language(buffer, hb_language_from_string(
             evas_common_language_from_locale_get()));
+#else
+   hb_buffer_set_language(buffer, hb_language_from_string(
+            evas_common_language_from_locale_get(), -1));
+#endif
    hb_buffer_set_script(buffer, _evas_script_to_harfbuzz[props->script]);
    hb_buffer_set_direction(buffer,
          (props->bidi.dir == EVAS_BIDI_DIRECTION_RTL) ?