提交 a795fe63 编写于 作者: B Behdad Esfahbod

Allow quotation marks around feature tag in hb_feature_from_string()

With this, I believe we accept CSS feature strings completely.
上级 3f646184
...@@ -117,16 +117,34 @@ parse_feature_tag (const char **pp, const char *end, hb_feature_t *feature) ...@@ -117,16 +117,34 @@ parse_feature_tag (const char **pp, const char *end, hb_feature_t *feature)
{ {
parse_space (pp, end); parse_space (pp, end);
const char *p = *pp; char quote = 0;
char c;
if (*pp < end && (**pp == '\'' || **pp == '"'))
{
quote = **pp;
(*pp)++;
}
while (*pp < end && (c = **pp, ISALNUM(c))) const char *p = *pp;
while (*pp < end && ISALNUM(**pp))
(*pp)++; (*pp)++;
if (p == *pp || *pp - p > 4) if (p == *pp || *pp - p > 4)
return false; return false;
feature->tag = hb_tag_from_string (p, *pp - p); feature->tag = hb_tag_from_string (p, *pp - p);
if (quote)
{
/* CSS expects exactly four bytes. And we only allow quotations for
* CSS compatibility. So, enforce the length. */
if (*pp - p != 4)
return false;
if (*pp == end || **pp != quote)
return false;
(*pp)++;
}
return true; return true;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册