| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright © 1998-2004 David Turner and Werner Lemberg | 2 * Copyright © 1998-2004 David Turner and Werner Lemberg |
| 3 * Copyright © 2006 Behdad Esfahbod | 3 * Copyright © 2006 Behdad Esfahbod |
| 4 * Copyright © 2007,2008,2009 Red Hat, Inc. | 4 * Copyright © 2007,2008,2009 Red Hat, Inc. |
| 5 * Copyright © 2012,2013 Google, Inc. | 5 * Copyright © 2012,2013 Google, Inc. |
| 6 * | 6 * |
| 7 * This is part of HarfBuzz, a text shaping library. | 7 * This is part of HarfBuzz, a text shaping library. |
| 8 * | 8 * |
| 9 * Permission is hereby granted, without written agreement and without | 9 * Permission is hereby granted, without written agreement and without |
| 10 * license or royalty fees, to use, copy, modify, and distribute this | 10 * license or royalty fees, to use, copy, modify, and distribute this |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 * GDEF | 123 * GDEF |
| 124 */ | 124 */ |
| 125 | 125 |
| 126 hb_bool_t | 126 hb_bool_t |
| 127 hb_ot_layout_has_glyph_classes (hb_face_t *face) | 127 hb_ot_layout_has_glyph_classes (hb_face_t *face) |
| 128 { | 128 { |
| 129 return _get_gdef (face).has_glyph_classes (); | 129 return _get_gdef (face).has_glyph_classes (); |
| 130 } | 130 } |
| 131 | 131 |
| 132 /** | 132 /** |
| 133 * hb_ot_layout_get_glyph_class: |
| 134 * |
| 133 * Since: 0.9.7 | 135 * Since: 0.9.7 |
| 134 **/ | 136 **/ |
| 135 hb_ot_layout_glyph_class_t | 137 hb_ot_layout_glyph_class_t |
| 136 hb_ot_layout_get_glyph_class (hb_face_t *face, | 138 hb_ot_layout_get_glyph_class (hb_face_t *face, |
| 137 hb_codepoint_t glyph) | 139 hb_codepoint_t glyph) |
| 138 { | 140 { |
| 139 return (hb_ot_layout_glyph_class_t) _get_gdef (face).get_glyph_class (glyph); | 141 return (hb_ot_layout_glyph_class_t) _get_gdef (face).get_glyph_class (glyph); |
| 140 } | 142 } |
| 141 | 143 |
| 142 /** | 144 /** |
| 145 * hb_ot_layout_get_glyphs_in_class: |
| 146 * |
| 143 * Since: 0.9.7 | 147 * Since: 0.9.7 |
| 144 **/ | 148 **/ |
| 145 void | 149 void |
| 146 hb_ot_layout_get_glyphs_in_class (hb_face_t *face, | 150 hb_ot_layout_get_glyphs_in_class (hb_face_t *face, |
| 147 hb_ot_layout_glyph_class_t klass, | 151 hb_ot_layout_glyph_class_t klass, |
| 148 hb_set_t *glyphs /* OUT */) | 152 hb_set_t *glyphs /* OUT */) |
| 149 { | 153 { |
| 150 return _get_gdef (face).get_glyphs_in_class (klass, glyphs); | 154 return _get_gdef (face).get_glyphs_in_class (klass, glyphs); |
| 151 } | 155 } |
| 152 | 156 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 { | 362 { |
| 359 return hb_ot_layout_language_get_required_feature (face, | 363 return hb_ot_layout_language_get_required_feature (face, |
| 360 table_tag, | 364 table_tag, |
| 361 script_index, | 365 script_index, |
| 362 language_index, | 366 language_index, |
| 363 feature_index, | 367 feature_index, |
| 364 NULL); | 368 NULL); |
| 365 } | 369 } |
| 366 | 370 |
| 367 /** | 371 /** |
| 372 * hb_ot_layout_language_get_required_feature: |
| 373 * |
| 368 * Since: 0.9.30 | 374 * Since: 0.9.30 |
| 369 **/ | 375 **/ |
| 370 hb_bool_t | 376 hb_bool_t |
| 371 hb_ot_layout_language_get_required_feature (hb_face_t *face, | 377 hb_ot_layout_language_get_required_feature (hb_face_t *face, |
| 372 hb_tag_t table_tag, | 378 hb_tag_t table_tag, |
| 373 unsigned int script_index, | 379 unsigned int script_index, |
| 374 unsigned int language_index, | 380 unsigned int language_index, |
| 375 unsigned int *feature_index, | 381 unsigned int *feature_index, |
| 376 hb_tag_t *feature_tag) | 382 hb_tag_t *feature_tag) |
| 377 { | 383 { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 if (feature_index) *feature_index = f_index; | 451 if (feature_index) *feature_index = f_index; |
| 446 return true; | 452 return true; |
| 447 } | 453 } |
| 448 } | 454 } |
| 449 | 455 |
| 450 if (feature_index) *feature_index = HB_OT_LAYOUT_NO_FEATURE_INDEX; | 456 if (feature_index) *feature_index = HB_OT_LAYOUT_NO_FEATURE_INDEX; |
| 451 return false; | 457 return false; |
| 452 } | 458 } |
| 453 | 459 |
| 454 /** | 460 /** |
| 461 * hb_ot_layout_feature_get_lookups: |
| 462 * |
| 455 * Since: 0.9.7 | 463 * Since: 0.9.7 |
| 456 **/ | 464 **/ |
| 457 unsigned int | 465 unsigned int |
| 458 hb_ot_layout_feature_get_lookups (hb_face_t *face, | 466 hb_ot_layout_feature_get_lookups (hb_face_t *face, |
| 459 hb_tag_t table_tag, | 467 hb_tag_t table_tag, |
| 460 unsigned int feature_index, | 468 unsigned int feature_index, |
| 461 unsigned int start_offset, | 469 unsigned int start_offset, |
| 462 unsigned int *lookup_count /* IN/OUT */, | 470 unsigned int *lookup_count /* IN/OUT */, |
| 463 unsigned int *lookup_indexes /* OUT */) | 471 unsigned int *lookup_indexes /* OUT */) |
| 464 { | 472 { |
| 465 const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); | 473 const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); |
| 466 const OT::Feature &f = g.get_feature (feature_index); | 474 const OT::Feature &f = g.get_feature (feature_index); |
| 467 | 475 |
| 468 return f.get_lookup_indexes (start_offset, lookup_count, lookup_indexes); | 476 return f.get_lookup_indexes (start_offset, lookup_count, lookup_indexes); |
| 469 } | 477 } |
| 470 | 478 |
| 471 /** | 479 /** |
| 480 * hb_ot_layout_table_get_lookup_count: |
| 481 * |
| 472 * Since: 0.9.22 | 482 * Since: 0.9.22 |
| 473 **/ | 483 **/ |
| 474 unsigned int | 484 unsigned int |
| 475 hb_ot_layout_table_get_lookup_count (hb_face_t *face, | 485 hb_ot_layout_table_get_lookup_count (hb_face_t *face, |
| 476 hb_tag_t table_tag) | 486 hb_tag_t table_tag) |
| 477 { | 487 { |
| 478 switch (table_tag) | 488 switch (table_tag) |
| 479 { | 489 { |
| 480 case HB_OT_TAG_GSUB: | 490 case HB_OT_TAG_GSUB: |
| 481 { | 491 { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 table_tag, | 632 table_tag, |
| 623 script_index, | 633 script_index, |
| 624 language_index, | 634 language_index, |
| 625 features, | 635 features, |
| 626 lookup_indexes); | 636 lookup_indexes); |
| 627 } | 637 } |
| 628 } | 638 } |
| 629 } | 639 } |
| 630 | 640 |
| 631 /** | 641 /** |
| 642 * hb_ot_layout_collect_lookups: |
| 643 * |
| 632 * Since: 0.9.8 | 644 * Since: 0.9.8 |
| 633 **/ | 645 **/ |
| 634 void | 646 void |
| 635 hb_ot_layout_collect_lookups (hb_face_t *face, | 647 hb_ot_layout_collect_lookups (hb_face_t *face, |
| 636 hb_tag_t table_tag, | 648 hb_tag_t table_tag, |
| 637 const hb_tag_t *scripts, | 649 const hb_tag_t *scripts, |
| 638 const hb_tag_t *languages, | 650 const hb_tag_t *languages, |
| 639 const hb_tag_t *features, | 651 const hb_tag_t *features, |
| 640 hb_set_t *lookup_indexes /* OUT */) | 652 hb_set_t *lookup_indexes /* OUT */) |
| 641 { | 653 { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 666 table_tag, | 678 table_tag, |
| 667 script_index, | 679 script_index, |
| 668 languages, | 680 languages, |
| 669 features, | 681 features, |
| 670 lookup_indexes); | 682 lookup_indexes); |
| 671 } | 683 } |
| 672 } | 684 } |
| 673 } | 685 } |
| 674 | 686 |
| 675 /** | 687 /** |
| 688 * hb_ot_layout_lookup_collect_glyphs: |
| 689 * |
| 676 * Since: 0.9.7 | 690 * Since: 0.9.7 |
| 677 **/ | 691 **/ |
| 678 void | 692 void |
| 679 hb_ot_layout_lookup_collect_glyphs (hb_face_t *face, | 693 hb_ot_layout_lookup_collect_glyphs (hb_face_t *face, |
| 680 hb_tag_t table_tag, | 694 hb_tag_t table_tag, |
| 681 unsigned int lookup_index, | 695 unsigned int lookup_index, |
| 682 hb_set_t *glyphs_before, /* OUT. May be
NULL */ | 696 hb_set_t *glyphs_before, /* OUT. May be
NULL */ |
| 683 hb_set_t *glyphs_input, /* OUT. May be
NULL */ | 697 hb_set_t *glyphs_input, /* OUT. May be
NULL */ |
| 684 hb_set_t *glyphs_after, /* OUT. May be
NULL */ | 698 hb_set_t *glyphs_after, /* OUT. May be
NULL */ |
| 685 hb_set_t *glyphs_output /* OUT. May be
NULL */) | 699 hb_set_t *glyphs_output /* OUT. May be
NULL */) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 714 * OT::GSUB | 728 * OT::GSUB |
| 715 */ | 729 */ |
| 716 | 730 |
| 717 hb_bool_t | 731 hb_bool_t |
| 718 hb_ot_layout_has_substitution (hb_face_t *face) | 732 hb_ot_layout_has_substitution (hb_face_t *face) |
| 719 { | 733 { |
| 720 return &_get_gsub (face) != &OT::Null(OT::GSUB); | 734 return &_get_gsub (face) != &OT::Null(OT::GSUB); |
| 721 } | 735 } |
| 722 | 736 |
| 723 /** | 737 /** |
| 738 * hb_ot_layout_lookup_would_substitute: |
| 739 * |
| 724 * Since: 0.9.7 | 740 * Since: 0.9.7 |
| 725 **/ | 741 **/ |
| 726 hb_bool_t | 742 hb_bool_t |
| 727 hb_ot_layout_lookup_would_substitute (hb_face_t *face, | 743 hb_ot_layout_lookup_would_substitute (hb_face_t *face, |
| 728 unsigned int lookup_index, | 744 unsigned int lookup_index, |
| 729 const hb_codepoint_t *glyphs, | 745 const hb_codepoint_t *glyphs, |
| 730 unsigned int glyphs_length, | 746 unsigned int glyphs_length, |
| 731 hb_bool_t zero_context) | 747 hb_bool_t zero_context) |
| 732 { | 748 { |
| 733 if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return false; | 749 if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return false; |
| 734 return hb_ot_layout_lookup_would_substitute_fast (face, lookup_index, glyphs,
glyphs_length, zero_context); | 750 return hb_ot_layout_lookup_would_substitute_fast (face, lookup_index, glyphs,
glyphs_length, zero_context); |
| 735 } | 751 } |
| 736 | 752 |
| 737 hb_bool_t | 753 hb_bool_t |
| 738 hb_ot_layout_lookup_would_substitute_fast (hb_face_t *face, | 754 hb_ot_layout_lookup_would_substitute_fast (hb_face_t *face, |
| 739 unsigned int lookup_index, | 755 unsigned int lookup_index, |
| 740 const hb_codepoint_t *glyphs, | 756 const hb_codepoint_t *glyphs, |
| 741 unsigned int glyphs_length, | 757 unsigned int glyphs_length, |
| 742 hb_bool_t zero_context) | 758 hb_bool_t zero_context) |
| 743 { | 759 { |
| 744 if (unlikely (lookup_index >= hb_ot_layout_from_face (face)->gsub_lookup_count
)) return false; | 760 if (unlikely (lookup_index >= hb_ot_layout_from_face (face)->gsub_lookup_count
)) return false; |
| 745 OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, zero_context); | 761 OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, (bool) zero_conte
xt); |
| 746 | 762 |
| 747 const OT::SubstLookup& l = hb_ot_layout_from_face (face)->gsub->get_lookup (lo
okup_index); | 763 const OT::SubstLookup& l = hb_ot_layout_from_face (face)->gsub->get_lookup (lo
okup_index); |
| 748 | 764 |
| 749 return l.would_apply (&c, &hb_ot_layout_from_face (face)->gsub_accels[lookup_i
ndex]); | 765 return l.would_apply (&c, &hb_ot_layout_from_face (face)->gsub_accels[lookup_i
ndex]); |
| 750 } | 766 } |
| 751 | 767 |
| 752 void | 768 void |
| 753 hb_ot_layout_substitute_start (hb_font_t *font, hb_buffer_t *buffer) | 769 hb_ot_layout_substitute_start (hb_font_t *font, hb_buffer_t *buffer) |
| 754 { | 770 { |
| 755 OT::GSUB::substitute_start (font, buffer); | 771 OT::GSUB::substitute_start (font, buffer); |
| 756 } | 772 } |
| 757 | 773 |
| 758 void | 774 void |
| 759 hb_ot_layout_substitute_finish (hb_font_t *font, hb_buffer_t *buffer) | 775 hb_ot_layout_substitute_finish (hb_font_t *font, hb_buffer_t *buffer) |
| 760 { | 776 { |
| 761 OT::GSUB::substitute_finish (font, buffer); | 777 OT::GSUB::substitute_finish (font, buffer); |
| 762 } | 778 } |
| 763 | 779 |
| 764 /** | 780 /** |
| 781 * hb_ot_layout_lookup_substitute_closure: |
| 782 * |
| 765 * Since: 0.9.7 | 783 * Since: 0.9.7 |
| 766 **/ | 784 **/ |
| 767 void | 785 void |
| 768 hb_ot_layout_lookup_substitute_closure (hb_face_t *face, | 786 hb_ot_layout_lookup_substitute_closure (hb_face_t *face, |
| 769 unsigned int lookup_index, | 787 unsigned int lookup_index, |
| 770 hb_set_t *glyphs) | 788 hb_set_t *glyphs) |
| 771 { | 789 { |
| 772 OT::hb_closure_context_t c (face, glyphs); | 790 OT::hb_closure_context_t c (face, glyphs); |
| 773 | 791 |
| 774 const OT::SubstLookup& l = _get_gsub (face).get_lookup (lookup_index); | 792 const OT::SubstLookup& l = _get_gsub (face).get_lookup (lookup_index); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 792 OT::GPOS::position_start (font, buffer); | 810 OT::GPOS::position_start (font, buffer); |
| 793 } | 811 } |
| 794 | 812 |
| 795 void | 813 void |
| 796 hb_ot_layout_position_finish (hb_font_t *font, hb_buffer_t *buffer) | 814 hb_ot_layout_position_finish (hb_font_t *font, hb_buffer_t *buffer) |
| 797 { | 815 { |
| 798 OT::GPOS::position_finish (font, buffer); | 816 OT::GPOS::position_finish (font, buffer); |
| 799 } | 817 } |
| 800 | 818 |
| 801 /** | 819 /** |
| 820 * hb_ot_layout_get_size_params: |
| 821 * |
| 802 * Since: 0.9.10 | 822 * Since: 0.9.10 |
| 803 **/ | 823 **/ |
| 804 hb_bool_t | 824 hb_bool_t |
| 805 hb_ot_layout_get_size_params (hb_face_t *face, | 825 hb_ot_layout_get_size_params (hb_face_t *face, |
| 806 unsigned int *design_size, /* OUT. May be N
ULL */ | 826 unsigned int *design_size, /* OUT. May be N
ULL */ |
| 807 unsigned int *subfamily_id, /* OUT. May be N
ULL */ | 827 unsigned int *subfamily_id, /* OUT. May be N
ULL */ |
| 808 unsigned int *subfamily_name_id, /* OUT. May be N
ULL */ | 828 unsigned int *subfamily_name_id, /* OUT. May be N
ULL */ |
| 809 unsigned int *range_start, /* OUT. May be N
ULL */ | 829 unsigned int *range_start, /* OUT. May be N
ULL */ |
| 810 unsigned int *range_end /* OUT. May be N
ULL */) | 830 unsigned int *range_end /* OUT. May be N
ULL */) |
| 811 { | 831 { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 { | 1021 { |
| 1002 const unsigned int table_index = proxy.table_index; | 1022 const unsigned int table_index = proxy.table_index; |
| 1003 unsigned int i = 0; | 1023 unsigned int i = 0; |
| 1004 OT::hb_apply_context_t c (table_index, font, buffer); | 1024 OT::hb_apply_context_t c (table_index, font, buffer); |
| 1005 c.set_recurse_func (Proxy::Lookup::apply_recurse_func); | 1025 c.set_recurse_func (Proxy::Lookup::apply_recurse_func); |
| 1006 | 1026 |
| 1007 for (unsigned int stage_index = 0; stage_index < stages[table_index].len; stag
e_index++) { | 1027 for (unsigned int stage_index = 0; stage_index < stages[table_index].len; stag
e_index++) { |
| 1008 const stage_map_t *stage = &stages[table_index][stage_index]; | 1028 const stage_map_t *stage = &stages[table_index][stage_index]; |
| 1009 for (; i < stage->last_lookup; i++) | 1029 for (; i < stage->last_lookup; i++) |
| 1010 { | 1030 { |
| 1011 #if 0 | |
| 1012 char buf[4096]; | |
| 1013 hb_buffer_serialize_glyphs (buffer, 0, buffer->len, | |
| 1014 buf, sizeof (buf), NULL, | |
| 1015 font, | |
| 1016 HB_BUFFER_SERIALIZE_FORMAT_TEXT, | |
| 1017 Proxy::table_index == 0 ? | |
| 1018 HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS : | |
| 1019 HB_BUFFER_SERIALIZE_FLAG_DEFAULT); | |
| 1020 printf ("buf: [%s]\n", buf); | |
| 1021 #endif | |
| 1022 | |
| 1023 unsigned int lookup_index = lookups[table_index][i].index; | 1031 unsigned int lookup_index = lookups[table_index][i].index; |
| 1032 if (!buffer->message (font, "start lookup %d", lookup_index)) continue; |
| 1024 c.set_lookup_index (lookup_index); | 1033 c.set_lookup_index (lookup_index); |
| 1025 c.set_lookup_mask (lookups[table_index][i].mask); | 1034 c.set_lookup_mask (lookups[table_index][i].mask); |
| 1026 c.set_auto_zwj (lookups[table_index][i].auto_zwj); | 1035 c.set_auto_zwj (lookups[table_index][i].auto_zwj); |
| 1027 apply_string<Proxy> (&c, | 1036 apply_string<Proxy> (&c, |
| 1028 proxy.table.get_lookup (lookup_index), | 1037 proxy.table.get_lookup (lookup_index), |
| 1029 proxy.accels[lookup_index]); | 1038 proxy.accels[lookup_index]); |
| 1039 (void) buffer->message (font, "end lookup %d", lookup_index); |
| 1030 } | 1040 } |
| 1031 | 1041 |
| 1032 if (stage->pause_func) | 1042 if (stage->pause_func) |
| 1033 { | 1043 { |
| 1034 buffer->clear_output (); | 1044 buffer->clear_output (); |
| 1035 stage->pause_func (plan, font, buffer); | 1045 stage->pause_func (plan, font, buffer); |
| 1036 } | 1046 } |
| 1037 } | 1047 } |
| 1038 } | 1048 } |
| 1039 | 1049 |
| 1040 void hb_ot_map_t::substitute (const hb_ot_shape_plan_t *plan, hb_font_t *font, h
b_buffer_t *buffer) const | 1050 void hb_ot_map_t::substitute (const hb_ot_shape_plan_t *plan, hb_font_t *font, h
b_buffer_t *buffer) const |
| 1041 { | 1051 { |
| 1042 GSUBProxy proxy (font->face); | 1052 GSUBProxy proxy (font->face); |
| 1043 apply (proxy, plan, font, buffer); | 1053 apply (proxy, plan, font, buffer); |
| 1044 } | 1054 } |
| 1045 | 1055 |
| 1046 void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_
buffer_t *buffer) const | 1056 void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_
buffer_t *buffer) const |
| 1047 { | 1057 { |
| 1048 GPOSProxy proxy (font->face); | 1058 GPOSProxy proxy (font->face); |
| 1049 apply (proxy, plan, font, buffer); | 1059 apply (proxy, plan, font, buffer); |
| 1050 } | 1060 } |
| 1051 | 1061 |
| 1052 HB_INTERNAL void | 1062 HB_INTERNAL void |
| 1053 hb_ot_layout_substitute_lookup (OT::hb_apply_context_t *c, | 1063 hb_ot_layout_substitute_lookup (OT::hb_apply_context_t *c, |
| 1054 const OT::SubstLookup &lookup, | 1064 const OT::SubstLookup &lookup, |
| 1055 const hb_ot_layout_lookup_accelerator_t &accel) | 1065 const hb_ot_layout_lookup_accelerator_t &accel) |
| 1056 { | 1066 { |
| 1057 apply_string<GSUBProxy> (c, lookup, accel); | 1067 apply_string<GSUBProxy> (c, lookup, accel); |
| 1058 } | 1068 } |
| OLD | NEW |