OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2011 Martin Hosken | 2 * Copyright © 2011 Martin Hosken |
3 * Copyright © 2011 SIL International | 3 * Copyright © 2011 SIL International |
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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 if (unlikely (!glyph_count)) { | 267 if (unlikely (!glyph_count)) { |
268 if (feats) gr_featureval_destroy (feats); | 268 if (feats) gr_featureval_destroy (feats); |
269 gr_seg_destroy (seg); | 269 gr_seg_destroy (seg); |
270 return false; | 270 return false; |
271 } | 271 } |
272 | 272 |
273 scratch = buffer->get_scratch_buffer (&scratch_size); | 273 scratch = buffer->get_scratch_buffer (&scratch_size); |
274 while ((DIV_CEIL (sizeof (hb_graphite2_cluster_t) * buffer->len, sizeof (*scra
tch)) + | 274 while ((DIV_CEIL (sizeof (hb_graphite2_cluster_t) * buffer->len, sizeof (*scra
tch)) + |
275 DIV_CEIL (sizeof (hb_codepoint_t) * glyph_count, sizeof (*scratch))) >
scratch_size) | 275 DIV_CEIL (sizeof (hb_codepoint_t) * glyph_count, sizeof (*scratch))) >
scratch_size) |
276 { | 276 { |
277 buffer->ensure (buffer->allocated * 2); | 277 if (unlikely (!buffer->ensure (buffer->allocated * 2))) |
278 if (unlikely (buffer->in_error)) { | 278 { |
279 if (feats) gr_featureval_destroy (feats); | 279 if (feats) gr_featureval_destroy (feats); |
280 gr_seg_destroy (seg); | 280 gr_seg_destroy (seg); |
281 return false; | 281 return false; |
282 } | 282 } |
283 scratch = buffer->get_scratch_buffer (&scratch_size); | 283 scratch = buffer->get_scratch_buffer (&scratch_size); |
284 } | 284 } |
285 | 285 |
286 #define ALLOCATE_ARRAY(Type, name, len) \ | 286 #define ALLOCATE_ARRAY(Type, name, len) \ |
287 Type *name = (Type *) scratch; \ | 287 Type *name = (Type *) scratch; \ |
288 { \ | 288 { \ |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 pPos[-1].x_advance += gr_seg_advance_X(seg) - curradvx; | 367 pPos[-1].x_advance += gr_seg_advance_X(seg) - curradvx; |
368 | 368 |
369 if (HB_DIRECTION_IS_BACKWARD (buffer->props.direction)) | 369 if (HB_DIRECTION_IS_BACKWARD (buffer->props.direction)) |
370 hb_buffer_reverse_clusters (buffer); | 370 hb_buffer_reverse_clusters (buffer); |
371 | 371 |
372 if (feats) gr_featureval_destroy (feats); | 372 if (feats) gr_featureval_destroy (feats); |
373 gr_seg_destroy (seg); | 373 gr_seg_destroy (seg); |
374 | 374 |
375 return true; | 375 return true; |
376 } | 376 } |
OLD | NEW |