[util] Strip quotes when parsing features

When running in batch mode, the quotes are not stripped by the shell and
end up in the feature string. This breaks one of the AOTS tests.

Alternatively, we can remove the quotes from the test files, not sure
which is less hacky, though!
This commit is contained in:
Khaled Hosny 2021-07-28 15:56:53 +02:00 committed by Behdad Esfahbod
parent ad9559e3e2
commit 92b85749f2
2 changed files with 9 additions and 1 deletions

View File

@ -1 +1 @@
#../fonts/gsub3_1_simple_f1.otf:--features="-test[1],test[3],test[5]=2,test[7]=3,-test[9],test[11]" --no-clusters --no-glyph-names --no-positions:U+0011,U+0012,U+0011,U+0012,U+0011,U+0012,U+0011,U+0012,U+0011,U+0012,U+0011,U+0012,U+0011:[17|18|17|20|17|21|17|22|17|18|17|20|17]
../fonts/gsub3_1_simple_f1.otf:--features="-test[1],test[3],test[5]=2,test[7]=3,-test[9],test[11]" --no-clusters --no-glyph-names --no-positions:U+0011,U+0012,U+0011,U+0012,U+0011,U+0012,U+0011,U+0012,U+0011,U+0012,U+0011,U+0012,U+0011:[17|18|17|20|17|21|17|22|17|18|17|20|17]

View File

@ -258,12 +258,20 @@ parse_features (const char *name G_GNUC_UNUSED,
{
shape_options_t *shape_opts = (shape_options_t *) data;
char *s = (char *) arg;
size_t l = strlen (s);
char *p;
shape_opts->num_features = 0;
g_free (shape_opts->features);
shape_opts->features = nullptr;
/* if the string is quoted, strip the quotes */
if (s[0] == s[l - 1] && (s[0] == '\"' || s[0] == '\''))
{
s[l - 1] = '\0';
s++;
}
if (!*s)
return true;