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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 * | 97 * |
98 * Since: 1.0 | 98 * Since: 1.0 |
99 **/ | 99 **/ |
100 hb_shape_plan_t * | 100 hb_shape_plan_t * |
101 hb_shape_plan_create (hb_face_t *face, | 101 hb_shape_plan_create (hb_face_t *face, |
102 const hb_segment_properties_t *props, | 102 const hb_segment_properties_t *props, |
103 const hb_feature_t *user_features, | 103 const hb_feature_t *user_features, |
104 unsigned int num_user_features, | 104 unsigned int num_user_features, |
105 const char * const *shaper_list) | 105 const char * const *shaper_list) |
106 { | 106 { |
107 assert (props->direction != HB_DIRECTION_INVALID); | |
108 | |
109 hb_shape_plan_t *shape_plan; | 107 hb_shape_plan_t *shape_plan; |
110 hb_feature_t *features = NULL; | 108 hb_feature_t *features = NULL; |
111 | 109 |
112 if (unlikely (!face)) | 110 if (unlikely (!face)) |
113 face = hb_face_get_empty (); | 111 face = hb_face_get_empty (); |
114 if (unlikely (!props || hb_object_is_inert (face))) | 112 if (unlikely (!props || hb_object_is_inert (face))) |
115 return hb_shape_plan_get_empty (); | 113 return hb_shape_plan_get_empty (); |
116 if (num_user_features && !(features = (hb_feature_t *) malloc (num_user_featur
es * sizeof (hb_feature_t)))) | 114 if (num_user_features && !(features = (hb_feature_t *) malloc (num_user_featur
es * sizeof (hb_feature_t)))) |
117 return hb_shape_plan_get_empty (); | 115 return hb_shape_plan_get_empty (); |
118 if (!(shape_plan = hb_object_create<hb_shape_plan_t> ())) { | 116 if (!(shape_plan = hb_object_create<hb_shape_plan_t> ())) { |
119 free (features); | 117 free (features); |
120 return hb_shape_plan_get_empty (); | 118 return hb_shape_plan_get_empty (); |
121 } | 119 } |
122 | 120 |
| 121 assert (props->direction != HB_DIRECTION_INVALID); |
| 122 |
123 hb_face_make_immutable (face); | 123 hb_face_make_immutable (face); |
124 shape_plan->default_shaper_list = shaper_list == NULL; | 124 shape_plan->default_shaper_list = shaper_list == NULL; |
125 shape_plan->face_unsafe = face; | 125 shape_plan->face_unsafe = face; |
126 shape_plan->props = *props; | 126 shape_plan->props = *props; |
127 shape_plan->num_user_features = num_user_features; | 127 shape_plan->num_user_features = num_user_features; |
128 shape_plan->user_features = features; | 128 shape_plan->user_features = features; |
129 if (num_user_features) | 129 if (num_user_features) |
130 memcpy (features, user_features, num_user_features * sizeof (hb_feature_t)); | 130 memcpy (features, user_features, num_user_features * sizeof (hb_feature_t)); |
131 | 131 |
132 hb_shape_plan_plan (shape_plan, user_features, num_user_features, shaper_list)
; | 132 hb_shape_plan_plan (shape_plan, user_features, num_user_features, shaper_list)
; |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 * | 454 * |
455 * Return value: (transfer none): | 455 * Return value: (transfer none): |
456 * | 456 * |
457 * Since: 1.0 | 457 * Since: 1.0 |
458 **/ | 458 **/ |
459 const char * | 459 const char * |
460 hb_shape_plan_get_shaper (hb_shape_plan_t *shape_plan) | 460 hb_shape_plan_get_shaper (hb_shape_plan_t *shape_plan) |
461 { | 461 { |
462 return shape_plan->shaper_name; | 462 return shape_plan->shaper_name; |
463 } | 463 } |
OLD | NEW |