OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2009,2010 Red Hat, Inc. | 2 * Copyright © 2009,2010 Red Hat, Inc. |
3 * Copyright © 2010,2011,2012 Google, Inc. | 3 * Copyright © 2010,2011,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 11 matching lines...) Expand all Loading... |
22 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO | 22 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
23 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 23 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
24 * | 24 * |
25 * Red Hat Author(s): Behdad Esfahbod | 25 * Red Hat Author(s): Behdad Esfahbod |
26 * Google Author(s): Behdad Esfahbod | 26 * Google Author(s): Behdad Esfahbod |
27 */ | 27 */ |
28 | 28 |
29 #define HB_SHAPER ot | 29 #define HB_SHAPER ot |
30 #define hb_ot_shaper_face_data_t hb_ot_layout_t | 30 #define hb_ot_shaper_face_data_t hb_ot_layout_t |
31 #define hb_ot_shaper_shape_plan_data_t hb_ot_shape_plan_t | 31 #define hb_ot_shaper_shape_plan_data_t hb_ot_shape_plan_t |
32 | 32 #include "hb-shaper-impl-private.hh" |
33 #include "hb-ot-layout-private.hh" | |
34 | 33 |
35 #include "hb-ot-shape-private.hh" | 34 #include "hb-ot-shape-private.hh" |
36 #include "hb-ot-shape-complex-private.hh" | 35 #include "hb-ot-shape-complex-private.hh" |
37 #include "hb-ot-shape-fallback-private.hh" | 36 #include "hb-ot-shape-fallback-private.hh" |
38 #include "hb-ot-shape-normalize-private.hh" | 37 #include "hb-ot-shape-normalize-private.hh" |
39 | 38 |
| 39 #include "hb-ot-layout-private.hh" |
| 40 #include "hb-unicode-private.hh" |
40 #include "hb-set-private.hh" | 41 #include "hb-set-private.hh" |
41 #include "hb-shaper-impl-private.hh" | |
42 | |
43 #include "hb-unicode-private.hh" | |
44 | 42 |
45 | 43 |
46 static hb_tag_t common_features[] = { | 44 static hb_tag_t common_features[] = { |
47 HB_TAG('c','c','m','p'), | 45 HB_TAG('c','c','m','p'), |
48 HB_TAG('l','i','g','a'), | |
49 HB_TAG('l','o','c','l'), | 46 HB_TAG('l','o','c','l'), |
50 HB_TAG('m','a','r','k'), | 47 HB_TAG('m','a','r','k'), |
51 HB_TAG('m','k','m','k'), | 48 HB_TAG('m','k','m','k'), |
52 HB_TAG('r','l','i','g'), | 49 HB_TAG('r','l','i','g'), |
53 }; | 50 }; |
54 | 51 |
55 | 52 |
56 static hb_tag_t horizontal_features[] = { | 53 static hb_tag_t horizontal_features[] = { |
57 HB_TAG('c','a','l','t'), | 54 HB_TAG('c','a','l','t'), |
58 HB_TAG('c','l','i','g'), | 55 HB_TAG('c','l','i','g'), |
59 HB_TAG('c','u','r','s'), | 56 HB_TAG('c','u','r','s'), |
60 HB_TAG('k','e','r','n'), | 57 HB_TAG('k','e','r','n'), |
| 58 HB_TAG('l','i','g','a'), |
61 HB_TAG('r','c','l','t'), | 59 HB_TAG('r','c','l','t'), |
62 }; | 60 }; |
63 | 61 |
64 static hb_tag_t vertical_features[] = { | 62 static hb_tag_t vertical_features[] = { |
65 HB_TAG('v','e','r','t'), | 63 HB_TAG('v','e','r','t'), |
66 }; | 64 }; |
67 | 65 |
68 | 66 |
69 | 67 |
70 static void | 68 static void |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 unsigned int count = buffer->len; | 229 unsigned int count = buffer->len; |
232 hb_glyph_info_t *info = buffer->info; | 230 hb_glyph_info_t *info = buffer->info; |
233 for (unsigned int i = 0; i < count; i++) | 231 for (unsigned int i = 0; i < count; i++) |
234 _hb_glyph_info_set_unicode_props (&info[i], buffer->unicode); | 232 _hb_glyph_info_set_unicode_props (&info[i], buffer->unicode); |
235 } | 233 } |
236 | 234 |
237 static void | 235 static void |
238 hb_insert_dotted_circle (hb_buffer_t *buffer, hb_font_t *font) | 236 hb_insert_dotted_circle (hb_buffer_t *buffer, hb_font_t *font) |
239 { | 237 { |
240 if (!(buffer->flags & HB_BUFFER_FLAG_BOT) || | 238 if (!(buffer->flags & HB_BUFFER_FLAG_BOT) || |
| 239 buffer->context_len[0] || |
241 _hb_glyph_info_get_general_category (&buffer->info[0]) != | 240 _hb_glyph_info_get_general_category (&buffer->info[0]) != |
242 HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) | 241 HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) |
243 return; | 242 return; |
244 | 243 |
245 if (!font->has_glyph (0x25CCu)) | 244 if (!font->has_glyph (0x25CCu)) |
246 return; | 245 return; |
247 | 246 |
248 hb_glyph_info_t dottedcircle; | 247 hb_glyph_info_t dottedcircle = {0}; |
249 dottedcircle.codepoint = 0x25CCu; | 248 dottedcircle.codepoint = 0x25CCu; |
250 _hb_glyph_info_set_unicode_props (&dottedcircle, buffer->unicode); | 249 _hb_glyph_info_set_unicode_props (&dottedcircle, buffer->unicode); |
251 | 250 |
252 buffer->clear_output (); | 251 buffer->clear_output (); |
253 | 252 |
254 buffer->idx = 0; | 253 buffer->idx = 0; |
255 hb_glyph_info_t info = dottedcircle; | 254 hb_glyph_info_t info = dottedcircle; |
256 info.cluster = buffer->cur().cluster; | 255 info.cluster = buffer->cur().cluster; |
257 info.mask = buffer->cur().mask; | 256 info.mask = buffer->cur().mask; |
258 buffer->output_info (info); | 257 buffer->output_info (info); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 hb_ot_map_glyphs_fast (buffer); | 441 hb_ot_map_glyphs_fast (buffer); |
443 | 442 |
444 HB_BUFFER_DEALLOCATE_VAR (buffer, glyph_index); | 443 HB_BUFFER_DEALLOCATE_VAR (buffer, glyph_index); |
445 } | 444 } |
446 | 445 |
447 static inline void | 446 static inline void |
448 hb_ot_substitute_complex (hb_ot_shape_context_t *c) | 447 hb_ot_substitute_complex (hb_ot_shape_context_t *c) |
449 { | 448 { |
450 hb_buffer_t *buffer = c->buffer; | 449 hb_buffer_t *buffer = c->buffer; |
451 | 450 |
| 451 _hb_buffer_allocate_gsubgpos_vars (buffer); |
452 hb_ot_layout_substitute_start (c->font, buffer); | 452 hb_ot_layout_substitute_start (c->font, buffer); |
453 | 453 |
454 if (!hb_ot_layout_has_glyph_classes (c->face)) | 454 if (!hb_ot_layout_has_glyph_classes (c->face)) |
455 hb_synthesize_glyph_classes (c); | 455 hb_synthesize_glyph_classes (c); |
456 | 456 |
457 c->plan->substitute (c->font, buffer); | 457 c->plan->substitute (c->font, buffer); |
458 | 458 |
459 hb_ot_layout_substitute_finish (c->font, buffer); | 459 hb_ot_layout_substitute_finish (c->font, buffer); |
460 | 460 |
461 return; | 461 return; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 if (fallback && c->plan->shaper->fallback_position) | 630 if (fallback && c->plan->shaper->fallback_position) |
631 _hb_ot_shape_fallback_position (c->plan, c->font, c->buffer); | 631 _hb_ot_shape_fallback_position (c->plan, c->font, c->buffer); |
632 | 632 |
633 if (HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction)) | 633 if (HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction)) |
634 hb_buffer_reverse (c->buffer); | 634 hb_buffer_reverse (c->buffer); |
635 | 635 |
636 /* Visual fallback goes here. */ | 636 /* Visual fallback goes here. */ |
637 | 637 |
638 if (fallback) | 638 if (fallback) |
639 _hb_ot_shape_fallback_kern (c->plan, c->font, c->buffer); | 639 _hb_ot_shape_fallback_kern (c->plan, c->font, c->buffer); |
| 640 |
| 641 _hb_buffer_deallocate_gsubgpos_vars (c->buffer); |
640 } | 642 } |
641 | 643 |
642 | 644 |
643 /* Post-process */ | 645 /* Post-process */ |
644 | 646 |
645 static void | 647 static void |
646 hb_ot_hide_default_ignorables (hb_ot_shape_context_t *c) | 648 hb_ot_hide_default_ignorables (hb_ot_shape_context_t *c) |
647 { | 649 { |
648 if (c->buffer->flags & HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES) | 650 if (c->buffer->flags & HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES) |
649 return; | 651 return; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 hb_set_t copy; | 794 hb_set_t copy; |
793 copy.init (); | 795 copy.init (); |
794 do { | 796 do { |
795 copy.set (glyphs); | 797 copy.set (glyphs); |
796 for (hb_codepoint_t lookup_index = -1; hb_set_next (&lookups, &lookup_index)
;) | 798 for (hb_codepoint_t lookup_index = -1; hb_set_next (&lookups, &lookup_index)
;) |
797 hb_ot_layout_lookup_substitute_closure (font->face, lookup_index, glyphs); | 799 hb_ot_layout_lookup_substitute_closure (font->face, lookup_index, glyphs); |
798 } while (!copy.is_equal (glyphs)); | 800 } while (!copy.is_equal (glyphs)); |
799 | 801 |
800 hb_shape_plan_destroy (shape_plan); | 802 hb_shape_plan_destroy (shape_plan); |
801 } | 803 } |
OLD | NEW |