summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2015-01-24 19:41:33 +0400
committerKonstantin Ritt <ritt.ks@gmail.com>2015-01-25 08:41:05 +0100
commit3de9bc9cb1dc96ea803e6190de9b6fb6fe00e307 (patch)
treeb0754571e5efd71440ecdbd6bea9f1f7c82b6d3e /src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc
parent3c1e16df757888988498a92146ac35ceba83dabf (diff)
Update bundled HarfBuzz-NG to 0.9.38
Most important changes: * Fixes for Arabic, Hangul, Hebrew, Indic, Mandaic, Myanmar, and New Tai Lue shapers. * Fixed out-of-bounds access in Indic shaper. * Build and stability fixes, various optimizations. Change-Id: I4f0e32c017f62fe576bee41a430d3da6d571de80 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc')
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc53
1 files changed, 41 insertions, 12 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc b/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc
index 5ffc6b1362..2166173f9e 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc
@@ -29,6 +29,12 @@
#include "hb-font-private.hh"
#include "hb-buffer-private.hh"
+
+#ifndef HB_DEBUG_SHAPE_PLAN
+#define HB_DEBUG_SHAPE_PLAN (HB_DEBUG+0)
+#endif
+
+
#define HB_SHAPER_IMPLEMENT(shaper) \
HB_SHAPER_DATA_ENSURE_DECLARE(shaper, face) \
HB_SHAPER_DATA_ENSURE_DECLARE(shaper, font)
@@ -42,6 +48,11 @@ hb_shape_plan_plan (hb_shape_plan_t *shape_plan,
unsigned int num_user_features,
const char * const *shaper_list)
{
+ DEBUG_MSG_FUNC (SHAPE_PLAN, shape_plan,
+ "num_features=%d shaper_list=%p",
+ num_user_features,
+ shaper_list);
+
const hb_shaper_pair_t *shapers = _hb_shapers_get ();
#define HB_SHAPER_PLAN(shaper) \
@@ -104,6 +115,12 @@ hb_shape_plan_create (hb_face_t *face,
unsigned int num_user_features,
const char * const *shaper_list)
{
+ DEBUG_MSG_FUNC (SHAPE_PLAN, NULL,
+ "face=%p num_features=%d shaper_list=%p",
+ face,
+ num_user_features,
+ shaper_list);
+
hb_shape_plan_t *shape_plan;
hb_feature_t *features = NULL;
@@ -271,6 +288,11 @@ hb_shape_plan_execute (hb_shape_plan_t *shape_plan,
const hb_feature_t *features,
unsigned int num_features)
{
+ DEBUG_MSG_FUNC (SHAPE_PLAN, shape_plan,
+ "num_features=%d shaper_func=%p",
+ num_features,
+ shape_plan->shaper_func);
+
if (unlikely (hb_object_is_inert (shape_plan) ||
hb_object_is_inert (font) ||
hb_object_is_inert (buffer)))
@@ -383,6 +405,12 @@ hb_shape_plan_create_cached (hb_face_t *face,
unsigned int num_user_features,
const char * const *shaper_list)
{
+ DEBUG_MSG_FUNC (SHAPE_PLAN, NULL,
+ "face=%p num_features=%d shaper_list=%p",
+ face,
+ num_user_features,
+ shaper_list);
+
hb_shape_plan_proposal_t proposal = {
*props,
shaper_list,
@@ -392,25 +420,22 @@ hb_shape_plan_create_cached (hb_face_t *face,
};
if (shaper_list) {
- /* Choose shaper. Adapted from hb_shape_plan_plan(). */
-#define HB_SHAPER_PLAN(shaper) \
- HB_STMT_START { \
- if (hb_##shaper##_shaper_face_data_ensure (face)) \
- proposal.shaper_func = _hb_##shaper##_shape; \
- } HB_STMT_END
-
+ /* Choose shaper. Adapted from hb_shape_plan_plan().
+ * Must choose shaper exactly the same way as that function. */
for (const char * const *shaper_item = shaper_list; *shaper_item; shaper_item++)
if (0)
;
#define HB_SHAPER_IMPLEMENT(shaper) \
- else if (0 == strcmp (*shaper_item, #shaper)) \
- HB_SHAPER_PLAN (shaper);
+ else if (0 == strcmp (*shaper_item, #shaper) && \
+ hb_##shaper##_shaper_face_data_ensure (face)) \
+ { \
+ proposal.shaper_func = _hb_##shaper##_shape; \
+ break; \
+ }
#include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT
-#undef HB_SHAPER_PLAN
-
- if (unlikely (!proposal.shaper_list))
+ if (unlikely (!proposal.shaper_func))
return hb_shape_plan_get_empty ();
}
@@ -419,7 +444,10 @@ retry:
hb_face_t::plan_node_t *cached_plan_nodes = (hb_face_t::plan_node_t *) hb_atomic_ptr_get (&face->shape_plans);
for (hb_face_t::plan_node_t *node = cached_plan_nodes; node; node = node->next)
if (hb_shape_plan_matches (node->shape_plan, &proposal))
+ {
+ DEBUG_MSG_FUNC (SHAPE_PLAN, node->shape_plan, "fulfilled from cache");
return hb_shape_plan_reference (node->shape_plan);
+ }
/* Not found. */
@@ -442,6 +470,7 @@ retry:
free (node);
goto retry;
}
+ DEBUG_MSG_FUNC (SHAPE_PLAN, shape_plan, "inserted into cache");
return hb_shape_plan_reference (shape_plan);
}