Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: third_party/harfbuzz-ng/src/hb-ot-tag.cc

Issue 1408003004: Roll harfbuzz-ng to 1.0.5 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2526
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright © 2009 Red Hat, Inc. 2 * Copyright © 2009 Red Hat, Inc.
3 * Copyright © 2011 Google, Inc. 3 * Copyright © 2011 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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 /*{"ahg/awn/xan?", HB_TAG('A','G','W',' ')},*/ /* Agaw */ 726 /*{"ahg/awn/xan?", HB_TAG('A','G','W',' ')},*/ /* Agaw */
727 /*{"gsw?/gsw-FR?", HB_TAG('A','L','S',' ')},*/ /* Alsatian */ 727 /*{"gsw?/gsw-FR?", HB_TAG('A','L','S',' ')},*/ /* Alsatian */
728 /*{"krc", HB_TAG('B','A','L',' ')},*/ /* Balkar */ 728 /*{"krc", HB_TAG('B','A','L',' ')},*/ /* Balkar */
729 /*{"??", HB_TAG('B','C','R',' ')},*/ /* Bible Cree */ 729 /*{"??", HB_TAG('B','C','R',' ')},*/ /* Bible Cree */
730 /*{"zh?", HB_TAG('C','H','N',' ')},*/ /* Chinese (seen in Microsoft fo nts) */ 730 /*{"zh?", HB_TAG('C','H','N',' ')},*/ /* Chinese (seen in Microsoft fo nts) */
731 /*{"acf/gcf?", HB_TAG('F','A','N',' ')},*/ /* French Antillean */ 731 /*{"acf/gcf?", HB_TAG('F','A','N',' ')},*/ /* French Antillean */
732 /*{"enf?/yrk?", HB_TAG('F','N','E',' ')},*/ /* Forest Nenets */ 732 /*{"enf?/yrk?", HB_TAG('F','N','E',' ')},*/ /* Forest Nenets */
733 /*{"fuf?", HB_TAG('F','T','A',' ')},*/ /* Futa */ 733 /*{"fuf?", HB_TAG('F','T','A',' ')},*/ /* Futa */
734 /*{"ar-Syrc?", HB_TAG('G','A','R',' ')},*/ /* Garshuni */ 734 /*{"ar-Syrc?", HB_TAG('G','A','R',' ')},*/ /* Garshuni */
735 /*{"cfm/rnl?", HB_TAG('H','A','L',' ')},*/ /* Halam */ 735 /*{"cfm/rnl?", HB_TAG('H','A','L',' ')},*/ /* Halam */
736 /*{"fonipa", HB_TAG('I','P','P','H')},*/ /* Phonetic transcription—IPA co nventions */
737 /*{"ga-Latg?/Latg?", HB_TAG('I','R','T',' ')},*/ /* Irish Traditional */ 736 /*{"ga-Latg?/Latg?", HB_TAG('I','R','T',' ')},*/ /* Irish Traditional */
738 /*{"krc", HB_TAG('K','A','R',' ')},*/ /* Karachay */ 737 /*{"krc", HB_TAG('K','A','R',' ')},*/ /* Karachay */
739 /*{"alw?/ktb?", HB_TAG('K','E','B',' ')},*/ /* Kebena */ 738 /*{"alw?/ktb?", HB_TAG('K','E','B',' ')},*/ /* Kebena */
740 /*{"Geok", HB_TAG('K','G','E',' ')},*/ /* Khutsuri Georgian */ 739 /*{"Geok", HB_TAG('K','G','E',' ')},*/ /* Khutsuri Georgian */
741 /*{"kca", HB_TAG('K','H','K',' ')},*/ /* Khanty-Kazim */ 740 /*{"kca", HB_TAG('K','H','K',' ')},*/ /* Khanty-Kazim */
742 /*{"kca", HB_TAG('K','H','S',' ')},*/ /* Khanty-Shurishkar */ 741 /*{"kca", HB_TAG('K','H','S',' ')},*/ /* Khanty-Shurishkar */
743 /*{"kca", HB_TAG('K','H','V',' ')},*/ /* Khanty-Vakhi */ 742 /*{"kca", HB_TAG('K','H','V',' ')},*/ /* Khanty-Vakhi */
744 /*{"guz?/kqs?/kss?", HB_TAG('K','I','S',' ')},*/ /* Kisii */ 743 /*{"guz?/kqs?/kss?", HB_TAG('K','I','S',' ')},*/ /* Kisii */
745 /*{"kfa/kfi?/kpb?/xua?/xuj?", HB_TAG('K','O','D',' ')},*/ /* Kodagu */ 744 /*{"kfa/kfi?/kpb?/xua?/xuj?", HB_TAG('K','O','D',' ')},*/ /* Kodagu */
746 /*{"okm?/oko?", HB_TAG('K','O','H',' ')},*/ /* Korean Old Hangul */ 745 /*{"okm?/oko?", HB_TAG('K','O','H',' ')},*/ /* Korean Old Hangul */
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 s += 6; 824 s += 6;
826 for (i = 0; i < 4 && ISALPHA (s[i]); i++) 825 for (i = 0; i < 4 && ISALPHA (s[i]); i++)
827 tag[i] = TOUPPER (s[i]); 826 tag[i] = TOUPPER (s[i]);
828 if (i) { 827 if (i) {
829 for (; i < 4; i++) 828 for (; i < 4; i++)
830 tag[i] = ' '; 829 tag[i] = ' ';
831 return HB_TAG_CHAR4 (tag); 830 return HB_TAG_CHAR4 (tag);
832 } 831 }
833 } 832 }
834 833
834 /*
835 * The International Phonetic Alphabet is a variant tag in BCP-47,
836 * which can be applied to any language.
837 */
838 if (strstr (lang_str, "-fonipa")) {
839 return HB_TAG('I','P','P','H'); /* Phonetic transcription—IPA conventions * /
840 }
841
835 /* Find a language matching in the first component */ 842 /* Find a language matching in the first component */
836 { 843 {
837 const LangTag *lang_tag; 844 const LangTag *lang_tag;
838 lang_tag = (LangTag *) bsearch (lang_str, ot_languages, 845 lang_tag = (LangTag *) bsearch (lang_str, ot_languages,
839 ARRAY_LENGTH (ot_languages), sizeof (LangTag ), 846 ARRAY_LENGTH (ot_languages), sizeof (LangTag ),
840 (hb_compare_func_t) lang_compare_first_compo nent); 847 (hb_compare_func_t) lang_compare_first_compo nent);
841 if (lang_tag) 848 if (lang_tag)
842 return lang_tag->tag; 849 return lang_tag->tag;
843 } 850 }
844 851
(...skipping 25 matching lines...) Expand all
870 return HB_OT_TAG_DEFAULT_LANGUAGE; 877 return HB_OT_TAG_DEFAULT_LANGUAGE;
871 } 878 }
872 879
873 /** 880 /**
874 * hb_ot_tag_to_language: 881 * hb_ot_tag_to_language:
875 * 882 *
876 * 883 *
877 * 884 *
878 * Return value: (transfer none): 885 * Return value: (transfer none):
879 * 886 *
880 * Since: 1.0 887 * Since: 0.9.2
881 **/ 888 **/
882 hb_language_t 889 hb_language_t
883 hb_ot_tag_to_language (hb_tag_t tag) 890 hb_ot_tag_to_language (hb_tag_t tag)
884 { 891 {
885 unsigned int i; 892 unsigned int i;
886 893
887 if (tag == HB_OT_TAG_DEFAULT_LANGUAGE) 894 if (tag == HB_OT_TAG_DEFAULT_LANGUAGE)
888 return NULL; 895 return NULL;
889 896
890 for (i = 0; i < ARRAY_LENGTH (ot_languages); i++) 897 for (i = 0; i < ARRAY_LENGTH (ot_languages); i++)
891 if (ot_languages[i].tag == tag) 898 if (ot_languages[i].tag == tag)
892 return hb_language_from_string (ot_languages[i].language, -1); 899 return hb_language_from_string (ot_languages[i].language, -1);
893 900
894 /* If tag starts with ZH, it's Chinese */ 901 /* If tag starts with ZH, it's Chinese */
895 if ((tag & 0xFFFF0000u) == 0x5A480000u) { 902 if ((tag & 0xFFFF0000u) == 0x5A480000u) {
896 switch (tag) { 903 switch (tag) {
897 case HB_TAG('Z','H','H',' '): return hb_language_from_string ("zh-hk", -1) ; /* Hong Kong */ 904 case HB_TAG('Z','H','H',' '): return hb_language_from_string ("zh-hk", -1) ; /* Hong Kong */
898 case HB_TAG('Z','H','S',' '): return hb_language_from_string ("zh-Hans", - 1); /* Simplified */ 905 case HB_TAG('Z','H','S',' '): return hb_language_from_string ("zh-Hans", - 1); /* Simplified */
899 case HB_TAG('Z','H','T',' '): return hb_language_from_string ("zh-Hant", - 1); /* Traditional */ 906 case HB_TAG('Z','H','T',' '): return hb_language_from_string ("zh-Hant", - 1); /* Traditional */
900 default: break; /* Fall through */ 907 default: break; /* Fall through */
901 } 908 }
902 } 909 }
903 910
911 /* struct LangTag has only room for 3-letter language tags. */
912 switch (tag) {
913 case HB_TAG('I','P','P','H'): /* Phonetic transcription—IPA conventions */
914 return hb_language_from_string ("und-fonipa", -1);
915 }
916
904 /* Else return a custom language in the form of "x-hbotABCD" */ 917 /* Else return a custom language in the form of "x-hbotABCD" */
905 { 918 {
906 unsigned char buf[11] = "x-hbot"; 919 unsigned char buf[11] = "x-hbot";
907 buf[6] = tag >> 24; 920 buf[6] = tag >> 24;
908 buf[7] = (tag >> 16) & 0xFF; 921 buf[7] = (tag >> 16) & 0xFF;
909 buf[8] = (tag >> 8) & 0xFF; 922 buf[8] = (tag >> 8) & 0xFF;
910 buf[9] = tag & 0xFF; 923 buf[9] = tag & 0xFF;
911 if (buf[9] == 0x20) 924 if (buf[9] == 0x20)
912 buf[9] = '\0'; 925 buf[9] = '\0';
913 buf[10] = '\0'; 926 buf[10] = '\0';
914 return hb_language_from_string ((char *) buf, -1); 927 return hb_language_from_string ((char *) buf, -1);
915 } 928 }
916 } 929 }
917 930
918 931
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-ot-shape-normalize.cc ('k') | third_party/harfbuzz-ng/src/hb-private.hh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698