| Index: third_party/harfbuzz-ng/src/hb-buffer-private.hh
|
| diff --git a/third_party/harfbuzz-ng/src/hb-buffer-private.hh b/third_party/harfbuzz-ng/src/hb-buffer-private.hh
|
| index 4077bb391e4eb1cad5c0363d072795b0d9431a34..f5d64f3f819b6d439c926bb20959d03137a433ef 100644
|
| --- a/third_party/harfbuzz-ng/src/hb-buffer-private.hh
|
| +++ b/third_party/harfbuzz-ng/src/hb-buffer-private.hh
|
| @@ -40,15 +40,48 @@
|
| ASSERT_STATIC (sizeof (hb_glyph_info_t) == 20);
|
| ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t));
|
|
|
| -typedef struct _hb_segment_properties_t {
|
| +
|
| +/*
|
| + * hb_segment_properties_t
|
| + */
|
| +
|
| +typedef struct hb_segment_properties_t {
|
| hb_direction_t direction;
|
| hb_script_t script;
|
| hb_language_t language;
|
| ASSERT_POD ();
|
| } hb_segment_properties_t;
|
|
|
| +#define _HB_BUFFER_PROPS_DEFAULT { HB_DIRECTION_INVALID, HB_SCRIPT_INVALID, HB_LANGUAGE_INVALID }
|
| +
|
| +static inline hb_bool_t
|
| +hb_segment_properties_equal (const hb_segment_properties_t *a,
|
| + const hb_segment_properties_t *b)
|
| +{
|
| + return a->direction == b->direction &&
|
| + a->script == b->script &&
|
| + a->language == b->language;
|
| +}
|
|
|
| -struct _hb_buffer_t {
|
| +
|
| +#if 0
|
| +static inline unsigned int
|
| +hb_segment_properties_hash (const hb_segment_properties_t *p)
|
| +{
|
| + /* TODO improve */
|
| + return (unsigned int) p->direction +
|
| + (unsigned int) p->script +
|
| + (intptr_t) (p->language);
|
| +}
|
| +#endif
|
| +
|
| +
|
| +
|
| +/*
|
| + * hb_buffer_t
|
| + */
|
| +
|
| +struct hb_buffer_t {
|
| hb_object_header_t header;
|
| ASSERT_POD ();
|
|
|
| @@ -59,6 +92,8 @@ struct _hb_buffer_t {
|
|
|
| /* Buffer contents */
|
|
|
| + hb_buffer_content_type_t content_type;
|
| +
|
| bool in_error; /* Allocation failed */
|
| bool have_output; /* Whether we have an output buffer going on */
|
| bool have_positions; /* Whether we have positions */
|
| @@ -96,6 +131,7 @@ struct _hb_buffer_t {
|
|
|
| HB_INTERNAL void allocate_var (unsigned int byte_i, unsigned int count, const char *owner);
|
| HB_INTERNAL void deallocate_var (unsigned int byte_i, unsigned int count, const char *owner);
|
| + HB_INTERNAL void assert_var (unsigned int byte_i, unsigned int count, const char *owner);
|
| HB_INTERNAL void deallocate_var_all (void);
|
|
|
| HB_INTERNAL void add (hb_codepoint_t codepoint,
|
| @@ -110,20 +146,34 @@ struct _hb_buffer_t {
|
| HB_INTERNAL void swap_buffers (void);
|
| HB_INTERNAL void clear_output (void);
|
| HB_INTERNAL void clear_positions (void);
|
| - HB_INTERNAL void replace_glyphs_be16 (unsigned int num_in,
|
| - unsigned int num_out,
|
| - const char *glyph_data_be);
|
| +
|
| HB_INTERNAL void replace_glyphs (unsigned int num_in,
|
| unsigned int num_out,
|
| const hb_codepoint_t *glyph_data);
|
| +
|
| HB_INTERNAL void replace_glyph (hb_codepoint_t glyph_index);
|
| /* Makes a copy of the glyph at idx to output and replace glyph_index */
|
| HB_INTERNAL void output_glyph (hb_codepoint_t glyph_index);
|
| + HB_INTERNAL void output_info (hb_glyph_info_t &glyph_info);
|
| /* Copies glyph at idx to output but doesn't advance idx */
|
| HB_INTERNAL void copy_glyph (void);
|
| /* Copies glyph at idx to output and advance idx.
|
| * If there's no output, just advance idx. */
|
| - HB_INTERNAL void next_glyph (void);
|
| + inline void
|
| + next_glyph (void)
|
| + {
|
| + if (have_output)
|
| + {
|
| + if (unlikely (out_info != info || out_len != idx)) {
|
| + if (unlikely (!make_room_for (1, 1))) return;
|
| + out_info[out_len] = info[idx];
|
| + }
|
| + out_len++;
|
| + }
|
| +
|
| + idx++;
|
| + }
|
| +
|
| /* Advance idx without copying to output. */
|
| inline void skip_glyph (void) { idx++; }
|
|
|
| @@ -151,7 +201,7 @@ struct _hb_buffer_t {
|
| HB_INTERNAL bool enlarge (unsigned int size);
|
|
|
| inline bool ensure (unsigned int size)
|
| - { return likely (size <= allocated) ? true : enlarge (size); }
|
| + { return likely (size < allocated) ? true : enlarge (size); }
|
|
|
| HB_INTERNAL bool make_room_for (unsigned int num_in, unsigned int num_out);
|
|
|
| @@ -166,7 +216,8 @@ struct _hb_buffer_t {
|
| HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var)
|
| #define HB_BUFFER_DEALLOCATE_VAR(b, var) \
|
| HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var (), #var)
|
| -
|
| +#define HB_BUFFER_ASSERT_VAR(b, var) \
|
| + HB_BUFFER_XALLOCATE_VAR (b, assert_var, var (), #var)
|
|
|
|
|
| #endif /* HB_BUFFER_PRIVATE_HH */
|
|
|