diff options
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc')
-rw-r--r-- | src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc b/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc index 2166173f9e..56e2ea5c19 100644 --- a/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc +++ b/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc @@ -106,7 +106,7 @@ hb_shape_plan_plan (hb_shape_plan_t *shape_plan, * * Return value: (transfer full): * - * Since: 1.0 + * Since: 0.9.7 **/ hb_shape_plan_t * hb_shape_plan_create (hb_face_t *face, @@ -126,9 +126,9 @@ hb_shape_plan_create (hb_face_t *face, if (unlikely (!face)) face = hb_face_get_empty (); - if (unlikely (!props || hb_object_is_inert (face))) + if (unlikely (!props)) return hb_shape_plan_get_empty (); - if (num_user_features && !(features = (hb_feature_t *) malloc (num_user_features * sizeof (hb_feature_t)))) + if (num_user_features && !(features = (hb_feature_t *) calloc (num_user_features, sizeof (hb_feature_t)))) return hb_shape_plan_get_empty (); if (!(shape_plan = hb_object_create<hb_shape_plan_t> ())) { free (features); @@ -158,7 +158,7 @@ hb_shape_plan_create (hb_face_t *face, * * Return value: (transfer full): * - * Since: 1.0 + * Since: 0.9.7 **/ hb_shape_plan_t * hb_shape_plan_get_empty (void) @@ -194,7 +194,7 @@ hb_shape_plan_get_empty (void) * * Return value: (transfer full): * - * Since: 1.0 + * Since: 0.9.7 **/ hb_shape_plan_t * hb_shape_plan_reference (hb_shape_plan_t *shape_plan) @@ -208,7 +208,7 @@ hb_shape_plan_reference (hb_shape_plan_t *shape_plan) * * * - * Since: 1.0 + * Since: 0.9.7 **/ void hb_shape_plan_destroy (hb_shape_plan_t *shape_plan) @@ -236,7 +236,7 @@ hb_shape_plan_destroy (hb_shape_plan_t *shape_plan) * * Return value: * - * Since: 1.0 + * Since: 0.9.7 **/ hb_bool_t hb_shape_plan_set_user_data (hb_shape_plan_t *shape_plan, @@ -257,7 +257,7 @@ hb_shape_plan_set_user_data (hb_shape_plan_t *shape_plan, * * Return value: (transfer none): * - * Since: 1.0 + * Since: 0.9.7 **/ void * hb_shape_plan_get_user_data (hb_shape_plan_t *shape_plan, @@ -279,7 +279,7 @@ hb_shape_plan_get_user_data (hb_shape_plan_t *shape_plan, * * Return value: * - * Since: 1.0 + * Since: 0.9.7 **/ hb_bool_t hb_shape_plan_execute (hb_shape_plan_t *shape_plan, @@ -293,9 +293,13 @@ hb_shape_plan_execute (hb_shape_plan_t *shape_plan, num_features, shape_plan->shaper_func); - if (unlikely (hb_object_is_inert (shape_plan) || - hb_object_is_inert (font) || - hb_object_is_inert (buffer))) + if (unlikely (!buffer->len)) + return true; + + assert (!hb_object_is_inert (buffer)); + assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE); + + if (unlikely (hb_object_is_inert (shape_plan))) return false; assert (shape_plan->face_unsafe == font->face); @@ -396,7 +400,7 @@ hb_non_global_user_features_present (const hb_feature_t *user_features, * * Return value: (transfer full): * - * Since: 1.0 + * Since: 0.9.7 **/ hb_shape_plan_t * hb_shape_plan_create_cached (hb_face_t *face, @@ -453,6 +457,10 @@ retry: hb_shape_plan_t *shape_plan = hb_shape_plan_create (face, props, user_features, num_user_features, shaper_list); + /* Don't add to the cache if face is inert. */ + if (unlikely (hb_object_is_inert (face))) + return shape_plan; + /* Don't add the plan to the cache if there were user features with non-global ranges */ if (hb_non_global_user_features_present (user_features, num_user_features)) @@ -483,7 +491,7 @@ retry: * * Return value: (transfer none): * - * Since: 1.0 + * Since: 0.9.7 **/ const char * hb_shape_plan_get_shaper (hb_shape_plan_t *shape_plan) |