Restructure code
This commit is contained in:
parent
d2ff73b256
commit
f642a5fa6c
|
@ -305,28 +305,24 @@ parse_private_use_subtag (const char *private_use_subtag,
|
||||||
const char *prefix,
|
const char *prefix,
|
||||||
unsigned char (*normalize) (unsigned char))
|
unsigned char (*normalize) (unsigned char))
|
||||||
{
|
{
|
||||||
if (private_use_subtag && count && tags && *count)
|
if (!(private_use_subtag && count && tags && *count)) return false;
|
||||||
{
|
|
||||||
const char *s = strstr (private_use_subtag, prefix);
|
const char *s = strstr (private_use_subtag, prefix);
|
||||||
if (s)
|
if (!s) return false;
|
||||||
{
|
|
||||||
char tag[4];
|
char tag[4];
|
||||||
int i;
|
int i;
|
||||||
s += strlen (prefix);
|
s += strlen (prefix);
|
||||||
for (i = 0; i < 4 && ISALNUM (s[i]); i++)
|
for (i = 0; i < 4 && ISALNUM (s[i]); i++)
|
||||||
tag[i] = normalize (s[i]);
|
tag[i] = normalize (s[i]);
|
||||||
if (i)
|
if (!i) return false;
|
||||||
{
|
|
||||||
for (; i < 4; i++)
|
for (; i < 4; i++)
|
||||||
tag[i] = ' ';
|
tag[i] = ' ';
|
||||||
tags[0] = HB_TAG (tag[0], tag[1], tag[2], tag[3]);
|
tags[0] = HB_TAG (tag[0], tag[1], tag[2], tag[3]);
|
||||||
if ((tags[0] & 0xDFDFDFDF) == HB_OT_TAG_DEFAULT_SCRIPT)
|
if ((tags[0] & 0xDFDFDFDF) == HB_OT_TAG_DEFAULT_SCRIPT)
|
||||||
tags[0] ^= ~0xDFDFDFDF;
|
tags[0] ^= ~0xDFDFDFDF;
|
||||||
*count = 1;
|
*count = 1;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,8 +390,8 @@ hb_ot_tags_from_script_and_language (hb_script_t script,
|
||||||
limit = s;
|
limit = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
needs_script = parse_private_use_subtag (private_use_subtag, script_count, script_tags, "-hbsc", TOLOWER);
|
needs_script = !parse_private_use_subtag (private_use_subtag, script_count, script_tags, "-hbsc", TOLOWER);
|
||||||
needs_language = parse_private_use_subtag (private_use_subtag, language_count, language_tags, "-hbot", TOUPPER);
|
needs_language = !parse_private_use_subtag (private_use_subtag, language_count, language_tags, "-hbot", TOUPPER);
|
||||||
|
|
||||||
if (needs_language && language_count && language_tags && *language_count)
|
if (needs_language && language_count && language_tags && *language_count)
|
||||||
hb_ot_tags_from_language (lang_str, limit, language_count, language_tags);
|
hb_ot_tags_from_language (lang_str, limit, language_count, language_tags);
|
||||||
|
|
Loading…
Reference in New Issue