| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright © 1998-2004 David Turner and Werner Lemberg | 2 * Copyright © 1998-2004 David Turner and Werner Lemberg |
| 3 * Copyright © 2004,2007,2009,2010 Red Hat, Inc. | 3 * Copyright © 2004,2007,2009,2010 Red Hat, Inc. |
| 4 * Copyright © 2011,2012 Google, Inc. | 4 * Copyright © 2011,2012 Google, Inc. |
| 5 * | 5 * |
| 6 * This is part of HarfBuzz, a text shaping library. | 6 * This is part of HarfBuzz, a text shaping library. |
| 7 * | 7 * |
| 8 * Permission is hereby granted, without written agreement and without | 8 * Permission is hereby granted, without written agreement and without |
| 9 * license or royalty fees, to use, copy, modify, and distribute this | 9 * license or royalty fees, to use, copy, modify, and distribute this |
| 10 * software and its documentation for any purpose, provided that the | 10 * software and its documentation for any purpose, provided that the |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 uint8_t allocated_var_bytes[8]; | 117 uint8_t allocated_var_bytes[8]; |
| 118 const char *allocated_var_owner[8]; | 118 const char *allocated_var_owner[8]; |
| 119 | 119 |
| 120 /* Text before / after the main buffer contents. | 120 /* Text before / after the main buffer contents. |
| 121 * Always in Unicode, and ordered outward. | 121 * Always in Unicode, and ordered outward. |
| 122 * Index 0 is for "pre-context", 1 for "post-context". */ | 122 * Index 0 is for "pre-context", 1 for "post-context". */ |
| 123 static const unsigned int CONTEXT_LENGTH = 5; | 123 static const unsigned int CONTEXT_LENGTH = 5; |
| 124 hb_codepoint_t context[2][CONTEXT_LENGTH]; | 124 hb_codepoint_t context[2][CONTEXT_LENGTH]; |
| 125 unsigned int context_len[2]; | 125 unsigned int context_len[2]; |
| 126 | 126 |
| 127 /* Debugging */ |
| 128 hb_buffer_message_func_t message_func; |
| 129 void *message_data; |
| 130 hb_destroy_func_t message_destroy; |
| 131 |
| 127 | 132 |
| 128 /* Methods */ | 133 /* Methods */ |
| 129 | 134 |
| 130 HB_INTERNAL void reset (void); | 135 HB_INTERNAL void reset (void); |
| 131 HB_INTERNAL void clear (void); | 136 HB_INTERNAL void clear (void); |
| 132 | 137 |
| 133 inline unsigned int backtrack_len (void) const | 138 inline unsigned int backtrack_len (void) const |
| 134 { return have_output? out_len : idx; } | 139 { return have_output? out_len : idx; } |
| 135 inline unsigned int lookahead_len (void) const | 140 inline unsigned int lookahead_len (void) const |
| 136 { return len - idx; } | 141 { return len - idx; } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 231 |
| 227 HB_INTERNAL bool make_room_for (unsigned int num_in, unsigned int num_out); | 232 HB_INTERNAL bool make_room_for (unsigned int num_in, unsigned int num_out); |
| 228 HB_INTERNAL bool shift_forward (unsigned int count); | 233 HB_INTERNAL bool shift_forward (unsigned int count); |
| 229 | 234 |
| 230 typedef long scratch_buffer_t; | 235 typedef long scratch_buffer_t; |
| 231 HB_INTERNAL scratch_buffer_t *get_scratch_buffer (unsigned int *size); | 236 HB_INTERNAL scratch_buffer_t *get_scratch_buffer (unsigned int *size); |
| 232 | 237 |
| 233 inline void clear_context (unsigned int side) { context_len[side] = 0; } | 238 inline void clear_context (unsigned int side) { context_len[side] = 0; } |
| 234 | 239 |
| 235 HB_INTERNAL void sort (unsigned int start, unsigned int end, int(*compar)(cons
t hb_glyph_info_t *, const hb_glyph_info_t *)); | 240 HB_INTERNAL void sort (unsigned int start, unsigned int end, int(*compar)(cons
t hb_glyph_info_t *, const hb_glyph_info_t *)); |
| 241 |
| 242 inline bool messaging (void) { return unlikely (message_func); } |
| 243 inline bool message (hb_font_t *font, const char *fmt, ...) HB_PRINTF_FUNC(3,
4) |
| 244 { |
| 245 if (!messaging ()) |
| 246 return true; |
| 247 va_list ap; |
| 248 va_start (ap, fmt); |
| 249 bool ret = message_impl (font, fmt, ap); |
| 250 va_end (ap); |
| 251 return ret; |
| 252 } |
| 253 HB_INTERNAL bool message_impl (hb_font_t *font, const char *fmt, va_list ap) H
B_PRINTF_FUNC(3, 0); |
| 236 }; | 254 }; |
| 237 | 255 |
| 238 | 256 |
| 239 #define HB_BUFFER_XALLOCATE_VAR(b, func, var, owner) \ | 257 #define HB_BUFFER_XALLOCATE_VAR(b, func, var, owner) \ |
| 240 b->func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \ | 258 b->func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \ |
| 241 sizeof (b->info[0].var), owner) | 259 sizeof (b->info[0].var), owner) |
| 242 #define HB_BUFFER_ALLOCATE_VAR(b, var) \ | 260 #define HB_BUFFER_ALLOCATE_VAR(b, var) \ |
| 243 HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var) | 261 HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var) |
| 244 #define HB_BUFFER_DEALLOCATE_VAR(b, var) \ | 262 #define HB_BUFFER_DEALLOCATE_VAR(b, var) \ |
| 245 HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var (), #var) | 263 HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var (), #var) |
| 246 #define HB_BUFFER_ASSERT_VAR(b, var) \ | 264 #define HB_BUFFER_ASSERT_VAR(b, var) \ |
| 247 HB_BUFFER_XALLOCATE_VAR (b, assert_var, var (), #var) | 265 HB_BUFFER_XALLOCATE_VAR (b, assert_var, var (), #var) |
| 248 | 266 |
| 249 | 267 |
| 250 #endif /* HB_BUFFER_PRIVATE_HH */ | 268 #endif /* HB_BUFFER_PRIVATE_HH */ |
| OLD | NEW |