Hello everyone
I am new to Typophile and this is my first post. I am glad to be here. I have an OpenType features related problem. I want to make the following substitutions:
1 + 0 with a glyph called 1_0
1 + 0 + 0 with a glyph called 1_0_0 and
1 + 0 + 0 + 0 with a glyph called 1_0_0_0
(1 and 0 can be replaced by any digit - see code below)
I work in Fontlab Studio 5 and I at first I wrote the following code:
# glyph classes
@digitsnozero=[one two three four five six seven eight nine];
@digits=[zero one two three four five six seven eight nine];
@twodigits=[X X_X X_X_X X_L L L_X L_X_X L_X_X_X X_C];
@threedigits=[C C_C C_C_C C_C_C_C D D_C D_C_C D_C_C_C D_C_C_C_C];
@fourdigits=[M M_M M_M_M M_M_M_M];
feature liga {
# substitutions for two digits
sub @digitsnozero’ @digits by @twodigits;
# substitutions for three digits
sub @digitsnozero’ [@digits @twodigits @threedigits] @digits by @threedigits;
# substitutions for four digits
sub [one two three four]’ [@digits @twodigits @threedigits]
@digits @digits by @fourdigits;
} liga;
The problem is that when the first rule is activated the other two are ignored. As a result I only get the first substitution (1 + 0 -> 1_0)
I solved the problem by putting each rule in a different feature (the first in onum, the second in smcp and the third in liga - it works).
So now I have the following:
feature onum {
# substitutions for two digits
sub @digitsnozero’ @digits by @twodigits;
} onum;
feature smcp {
# substitutions for three digits
sub @digitsnozero’ [@digits @twodigits @threedigits] @digits by @threedigits;
} smcp;
feature liga {
# substitutions for four digits
sub [one two three four]’ [@digits @twodigits @threedigits] @digits @digits by @fourdigits;
} liga;
I read in the OpenType specification about the Chaining Context Substitution but I did not understand how am I supposed to do it.
Can anyone tell me if I can put all the three rules in one feature (e.g. in a liga feature)? Can I do anything with ‘lookup’?
George Triantafyllakos - backpacker.gr