[ot-tags] Follow-up to previous commit
Part of https://github.com/harfbuzz/harfbuzz/issues/3591
This commit is contained in:
parent
f5d619be79
commit
e24797aeac
|
@ -994,12 +994,12 @@ print ('\t\t\t\t unsigned int *count /* IN/OUT */,')
|
|||
print ('\t\t\t\t hb_tag_t *tags /* OUT */)')
|
||||
print ('{')
|
||||
|
||||
def print_subtag_matches (subtag, new_line):
|
||||
def print_subtag_matches (subtag, string, new_line):
|
||||
if subtag:
|
||||
if new_line:
|
||||
print ()
|
||||
print ('\t&& ', end='')
|
||||
print ('subtag_matches (lang_str, limit, "-%s", %i)' % (subtag, 1 + len (subtag)), end='')
|
||||
print ('subtag_matches (%s, limit, "-%s", %i)' % (string, subtag, 1 + len (subtag)), end='')
|
||||
|
||||
complex_tags = collections.defaultdict (list)
|
||||
for initial, group in itertools.groupby ((lt_tags for lt_tags in [
|
||||
|
@ -1040,9 +1040,9 @@ for initial, items in sorted (complex_tags.items ()):
|
|||
expect (next (iter (bcp_47.prefixes[lt.variant])) == lt.language,
|
||||
'%s is not a valid prefix of %s' % (lt.language, lt.variant))
|
||||
print (' if (', end='')
|
||||
print_subtag_matches (lt.script, False)
|
||||
print_subtag_matches (lt.region, False)
|
||||
print_subtag_matches (lt.variant, False)
|
||||
print_subtag_matches (lt.script, 'p', False)
|
||||
print_subtag_matches (lt.region, 'p', False)
|
||||
print_subtag_matches (lt.variant, 'p', False)
|
||||
print (')')
|
||||
print (' {')
|
||||
write (' /* %s */' % bcp_47.get_name (lt))
|
||||
|
@ -1091,9 +1091,9 @@ for initial, items in sorted (complex_tags.items ()):
|
|||
print ('0 == strncmp (&lang_str[1], "%s", %i)' % (string_literal, len (string_literal)), end='')
|
||||
else:
|
||||
print ('lang_matches (&lang_str[1], limit, "%s", %i)' % (string_literal, len (string_literal)), end='')
|
||||
print_subtag_matches (script, True)
|
||||
print_subtag_matches (region, True)
|
||||
print_subtag_matches (lt.variant, True)
|
||||
print_subtag_matches (script, 'lang_str', True)
|
||||
print_subtag_matches (region, 'lang_str', True)
|
||||
print_subtag_matches (lt.variant, 'lang_str', True)
|
||||
print (')')
|
||||
print (' {')
|
||||
write (' /* %s */' % bcp_47.get_name (lt))
|
||||
|
|
|
@ -1647,63 +1647,63 @@ hb_ot_tags_from_complex_language (const char *lang_str,
|
|||
{
|
||||
const char *p = strchr (lang_str, '-');
|
||||
if (!p || p >= limit || limit - p < 5) goto out;
|
||||
if (subtag_matches (lang_str, limit, "-fonnapa", 8))
|
||||
if (subtag_matches (p, limit, "-fonnapa", 8))
|
||||
{
|
||||
/* Undetermined; North American Phonetic Alphabet */
|
||||
tags[0] = HB_TAG('A','P','P','H'); /* Phonetic transcription—Americanist conventions */
|
||||
*count = 1;
|
||||
return true;
|
||||
}
|
||||
if (subtag_matches (lang_str, limit, "-polyton", 8))
|
||||
if (subtag_matches (p, limit, "-polyton", 8))
|
||||
{
|
||||
/* Modern Greek (1453-); Polytonic Greek */
|
||||
tags[0] = HB_TAG('P','G','R',' '); /* Polytonic Greek */
|
||||
*count = 1;
|
||||
return true;
|
||||
}
|
||||
if (subtag_matches (lang_str, limit, "-arevmda", 8))
|
||||
if (subtag_matches (p, limit, "-arevmda", 8))
|
||||
{
|
||||
/* Armenian; Western Armenian (retired code) */
|
||||
tags[0] = HB_TAG('H','Y','E',' '); /* Armenian */
|
||||
*count = 1;
|
||||
return true;
|
||||
}
|
||||
if (subtag_matches (lang_str, limit, "-provenc", 8))
|
||||
if (subtag_matches (p, limit, "-provenc", 8))
|
||||
{
|
||||
/* Occitan (post 1500); Provençal */
|
||||
tags[0] = HB_TAG('P','R','O',' '); /* Provençal / Old Provençal */
|
||||
*count = 1;
|
||||
return true;
|
||||
}
|
||||
if (subtag_matches (lang_str, limit, "-fonipa", 7))
|
||||
if (subtag_matches (p, limit, "-fonipa", 7))
|
||||
{
|
||||
/* Undetermined; International Phonetic Alphabet */
|
||||
tags[0] = HB_TAG('I','P','P','H'); /* Phonetic transcription—IPA conventions */
|
||||
*count = 1;
|
||||
return true;
|
||||
}
|
||||
if (subtag_matches (lang_str, limit, "-geok", 5))
|
||||
if (subtag_matches (p, limit, "-geok", 5))
|
||||
{
|
||||
/* Undetermined; Khutsuri (Asomtavruli and Nuskhuri) */
|
||||
tags[0] = HB_TAG('K','G','E',' '); /* Khutsuri Georgian */
|
||||
*count = 1;
|
||||
return true;
|
||||
}
|
||||
if (subtag_matches (lang_str, limit, "-syre", 5))
|
||||
if (subtag_matches (p, limit, "-syre", 5))
|
||||
{
|
||||
/* Undetermined; Syriac (Estrangelo variant) */
|
||||
tags[0] = HB_TAG('S','Y','R','E'); /* Syriac, Estrangela script-variant (equivalent to ISO 15924 'Syre') */
|
||||
*count = 1;
|
||||
return true;
|
||||
}
|
||||
if (subtag_matches (lang_str, limit, "-syrj", 5))
|
||||
if (subtag_matches (p, limit, "-syrj", 5))
|
||||
{
|
||||
/* Undetermined; Syriac (Western variant) */
|
||||
tags[0] = HB_TAG('S','Y','R','J'); /* Syriac, Western script-variant (equivalent to ISO 15924 'Syrj') */
|
||||
*count = 1;
|
||||
return true;
|
||||
}
|
||||
if (subtag_matches (lang_str, limit, "-syrn", 5))
|
||||
if (subtag_matches (p, limit, "-syrn", 5))
|
||||
{
|
||||
/* Undetermined; Syriac (Eastern variant) */
|
||||
tags[0] = HB_TAG('S','Y','R','N'); /* Syriac, Eastern script-variant (equivalent to ISO 15924 'Syrn') */
|
||||
|
|
Loading…
Reference in New Issue