[feaLib] Emit spaces around hyphens in ranges

This commit is contained in:
David Corbett 2020-04-03 17:36:34 -04:00
parent e7fd47336d
commit ec4273bbfd
12 changed files with 17 additions and 17 deletions

View File

@ -109,7 +109,7 @@ def asFea(g):
if hasattr(g, 'asFea'):
return g.asFea()
elif isinstance(g, tuple) and len(g) == 2:
return asFea(g[0]) + "-" + asFea(g[1]) # a range
return asFea(g[0]) + " - " + asFea(g[1]) # a range
elif g.lower() in fea_keywords:
return "\\" + g
else:

View File

@ -1,7 +1,7 @@
feature test {
pos X [A-B]' -40 B' -40 A' -40 Y;
pos X [A - B]' -40 B' -40 A' -40 Y;
subtable;
pos X A' -111 Y;
subtable;
pos X B' -40 A' -111 [A-C]' -40 Y;
pos X B' -40 A' -111 [A - C]' -40 Y;
} test;

View File

@ -1,10 +1,10 @@
lookup ChainedSingleSubst {
sub [one two] three A' by A.sc;
sub [B-D]' seven [eight nine] by [B.sc-D.sc];
sub [B - D]' seven [eight nine] by [B.sc - D.sc];
} ChainedSingleSubst;
lookup ChainedMultipleSubst {
sub [A-C a-c] [D d] E c_t' V [W w] [X-Z x-z] by c t;
sub [A - C a - c] [D d] E c_t' V [W w] [X - Z x - z] by c t;
} ChainedMultipleSubst;
lookup ChainedAlternateSubst {

View File

@ -2,7 +2,7 @@ languagesystem DFLT dflt;
feature test {
rsub [a A] [b B] [c C] q' [d D] [e E] [f F] by Q;
rsub [a A] [b B] [c C] [s-z]' [d D] [e E] [f F] by [S-Z];
rsub [a A] [b B] [c C] [s - z]' [d D] [e E] [f F] by [S - Z];
# Having no context for a reverse chaining substitution rule
# is a little degenerate (we define a chain without linking it

View File

@ -5,7 +5,7 @@
# makeotf produces {A:-40, B:-40, C:-40} and {A:-111, B:-40} which
# is redundant. https://github.com/adobe-type-tools/afdko/issues/169
feature test {
pos X [A-B]' -40 B' -40 A' -40 Y;
pos X [A - B]' -40 B' -40 A' -40 Y;
pos X A' -111 Y;
pos X B' -40 A' -111 [A-C]' -40 Y;
pos X B' -40 A' -111 [A - C]' -40 Y;
} test;

View File

@ -18,5 +18,5 @@ feature liga {
} liga;
feature scmp {
sub [a-z] by [A.sc-Z.sc];
sub [a - z] by [A.sc - Z.sc];
} scmp;

View File

@ -8,7 +8,7 @@ languagesystem latn TRK;
languagesystem cyrl dflt;
feature smcp {
sub [a-z] by [A.sc-Z.sc];
sub [a - z] by [A.sc - Z.sc];
# Since all the rules in this feature are of the same type, they
# will be grouped in a single lookup. Since no script or language

View File

@ -3,7 +3,7 @@
# http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html
feature test {
@LETTER = [a-z];
@LETTER = [a - z];
ignore sub @LETTER f' i';
sub f' i' by f_i.begin;
} test;

View File

@ -3,7 +3,7 @@
# http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html
feature test {
@LETTER = [a-z];
@LETTER = [a - z];
ignore sub @LETTER a' n' d', a' n' d' @LETTER;
sub a' n' d' by a_n_d;
} test;

View File

@ -2,13 +2,13 @@
# "Specifying exceptions to the Chain Sub rule"
# http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html
@LETTER = [A-Z a-z];
@LETTER = [A - Z a - z];
feature cswh {
# --- Glyph classes used in this feature:
@BEGINNINGS = [A-N P-Z T_h m];
@BEGINNINGS_SWASH = [A.swash-N.swash P.swash-Z.swash T_h.swash m.begin];
@BEGINNINGS = [A - N P - Z T_h m];
@BEGINNINGS_SWASH = [A.swash - N.swash P.swash - Z.swash T_h.swash m.begin];
@ENDINGS = [a e z];
@ENDINGS_SWASH = [a.end e.end z.end];

View File

@ -5,5 +5,5 @@
languagesystem latn dflt;
feature test {
sub [A-Z] [A.sc-Z.sc]' by [a-z];
sub [A - Z] [A.sc - Z.sc]' by [a - z];
} test;

View File

@ -10,7 +10,7 @@ feature aalt {
} aalt;
feature smcp {
sub [a-c] by [A.sc-C.sc];
sub [a - c] by [A.sc - C.sc];
sub f i by f_i; # not considered for aalt
} smcp;