diff options
author | George Williams <pfaedit@users.sourceforge.net> | 2011-03-16 15:46:18 -0700 |
---|---|---|
committer | George Williams <pfaedit@users.sourceforge.net> | 2011-03-16 15:46:18 -0700 |
commit | c852d958c10cfb1d7fe9f7014fc89774d2b14dc8 (patch) | |
tree | 515e9fdc0b216221f8c00f19a5c90a67ffc9940a | |
parent | 2ee8b0d5cc231695b91b4e6f210f362acc303a37 (diff) |
Patch by Khaled to feature file code. If a feature contained both multiple and single substitutions, then ff would lose the single subs. Instead change the single subs to multiples.
-rw-r--r-- | fontforge/featurefile.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/fontforge/featurefile.c b/fontforge/featurefile.c index 1ab2f076..c1d43233 100644 --- a/fontforge/featurefile.c +++ b/fontforge/featurefile.c @@ -5549,6 +5549,7 @@ static void fea_ParseFeatureDef(struct parseState *tok) { uint32 feat_tag; struct feat_item *item, *size_item = NULL; int type, ret; + int has_single, has_multiple; fea_ParseTag(tok); if ( tok->type!=tk_name || !tok->could_be_tag ) { @@ -5679,6 +5680,27 @@ return; } fea_end_statement(tok); + /* Now a multiple substitution may have a single destination. In which case*/ + /* it will look just like a single substitution. So if there are both */ + /* multiple and single subs in a feature, translate all the singles into */ + /* multiples */ + /* Another approach would be to make two lookups, but this is easier... */ + has_single = has_multiple = false; + for ( item=tok->sofar ; item!=NULL && item->type!=ft_lookup_start; item=item->next ) { + enum otlookup_type cur = fea_LookupTypeFromItem(item); + if ( cur==gsub_multiple ) + has_multiple = true; + else if ( cur==gsub_single ) + has_single = true; + } + if ( has_multiple && has_single ) { + for ( item=tok->sofar ; item!=NULL && item->type!=ft_lookup_start; item=item->next ) { + enum otlookup_type cur = fea_LookupTypeFromItem(item); + if ( cur==gsub_single ) + item->u2.pst->type = pst_multiple; + } + } + item = chunkalloc(sizeof(struct feat_item)); item->type = ft_feat_end; item->u1.tag = feat_tag; |