[buffer] Clean up internal state bookkeeping
hb_buffer_reset() was NOT resetting cluster_level. Ouch! Fix that. Part of https://github.com/harfbuzz/harfbuzz/issues/1555
This commit is contained in:
parent
d0c3515ce4
commit
f643b81ffc
|
@ -261,6 +261,7 @@ hb_buffer_t::reset ()
|
|||
hb_unicode_funcs_destroy (unicode);
|
||||
unicode = hb_unicode_funcs_reference (hb_unicode_funcs_get_default ());
|
||||
flags = HB_BUFFER_FLAG_DEFAULT;
|
||||
cluster_level = HB_BUFFER_CLUSTER_LEVEL_DEFAULT;
|
||||
replacement = HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT;
|
||||
invisible = 0;
|
||||
not_found = 0;
|
||||
|
@ -271,11 +272,10 @@ hb_buffer_t::reset ()
|
|||
void
|
||||
hb_buffer_t::clear ()
|
||||
{
|
||||
content_type = HB_BUFFER_CONTENT_TYPE_INVALID;
|
||||
hb_segment_properties_t default_props = HB_SEGMENT_PROPERTIES_DEFAULT;
|
||||
props = default_props;
|
||||
scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT;
|
||||
|
||||
content_type = HB_BUFFER_CONTENT_TYPE_INVALID;
|
||||
successful = true;
|
||||
have_output = false;
|
||||
have_positions = false;
|
||||
|
@ -283,13 +283,15 @@ hb_buffer_t::clear ()
|
|||
idx = 0;
|
||||
len = 0;
|
||||
out_len = 0;
|
||||
out_info = info;
|
||||
|
||||
serial = 0;
|
||||
out_info = info;
|
||||
|
||||
memset (context, 0, sizeof context);
|
||||
memset (context_len, 0, sizeof context_len);
|
||||
|
||||
scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT;
|
||||
serial = 0;
|
||||
|
||||
deallocate_var_all ();
|
||||
}
|
||||
|
||||
|
@ -604,12 +606,11 @@ DEFINE_NULL_INSTANCE (hb_buffer_t) =
|
|||
HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT,
|
||||
0, /* invisible */
|
||||
0, /* not_found */
|
||||
HB_BUFFER_SCRATCH_FLAG_DEFAULT,
|
||||
HB_BUFFER_MAX_LEN_DEFAULT,
|
||||
HB_BUFFER_MAX_OPS_DEFAULT,
|
||||
|
||||
|
||||
HB_BUFFER_CONTENT_TYPE_INVALID,
|
||||
HB_SEGMENT_PROPERTIES_DEFAULT,
|
||||
|
||||
false, /* successful */
|
||||
false, /* have_output */
|
||||
true /* have_positions */
|
||||
|
|
|
@ -87,18 +87,21 @@ struct hb_buffer_t
|
|||
{
|
||||
hb_object_header_t header;
|
||||
|
||||
/* Information about how the text in the buffer should be treated */
|
||||
/*
|
||||
* Information about how the text in the buffer should be treated.
|
||||
*/
|
||||
|
||||
hb_unicode_funcs_t *unicode; /* Unicode functions */
|
||||
hb_buffer_flags_t flags; /* BOT / EOT / etc. */
|
||||
hb_buffer_cluster_level_t cluster_level;
|
||||
hb_codepoint_t replacement; /* U+FFFD or something else. */
|
||||
hb_codepoint_t invisible; /* 0 or something else. */
|
||||
hb_codepoint_t not_found; /* 0 or something else. */
|
||||
hb_buffer_scratch_flags_t scratch_flags; /* Have space-fallback, etc. */
|
||||
unsigned int max_len; /* Maximum allowed len. */
|
||||
int max_ops; /* Maximum allowed operations. */
|
||||
|
||||
/* Buffer contents */
|
||||
/*
|
||||
* Buffer contents
|
||||
*/
|
||||
|
||||
hb_buffer_content_type_t content_type;
|
||||
hb_segment_properties_t props; /* Script, language, direction */
|
||||
|
||||
|
@ -115,8 +118,6 @@ struct hb_buffer_t
|
|||
hb_glyph_info_t *out_info;
|
||||
hb_glyph_position_t *pos;
|
||||
|
||||
unsigned int serial;
|
||||
|
||||
/* Text before / after the main buffer contents.
|
||||
* Always in Unicode, and ordered outward.
|
||||
* Index 0 is for "pre-context", 1 for "post-context". */
|
||||
|
@ -124,6 +125,16 @@ struct hb_buffer_t
|
|||
hb_codepoint_t context[2][CONTEXT_LENGTH];
|
||||
unsigned int context_len[2];
|
||||
|
||||
/*
|
||||
* Not part of content.
|
||||
*/
|
||||
|
||||
hb_buffer_scratch_flags_t scratch_flags; /* Have space-fallback, etc. */
|
||||
unsigned int serial;
|
||||
|
||||
unsigned int max_len; /* Maximum allowed len. */
|
||||
int max_ops; /* Maximum allowed operations. */
|
||||
|
||||
/* Debugging API */
|
||||
#ifndef HB_NO_BUFFER_MESSAGE
|
||||
hb_buffer_message_func_t message_func;
|
||||
|
|
Loading…
Reference in New Issue