OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2012 Google, Inc. | 2 * Copyright © 2012 Google, Inc. |
3 * | 3 * |
4 * This is part of HarfBuzz, a text shaping library. | 4 * This is part of HarfBuzz, a text shaping library. |
5 * | 5 * |
6 * Permission is hereby granted, without written agreement and without | 6 * Permission is hereby granted, without written agreement and without |
7 * license or royalty fees, to use, copy, modify, and distribute this | 7 * license or royalty fees, to use, copy, modify, and distribute this |
8 * software and its documentation for any purpose, provided that the | 8 * software and its documentation for any purpose, provided that the |
9 * above copyright notice and the following two paragraphs appear in | 9 * above copyright notice and the following two paragraphs appear in |
10 * all copies of this software. | 10 * all copies of this software. |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 num_user_features, | 121 num_user_features, |
122 shaper_list); | 122 shaper_list); |
123 | 123 |
124 hb_shape_plan_t *shape_plan; | 124 hb_shape_plan_t *shape_plan; |
125 hb_feature_t *features = NULL; | 125 hb_feature_t *features = NULL; |
126 | 126 |
127 if (unlikely (!face)) | 127 if (unlikely (!face)) |
128 face = hb_face_get_empty (); | 128 face = hb_face_get_empty (); |
129 if (unlikely (!props)) | 129 if (unlikely (!props)) |
130 return hb_shape_plan_get_empty (); | 130 return hb_shape_plan_get_empty (); |
131 if (num_user_features && !(features = (hb_feature_t *) malloc (num_user_featur
es * sizeof (hb_feature_t)))) | 131 if (num_user_features && !(features = (hb_feature_t *) calloc (num_user_featur
es, sizeof (hb_feature_t)))) |
132 return hb_shape_plan_get_empty (); | 132 return hb_shape_plan_get_empty (); |
133 if (!(shape_plan = hb_object_create<hb_shape_plan_t> ())) { | 133 if (!(shape_plan = hb_object_create<hb_shape_plan_t> ())) { |
134 free (features); | 134 free (features); |
135 return hb_shape_plan_get_empty (); | 135 return hb_shape_plan_get_empty (); |
136 } | 136 } |
137 | 137 |
138 assert (props->direction != HB_DIRECTION_INVALID); | 138 assert (props->direction != HB_DIRECTION_INVALID); |
139 | 139 |
140 hb_face_make_immutable (face); | 140 hb_face_make_immutable (face); |
141 shape_plan->default_shaper_list = shaper_list == NULL; | 141 shape_plan->default_shaper_list = shaper_list == NULL; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 hb_font_t *font, | 286 hb_font_t *font, |
287 hb_buffer_t *buffer, | 287 hb_buffer_t *buffer, |
288 const hb_feature_t *features, | 288 const hb_feature_t *features, |
289 unsigned int num_features) | 289 unsigned int num_features) |
290 { | 290 { |
291 DEBUG_MSG_FUNC (SHAPE_PLAN, shape_plan, | 291 DEBUG_MSG_FUNC (SHAPE_PLAN, shape_plan, |
292 "num_features=%d shaper_func=%p", | 292 "num_features=%d shaper_func=%p", |
293 num_features, | 293 num_features, |
294 shape_plan->shaper_func); | 294 shape_plan->shaper_func); |
295 | 295 |
296 if (unlikely (hb_object_is_inert (shape_plan) || | 296 if (unlikely (!buffer->len)) |
297 » » hb_object_is_inert (buffer))) | 297 return true; |
| 298 |
| 299 assert (!hb_object_is_inert (buffer)); |
| 300 assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE); |
| 301 |
| 302 if (unlikely (hb_object_is_inert (shape_plan))) |
298 return false; | 303 return false; |
299 | 304 |
300 assert (shape_plan->face_unsafe == font->face); | 305 assert (shape_plan->face_unsafe == font->face); |
301 assert (hb_segment_properties_equal (&shape_plan->props, &buffer->props)); | 306 assert (hb_segment_properties_equal (&shape_plan->props, &buffer->props)); |
302 | 307 |
303 #define HB_SHAPER_EXECUTE(shaper) \ | 308 #define HB_SHAPER_EXECUTE(shaper) \ |
304 HB_STMT_START { \ | 309 HB_STMT_START { \ |
305 return HB_SHAPER_DATA (shaper, shape_plan) && \ | 310 return HB_SHAPER_DATA (shaper, shape_plan) && \ |
306 hb_##shaper##_shaper_font_data_ensure (font) && \ | 311 hb_##shaper##_shaper_font_data_ensure (font) && \ |
307 _hb_##shaper##_shape (shape_plan, font, buffer, features, num_f
eatures); \ | 312 _hb_##shaper##_shape (shape_plan, font, buffer, features, num_f
eatures); \ |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 * | 491 * |
487 * Return value: (transfer none): | 492 * Return value: (transfer none): |
488 * | 493 * |
489 * Since: 0.9.7 | 494 * Since: 0.9.7 |
490 **/ | 495 **/ |
491 const char * | 496 const char * |
492 hb_shape_plan_get_shaper (hb_shape_plan_t *shape_plan) | 497 hb_shape_plan_get_shaper (hb_shape_plan_t *shape_plan) |
493 { | 498 { |
494 return shape_plan->shaper_name; | 499 return shape_plan->shaper_name; |
495 } | 500 } |
OLD | NEW |