I am thinking of starting from a copy of the Learning_ordn_001.otf font from the following thread, using a project file Learning_calt_001.fcp to produce a font.
I would like to start by substituting a t with t.longbar if the t is followed by any of a c e g m n o p q s u v w x y z and by substituting a y with y.swashtail if the y follows any of a b c d e h k m n o s u v w x z.
The script below is one example on how to achieve this, but there are actually several ways to do it.
Please note that I also added the t.longbar back to the input for the “y”. This will result in the combination of “ty” to be substituted by the alternates as well:
script latn {
# Latin
feature ContextualAlternates1;
}
feature ContextualAlternates1 calt {
lookup LookupCalt1;
}
group @CaltTInput [a c e g m n o p q s u v w x y z];
group @CaltTMatch [t];
group @CaltYInput [a b c d e h k m n o s u v w x z t.longbar];
group @CaltYMatch [y];
lookup LookupCalt1 {
context @CaltTMatch (@CaltTInput);
sub 0 LookupCaltReplace;
context (@CaltYInput) @CaltYMatch;
sub 0 LookupCaltReplace;
}
lookup LookupCaltReplace {
sub t -> t.longbar;
sub y -> y.swashtail;
}
I have been experimenting and a font with the following code and a few extra glyphs works well in Serif PagePlus X5.
Please note particularly the f.both glyph substitution accessed using three items in the context line of the code.
script latn {
# Latin
feature ContextualAlternates1;
}
feature ContextualAlternates1 calt {
lookup LookupCalt1;
}
group @CaltTInput [a c e g m n o p q s u v w x y z];
group @CaltTMatch [t];
group @CaltPInput [a e o u];
group @CaltPMatch [p];
group @CaltGInput [a b c d e h k m n o s t u v w x z t.longbar];
group @CaltGMatch [g];
group @CaltYInput [a b c d e h k m n o s t u v w x z t.longbar];
group @CaltYMatch [y];
group @CaltFMatch [f];
lookup LookupCalt1 {
context (@CaltYInput) @CaltFMatch (@CaltTInput);
sub 0 LookupCaltReplace2;
context @CaltTMatch (@CaltTInput);
sub 0 LookupCaltReplace;
context (@CaltYInput) @CaltYMatch;
sub 0 LookupCaltReplace;
context @CaltPMatch (@CaltPInput);
sub 0 LookupCaltReplace;
context (@CaltGInput) @CaltGMatch;
sub 0 LookupCaltReplace;
}
lookup LookupCaltReplace {
sub p -> p.swash;
sub t -> t.longbar;
sub g -> g.swashtail;
sub y -> y.swashtail;
}
lookup LookupCaltReplace2 {
sub f -> f.both;
}
No. I have just tried it as follows and it works in PagePlus X5.
script latn {
# Latin
feature ContextualAlternates1;
}
feature ContextualAlternates1 calt {
lookup LookupCalt1;
}
group @CaltTInput [a c e g m n o p q s u v w x y z];
group @CaltTMatch [t];
group @CaltPInput [a e o u];
group @CaltPMatch [p];
group @CaltGInput [a b c d e h k m n o s t u v w x z t.longbar];
group @CaltGMatch [g];
group @CaltYInput [a b c d e h k m n o s t u v w x z t.longbar];
group @CaltYMatch [y];
group @CaltFMatch [f];
lookup LookupCalt1 {
context (@CaltYInput) @CaltFMatch (@CaltTInput);
sub 0 LookupCaltReplace;
context @CaltTMatch (@CaltTInput);
sub 0 LookupCaltReplace;
context (@CaltYInput) @CaltYMatch;
sub 0 LookupCaltReplace;
context @CaltPMatch (@CaltPInput);
sub 0 LookupCaltReplace;
context (@CaltGInput) @CaltGMatch;
sub 0 LookupCaltReplace;
}
lookup LookupCaltReplace {
sub p -> p.swash;
sub t -> t.longbar;
sub g -> g.swashtail;
sub y -> y.swashtail;
sub f -> f.both;
}
It was just an example of my programming style of separating different types of situation.
It works perfectly in FontCreator’s Font Test dialog and in Mozilla Firefox, so I suspect this is a bug within PagePlus. Maybe there is a work-around, but you’ll have to try and experiment with the script yourself.
I tried the following and it would not compile without error, which is not unreasonable considering the task for which calt is defined.
INCORRECT CODE IN THIS FRAME
script latn {
# Latin
feature ContextualAlternates1;
}
feature ContextualAlternates1 calt {
lookup LookupCalt1;
}
group @CaltTInput [a c e g m n o p q s u v w x y z];
group @CaltTMatch [t];
group @CaltPInput [a e o u];
group @CaltPMatch [p];
group @CaltGInput [a b c d e h k m n o s t u v w x z t.longbar];
group @CaltGMatch [g];
group @CaltYInput [a b c d e h k m n o s t u v w x z t.longbar];
group @CaltYMatch [y];
group @CaltFMatch [f];
lookup LookupCalt1 {
context (@CaltYInput) (@CaltYInput) @CaltGMatch (@CaltYInput) (@CaltYInput);
sub 0 LookupCaltReplace3;
context (@CaltYInput) @CaltFMatch (@CaltTInput);
sub 0 LookupCaltReplace2;
context @CaltTMatch (@CaltTInput);
sub 0 LookupCaltReplace;
context (@CaltYInput) @CaltYMatch;
sub 0 LookupCaltReplace;
context @CaltPMatch (@CaltPInput);
sub 0 LookupCaltReplace;
context (@CaltGInput) @CaltGMatch;
sub 0 LookupCaltReplace;
}
lookup LookupCaltReplace {
sub p -> p.swash;
sub t -> t.longbar;
sub g -> g.swashtail;
sub y -> y.swashtail;
}
lookup LookupCaltReplace2 {
sub f -> f.both;
}
lookup LookupCaltReplace3 {
sub g -> g.bigloop;
}
However, is there any way, not necessarily using calt, to achieve the desired result?
For example, the word cabbages to have g.bigloop with the loop extending under the five letters from the second b through to s.