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 Google, Inc. | 5 * Copyright © 2012 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 hb_tag_t table_tag, | 178 hb_tag_t table_tag, |
179 unsigned int start_offset, | 179 unsigned int start_offset, |
180 unsigned int *script_count /* IN/OUT */, | 180 unsigned int *script_count /* IN/OUT */, |
181 hb_tag_t *script_tags /* OUT */) | 181 hb_tag_t *script_tags /* OUT */) |
182 { | 182 { |
183 const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); | 183 const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); |
184 | 184 |
185 return g.get_script_tags (start_offset, script_count, script_tags); | 185 return g.get_script_tags (start_offset, script_count, script_tags); |
186 } | 186 } |
187 | 187 |
| 188 #define HB_OT_TAG_LATIN_SCRIPT HB_TAG ('l', 'a', 't', 'n') |
| 189 |
188 hb_bool_t | 190 hb_bool_t |
189 hb_ot_layout_table_find_script (hb_face_t *face, | 191 hb_ot_layout_table_find_script (hb_face_t *face, |
190 hb_tag_t table_tag, | 192 hb_tag_t table_tag, |
191 hb_tag_t script_tag, | 193 hb_tag_t script_tag, |
192 unsigned int *script_index) | 194 unsigned int *script_index) |
193 { | 195 { |
194 ASSERT_STATIC (OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX); | 196 ASSERT_STATIC (OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX); |
195 const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); | 197 const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag); |
196 | 198 |
197 if (g.find_script_index (script_tag, script_index)) | 199 if (g.find_script_index (script_tag, script_index)) |
198 return true; | 200 return true; |
199 | 201 |
200 /* try finding 'DFLT' */ | 202 /* try finding 'DFLT' */ |
201 if (g.find_script_index (HB_OT_TAG_DEFAULT_SCRIPT, script_index)) | 203 if (g.find_script_index (HB_OT_TAG_DEFAULT_SCRIPT, script_index)) |
202 return false; | 204 return false; |
203 | 205 |
204 /* try with 'dflt'; MS site has had typos and many fonts use it now :(. | 206 /* try with 'dflt'; MS site has had typos and many fonts use it now :(. |
205 * including many versions of DejaVu Sans Mono! */ | 207 * including many versions of DejaVu Sans Mono! */ |
206 if (g.find_script_index (HB_OT_TAG_DEFAULT_LANGUAGE, script_index)) | 208 if (g.find_script_index (HB_OT_TAG_DEFAULT_LANGUAGE, script_index)) |
207 return false; | 209 return false; |
208 | 210 |
| 211 /* try with 'latn'; some old fonts put their features there even though |
| 212 they're really trying to support Thai, for example :( */ |
| 213 if (g.find_script_index (HB_OT_TAG_LATIN_SCRIPT, script_index)) |
| 214 return false; |
| 215 |
209 if (script_index) *script_index = HB_OT_LAYOUT_NO_SCRIPT_INDEX; | 216 if (script_index) *script_index = HB_OT_LAYOUT_NO_SCRIPT_INDEX; |
210 return false; | 217 return false; |
211 } | 218 } |
212 | 219 |
213 hb_bool_t | 220 hb_bool_t |
214 hb_ot_layout_table_choose_script (hb_face_t *face, | 221 hb_ot_layout_table_choose_script (hb_face_t *face, |
215 hb_tag_t table_tag, | 222 hb_tag_t table_tag, |
216 const hb_tag_t *script_tags, | 223 const hb_tag_t *script_tags, |
217 unsigned int *script_index, | 224 unsigned int *script_index, |
218 hb_tag_t *chosen_script) | 225 hb_tag_t *chosen_script) |
(...skipping 20 matching lines...) Expand all Loading... |
239 | 246 |
240 /* try with 'dflt'; MS site has had typos and many fonts use it now :( */ | 247 /* try with 'dflt'; MS site has had typos and many fonts use it now :( */ |
241 if (g.find_script_index (HB_OT_TAG_DEFAULT_LANGUAGE, script_index)) { | 248 if (g.find_script_index (HB_OT_TAG_DEFAULT_LANGUAGE, script_index)) { |
242 if (chosen_script) | 249 if (chosen_script) |
243 *chosen_script = HB_OT_TAG_DEFAULT_LANGUAGE; | 250 *chosen_script = HB_OT_TAG_DEFAULT_LANGUAGE; |
244 return false; | 251 return false; |
245 } | 252 } |
246 | 253 |
247 /* try with 'latn'; some old fonts put their features there even though | 254 /* try with 'latn'; some old fonts put their features there even though |
248 they're really trying to support Thai, for example :( */ | 255 they're really trying to support Thai, for example :( */ |
249 #define HB_OT_TAG_LATIN_SCRIPT HB_TAG ('l', 'a', 't', 'n') | |
250 if (g.find_script_index (HB_OT_TAG_LATIN_SCRIPT, script_index)) { | 256 if (g.find_script_index (HB_OT_TAG_LATIN_SCRIPT, script_index)) { |
251 if (chosen_script) | 257 if (chosen_script) |
252 *chosen_script = HB_OT_TAG_LATIN_SCRIPT; | 258 *chosen_script = HB_OT_TAG_LATIN_SCRIPT; |
253 return false; | 259 return false; |
254 } | 260 } |
255 | 261 |
256 if (script_index) *script_index = HB_OT_LAYOUT_NO_SCRIPT_INDEX; | 262 if (script_index) *script_index = HB_OT_LAYOUT_NO_SCRIPT_INDEX; |
257 if (chosen_script) | 263 if (chosen_script) |
258 *chosen_script = HB_OT_LAYOUT_NO_SCRIPT_INDEX; | 264 *chosen_script = HB_OT_LAYOUT_NO_SCRIPT_INDEX; |
259 return false; | 265 return false; |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 void | 659 void |
654 hb_ot_layout_substitute_start (hb_font_t *font, hb_buffer_t *buffer) | 660 hb_ot_layout_substitute_start (hb_font_t *font, hb_buffer_t *buffer) |
655 { | 661 { |
656 OT::GSUB::substitute_start (font, buffer); | 662 OT::GSUB::substitute_start (font, buffer); |
657 } | 663 } |
658 | 664 |
659 hb_bool_t | 665 hb_bool_t |
660 hb_ot_layout_substitute_lookup (hb_font_t *font, | 666 hb_ot_layout_substitute_lookup (hb_font_t *font, |
661 hb_buffer_t *buffer, | 667 hb_buffer_t *buffer, |
662 unsigned int lookup_index, | 668 unsigned int lookup_index, |
663 » » » » hb_mask_t mask) | 669 » » » » hb_mask_t mask, |
| 670 » » » » hb_bool_t auto_zwj) |
664 { | 671 { |
665 if (unlikely (lookup_index >= hb_ot_layout_from_face (font->face)->gsub_lookup
_count)) return false; | 672 if (unlikely (lookup_index >= hb_ot_layout_from_face (font->face)->gsub_lookup
_count)) return false; |
666 | 673 |
667 OT::hb_apply_context_t c (font, buffer, mask); | 674 OT::hb_apply_context_t c (0, font, buffer, mask, auto_zwj); |
668 | 675 |
669 const OT::SubstLookup& l = hb_ot_layout_from_face (font->face)->gsub->get_look
up (lookup_index); | 676 const OT::SubstLookup& l = hb_ot_layout_from_face (font->face)->gsub->get_look
up (lookup_index); |
670 | 677 |
671 return l.apply_string (&c, &hb_ot_layout_from_face (font->face)->gsub_digests[
lookup_index]); | 678 return l.apply_string (&c, &hb_ot_layout_from_face (font->face)->gsub_digests[
lookup_index]); |
672 } | 679 } |
673 | 680 |
674 void | 681 void |
675 hb_ot_layout_substitute_finish (hb_font_t *font, hb_buffer_t *buffer) | 682 hb_ot_layout_substitute_finish (hb_font_t *font, hb_buffer_t *buffer) |
676 { | 683 { |
677 OT::GSUB::substitute_finish (font, buffer); | 684 OT::GSUB::substitute_finish (font, buffer); |
(...skipping 24 matching lines...) Expand all Loading... |
702 void | 709 void |
703 hb_ot_layout_position_start (hb_font_t *font, hb_buffer_t *buffer) | 710 hb_ot_layout_position_start (hb_font_t *font, hb_buffer_t *buffer) |
704 { | 711 { |
705 OT::GPOS::position_start (font, buffer); | 712 OT::GPOS::position_start (font, buffer); |
706 } | 713 } |
707 | 714 |
708 hb_bool_t | 715 hb_bool_t |
709 hb_ot_layout_position_lookup (hb_font_t *font, | 716 hb_ot_layout_position_lookup (hb_font_t *font, |
710 hb_buffer_t *buffer, | 717 hb_buffer_t *buffer, |
711 unsigned int lookup_index, | 718 unsigned int lookup_index, |
712 » » » hb_mask_t mask) | 719 » » » hb_mask_t mask, |
| 720 » » » hb_bool_t auto_zwj) |
713 { | 721 { |
714 if (unlikely (lookup_index >= hb_ot_layout_from_face (font->face)->gpos_lookup
_count)) return false; | 722 if (unlikely (lookup_index >= hb_ot_layout_from_face (font->face)->gpos_lookup
_count)) return false; |
715 | 723 |
716 OT::hb_apply_context_t c (font, buffer, mask); | 724 OT::hb_apply_context_t c (1, font, buffer, mask, auto_zwj); |
717 | 725 |
718 const OT::PosLookup& l = hb_ot_layout_from_face (font->face)->gpos->get_lookup
(lookup_index); | 726 const OT::PosLookup& l = hb_ot_layout_from_face (font->face)->gpos->get_lookup
(lookup_index); |
719 | 727 |
720 return l.apply_string (&c, &hb_ot_layout_from_face (font->face)->gpos_digests[
lookup_index]); | 728 return l.apply_string (&c, &hb_ot_layout_from_face (font->face)->gpos_digests[
lookup_index]); |
721 } | 729 } |
722 | 730 |
723 void | 731 void |
724 hb_ot_layout_position_finish (hb_font_t *font, hb_buffer_t *buffer, hb_bool_t ze
ro_width_attached_marks) | 732 hb_ot_layout_position_finish (hb_font_t *font, hb_buffer_t *buffer) |
725 { | 733 { |
726 OT::GPOS::position_finish (font, buffer, zero_width_attached_marks); | 734 OT::GPOS::position_finish (font, buffer); |
727 } | 735 } |
728 | 736 |
729 hb_bool_t | 737 hb_bool_t |
730 hb_ot_layout_get_size_params (hb_face_t *face, | 738 hb_ot_layout_get_size_params (hb_face_t *face, |
731 unsigned int *design_size, /* OUT. May be N
ULL */ | 739 unsigned int *design_size, /* OUT. May be N
ULL */ |
732 unsigned int *subfamily_id, /* OUT. May be N
ULL */ | 740 unsigned int *subfamily_id, /* OUT. May be N
ULL */ |
733 unsigned int *subfamily_name_id, /* OUT. May be N
ULL */ | 741 unsigned int *subfamily_name_id, /* OUT. May be N
ULL */ |
734 unsigned int *range_start, /* OUT. May be N
ULL */ | 742 unsigned int *range_start, /* OUT. May be N
ULL */ |
735 unsigned int *range_end /* OUT. May be N
ULL */) | 743 unsigned int *range_end /* OUT. May be N
ULL */) |
736 { | 744 { |
(...skipping 26 matching lines...) Expand all Loading... |
763 #define PARAM(a, A) if (a) *a = 0 | 771 #define PARAM(a, A) if (a) *a = 0 |
764 PARAM (design_size, designSize); | 772 PARAM (design_size, designSize); |
765 PARAM (subfamily_id, subfamilyID); | 773 PARAM (subfamily_id, subfamilyID); |
766 PARAM (subfamily_name_id, subfamilyNameID); | 774 PARAM (subfamily_name_id, subfamilyNameID); |
767 PARAM (range_start, rangeStart); | 775 PARAM (range_start, rangeStart); |
768 PARAM (range_end, rangeEnd); | 776 PARAM (range_end, rangeEnd); |
769 #undef PARAM | 777 #undef PARAM |
770 | 778 |
771 return false; | 779 return false; |
772 } | 780 } |
OLD | NEW |