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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 /* | 42 /* |
43 * hb_buffer_t | 43 * hb_buffer_t |
44 */ | 44 */ |
45 | 45 |
46 struct hb_buffer_t { | 46 struct hb_buffer_t { |
47 hb_object_header_t header; | 47 hb_object_header_t header; |
48 ASSERT_POD (); | 48 ASSERT_POD (); |
49 | 49 |
50 /* Information about how the text in the buffer should be treated */ | 50 /* Information about how the text in the buffer should be treated */ |
51 | |
52 hb_unicode_funcs_t *unicode; /* Unicode functions */ | 51 hb_unicode_funcs_t *unicode; /* Unicode functions */ |
53 hb_segment_properties_t props; /* Script, language, direction */ | |
54 hb_buffer_flags_t flags; /* BOT / EOT / etc. */ | 52 hb_buffer_flags_t flags; /* BOT / EOT / etc. */ |
55 hb_codepoint_t replacement; /* U+FFFD or something else. */ | 53 hb_codepoint_t replacement; /* U+FFFD or something else. */ |
56 | 54 |
57 /* Buffer contents */ | 55 /* Buffer contents */ |
58 | |
59 hb_buffer_content_type_t content_type; | 56 hb_buffer_content_type_t content_type; |
| 57 hb_segment_properties_t props; /* Script, language, direction */ |
60 | 58 |
61 bool in_error; /* Allocation failed */ | 59 bool in_error; /* Allocation failed */ |
62 bool have_output; /* Whether we have an output buffer going on */ | 60 bool have_output; /* Whether we have an output buffer going on */ |
63 bool have_positions; /* Whether we have positions */ | 61 bool have_positions; /* Whether we have positions */ |
64 | 62 |
65 unsigned int idx; /* Cursor into ->info and ->pos arrays */ | 63 unsigned int idx; /* Cursor into ->info and ->pos arrays */ |
66 unsigned int len; /* Length of ->info and ->pos arrays */ | 64 unsigned int len; /* Length of ->info and ->pos arrays */ |
67 unsigned int out_len; /* Length of ->out array if have_output */ | 65 unsigned int out_len; /* Length of ->out array if have_output */ |
68 | 66 |
69 unsigned int allocated; /* Length of allocated arrays */ | 67 unsigned int allocated; /* Length of allocated arrays */ |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 unsigned int end); | 174 unsigned int end); |
177 HB_INTERNAL void merge_out_clusters (unsigned int start, | 175 HB_INTERNAL void merge_out_clusters (unsigned int start, |
178 unsigned int end); | 176 unsigned int end); |
179 | 177 |
180 /* Internal methods */ | 178 /* Internal methods */ |
181 HB_INTERNAL bool enlarge (unsigned int size); | 179 HB_INTERNAL bool enlarge (unsigned int size); |
182 | 180 |
183 inline bool ensure (unsigned int size) | 181 inline bool ensure (unsigned int size) |
184 { return likely (!size || size < allocated) ? true : enlarge (size); } | 182 { return likely (!size || size < allocated) ? true : enlarge (size); } |
185 | 183 |
| 184 inline bool ensure_inplace (unsigned int size) |
| 185 { return likely (!size || size < allocated); } |
| 186 |
186 HB_INTERNAL bool make_room_for (unsigned int num_in, unsigned int num_out); | 187 HB_INTERNAL bool make_room_for (unsigned int num_in, unsigned int num_out); |
187 HB_INTERNAL bool shift_forward (unsigned int count); | 188 HB_INTERNAL bool shift_forward (unsigned int count); |
188 | 189 |
189 typedef long scratch_buffer_t; | 190 typedef long scratch_buffer_t; |
190 HB_INTERNAL scratch_buffer_t *get_scratch_buffer (unsigned int *size); | 191 HB_INTERNAL scratch_buffer_t *get_scratch_buffer (unsigned int *size); |
191 | 192 |
192 inline void clear_context (unsigned int side) { context_len[side] = 0; } | 193 inline void clear_context (unsigned int side) { context_len[side] = 0; } |
193 }; | 194 }; |
194 | 195 |
195 | 196 |
196 #define HB_BUFFER_XALLOCATE_VAR(b, func, var, owner) \ | 197 #define HB_BUFFER_XALLOCATE_VAR(b, func, var, owner) \ |
197 b->func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \ | 198 b->func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \ |
198 sizeof (b->info[0].var), owner) | 199 sizeof (b->info[0].var), owner) |
199 #define HB_BUFFER_ALLOCATE_VAR(b, var) \ | 200 #define HB_BUFFER_ALLOCATE_VAR(b, var) \ |
200 HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var) | 201 HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var) |
201 #define HB_BUFFER_DEALLOCATE_VAR(b, var) \ | 202 #define HB_BUFFER_DEALLOCATE_VAR(b, var) \ |
202 HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var (), #var) | 203 HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var (), #var) |
203 #define HB_BUFFER_ASSERT_VAR(b, var) \ | 204 #define HB_BUFFER_ASSERT_VAR(b, var) \ |
204 HB_BUFFER_XALLOCATE_VAR (b, assert_var, var (), #var) | 205 HB_BUFFER_XALLOCATE_VAR (b, assert_var, var (), #var) |
205 | 206 |
206 | 207 |
207 #endif /* HB_BUFFER_PRIVATE_HH */ | 208 #endif /* HB_BUFFER_PRIVATE_HH */ |
OLD | NEW |