OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2009 Red Hat, Inc. | 2 * Copyright © 2009 Red Hat, Inc. |
3 * Copyright © 2012 Google, Inc. | 3 * Copyright © 2012 Google, Inc. |
4 * | 4 * |
5 * This is part of HarfBuzz, a text shaping library. | 5 * This is part of HarfBuzz, a text shaping library. |
6 * | 6 * |
7 * Permission is hereby granted, without written agreement and without | 7 * Permission is hereby granted, without written agreement and without |
8 * license or royalty fees, to use, copy, modify, and distribute this | 8 * license or royalty fees, to use, copy, modify, and distribute this |
9 * software and its documentation for any purpose, provided that the | 9 * software and its documentation for any purpose, provided that the |
10 * above copyright notice and the following two paragraphs appear in | 10 * above copyright notice and the following two paragraphs appear in |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 * | 364 * |
365 * Since: 0.9.2 | 365 * Since: 0.9.2 |
366 **/ | 366 **/ |
367 hb_bool_t | 367 hb_bool_t |
368 hb_shape_full (hb_font_t *font, | 368 hb_shape_full (hb_font_t *font, |
369 hb_buffer_t *buffer, | 369 hb_buffer_t *buffer, |
370 const hb_feature_t *features, | 370 const hb_feature_t *features, |
371 unsigned int num_features, | 371 unsigned int num_features, |
372 const char * const *shaper_list) | 372 const char * const *shaper_list) |
373 { | 373 { |
374 if (unlikely (!buffer->len)) | |
375 return true; | |
376 | |
377 assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_UNICODE); | |
378 | |
379 hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached (font->face, &buffer
->props, features, num_features, shaper_list); | 374 hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached (font->face, &buffer
->props, features, num_features, shaper_list); |
380 hb_bool_t res = hb_shape_plan_execute (shape_plan, font, buffer, features, num
_features); | 375 hb_bool_t res = hb_shape_plan_execute (shape_plan, font, buffer, features, num
_features); |
381 hb_shape_plan_destroy (shape_plan); | 376 hb_shape_plan_destroy (shape_plan); |
382 | 377 |
383 if (res) | 378 if (res) |
384 buffer->content_type = HB_BUFFER_CONTENT_TYPE_GLYPHS; | 379 buffer->content_type = HB_BUFFER_CONTENT_TYPE_GLYPHS; |
385 return res; | 380 return res; |
386 } | 381 } |
387 | 382 |
388 /** | 383 /** |
389 * hb_shape: | 384 * hb_shape: |
390 * @font: an #hb_font_t to use for shaping | 385 * @font: an #hb_font_t to use for shaping |
391 * @buffer: an #hb_buffer_t to shape | 386 * @buffer: an #hb_buffer_t to shape |
392 * @features: (array length=num_features) (allow-none): an array of user | 387 * @features: (array length=num_features) (allow-none): an array of user |
393 * specified #hb_feature_t or %NULL | 388 * specified #hb_feature_t or %NULL |
394 * @num_features: the length of @features array | 389 * @num_features: the length of @features array |
395 * | 390 * |
396 * Shapes @buffer using @font turning its Unicode characters content to | 391 * Shapes @buffer using @font turning its Unicode characters content to |
397 * positioned glyphs. If @features is not %NULL, it will be used to control the | 392 * positioned glyphs. If @features is not %NULL, it will be used to control the |
398 * features applied during shaping. | 393 * features applied during shaping. |
399 * | 394 * |
400 * Return value: %FALSE if all shapers failed, %TRUE otherwise | 395 * Return value: %FALSE if all shapers failed, %TRUE otherwise |
401 * | 396 * |
402 * Since: 1.0 | 397 * Since: 0.9.2 |
403 **/ | 398 **/ |
404 void | 399 void |
405 hb_shape (hb_font_t *font, | 400 hb_shape (hb_font_t *font, |
406 hb_buffer_t *buffer, | 401 hb_buffer_t *buffer, |
407 const hb_feature_t *features, | 402 const hb_feature_t *features, |
408 unsigned int num_features) | 403 unsigned int num_features) |
409 { | 404 { |
410 hb_shape_full (font, buffer, features, num_features, NULL); | 405 hb_shape_full (font, buffer, features, num_features, NULL); |
411 } | 406 } |
OLD | NEW |