[ENOMEM] Handle immutable buffer in shape_full()
Move the content_type changing to shape_plan_execute() where it belongs. Skip setting if content type is UNKNOWN, which happens with empty buffers only, including the immutable buffer. Alternate fix to https://github.com/harfbuzz/harfbuzz/pull/2606 and https://github.com/harfbuzz/harfbuzz/pull/2625
This commit is contained in:
parent
bbbcad0dbb
commit
e40c0d82e2
|
@ -355,26 +355,12 @@ hb_shape_plan_get_shaper (hb_shape_plan_t *shape_plan)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* hb_shape_plan_execute:
|
||||
* @shape_plan: a shape plan.
|
||||
* @font: a font.
|
||||
* @buffer: a buffer.
|
||||
* @features: (array length=num_features):
|
||||
* @num_features:
|
||||
*
|
||||
*
|
||||
*
|
||||
* Return value:
|
||||
*
|
||||
* Since: 0.9.7
|
||||
**/
|
||||
hb_bool_t
|
||||
hb_shape_plan_execute (hb_shape_plan_t *shape_plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer,
|
||||
const hb_feature_t *features,
|
||||
unsigned int num_features)
|
||||
static bool
|
||||
_hb_shape_plan_execute_internal (hb_shape_plan_t *shape_plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer,
|
||||
const hb_feature_t *features,
|
||||
unsigned int num_features)
|
||||
{
|
||||
DEBUG_MSG_FUNC (SHAPE_PLAN, shape_plan,
|
||||
"num_features=%d shaper_func=%p, shaper_name=%s",
|
||||
|
@ -412,6 +398,35 @@ hb_shape_plan_execute (hb_shape_plan_t *shape_plan,
|
|||
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* hb_shape_plan_execute:
|
||||
* @shape_plan: a shape plan.
|
||||
* @font: a font.
|
||||
* @buffer: a buffer.
|
||||
* @features: (array length=num_features):
|
||||
* @num_features:
|
||||
*
|
||||
*
|
||||
*
|
||||
* Return value:
|
||||
*
|
||||
* Since: 0.9.7
|
||||
**/
|
||||
hb_bool_t
|
||||
hb_shape_plan_execute (hb_shape_plan_t *shape_plan,
|
||||
hb_font_t *font,
|
||||
hb_buffer_t *buffer,
|
||||
const hb_feature_t *features,
|
||||
unsigned int num_features)
|
||||
{
|
||||
bool ret = _hb_shape_plan_execute_internal (shape_plan, font, buffer,
|
||||
features, num_features);
|
||||
|
||||
if (ret && buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE)
|
||||
buffer->content_type = HB_BUFFER_CONTENT_TYPE_GLYPHS;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -132,8 +132,6 @@ hb_shape_full (hb_font_t *font,
|
|||
unsigned int num_features,
|
||||
const char * const *shaper_list)
|
||||
{
|
||||
if (unlikely (hb_object_is_immutable (buffer))) return false;
|
||||
|
||||
hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached2 (font->face, &buffer->props,
|
||||
features, num_features,
|
||||
font->coords, font->num_coords,
|
||||
|
@ -141,8 +139,6 @@ hb_shape_full (hb_font_t *font,
|
|||
hb_bool_t res = hb_shape_plan_execute (shape_plan, font, buffer, features, num_features);
|
||||
hb_shape_plan_destroy (shape_plan);
|
||||
|
||||
if (res)
|
||||
buffer->content_type = HB_BUFFER_CONTENT_TYPE_GLYPHS;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue