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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 hb_font_t *font, | 219 hb_font_t *font, |
220 hb_buffer_t *buffer, | 220 hb_buffer_t *buffer, |
221 const hb_feature_t *features, | 221 const hb_feature_t *features, |
222 unsigned int num_features) | 222 unsigned int num_features) |
223 { | 223 { |
224 hb_face_t *face = font->face; | 224 hb_face_t *face = font->face; |
225 gr_face *grface = HB_SHAPER_DATA_GET (face)->grface; | 225 gr_face *grface = HB_SHAPER_DATA_GET (face)->grface; |
226 gr_font *grfont = HB_SHAPER_DATA_GET (font); | 226 gr_font *grfont = HB_SHAPER_DATA_GET (font); |
227 | 227 |
228 const char *lang = hb_language_to_string (hb_buffer_get_language (buffer)); | 228 const char *lang = hb_language_to_string (hb_buffer_get_language (buffer)); |
229 const char *lang_end = strchr (lang, '-'); | 229 const char *lang_end = lang ? strchr (lang, '-') : NULL; |
230 int lang_len = lang_end ? lang_end - lang : -1; | 230 int lang_len = lang_end ? lang_end - lang : -1; |
231 gr_feature_val *feats = gr_face_featureval_for_lang (grface, lang ? hb_tag_fro
m_string (lang, lang_len) : 0); | 231 gr_feature_val *feats = gr_face_featureval_for_lang (grface, lang ? hb_tag_fro
m_string (lang, lang_len) : 0); |
232 | 232 |
233 while (num_features--) | 233 while (num_features--) |
234 { | 234 { |
235 const gr_feature_ref *fref = gr_face_find_fref (grface, features->tag); | 235 const gr_feature_ref *fref = gr_face_find_fref (grface, features->tag); |
236 if (fref) | 236 if (fref) |
237 gr_fref_set_feature_value (fref, features->value, feats); | 237 gr_fref_set_feature_value (fref, features->value, feats); |
238 features++; | 238 features++; |
239 } | 239 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 pPos[-1].x_advance += gr_seg_advance_X(seg) - curradvx; | 361 pPos[-1].x_advance += gr_seg_advance_X(seg) - curradvx; |
362 | 362 |
363 if (HB_DIRECTION_IS_BACKWARD (buffer->props.direction)) | 363 if (HB_DIRECTION_IS_BACKWARD (buffer->props.direction)) |
364 hb_buffer_reverse_clusters (buffer); | 364 hb_buffer_reverse_clusters (buffer); |
365 | 365 |
366 if (feats) gr_featureval_destroy (feats); | 366 if (feats) gr_featureval_destroy (feats); |
367 gr_seg_destroy (seg); | 367 gr_seg_destroy (seg); |
368 | 368 |
369 return true; | 369 return true; |
370 } | 370 } |
OLD | NEW |