Using the OpenType calt table

Get help with FontCreator here. Please do not post feature requests or bug reports here.
Post Reply
William
Top Typographer
Top Typographer
Posts: 2038
Joined: Tue Sep 14, 2004 6:41 pm
Location: Worcestershire, England
Contact:

Using the OpenType calt table

Post by William »

The OpenType calt table looks interesting.

http://www.microsoft.com/typography/ots ... e.htm#calt

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.

viewtopic.php?f=3&t=4464

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.

How does one do that please?

William Overington

23 October 2013
León Fridsma
Posts: 694
Joined: Mon Dec 07, 2009 10:26 am
Location: De Bilt, Netherlands
Contact:

Re: Using the OpenType calt table

Post by León Fridsma »

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:
calt.png
calt.png (3.84 KiB) Viewed 7336 times

Code: Select all


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;
}
William
Top Typographer
Top Typographer
Posts: 2038
Joined: Tue Sep 14, 2004 6:41 pm
Location: Worcestershire, England
Contact:

Re: Using the OpenType calt table

Post by William »

Thank you.

William
William
Top Typographer
Top Typographer
Posts: 2038
Joined: Tue Sep 14, 2004 6:41 pm
Location: Worcestershire, England
Contact:

Re: Using the OpenType calt table

Post by William »

I have made a font and tried it in Serif PagePlus X5.

Here is the font.
Learning_calt_001.otf
(26.35 KiB) Downloaded 371 times
It mostly works very well though the ty pair has a t.longbar yet not a y.swashtail.

Can readers possibly try this font in whatever OpenType-aware applications that they have available please and post their results?

I have tried adding t into the list just in case PagePlus X5 was using the underlying plain text, but it made no difference.

William Overington

25 October 2013
William
Top Typographer
Top Typographer
Posts: 2038
Joined: Tue Sep 14, 2004 6:41 pm
Location: Worcestershire, England
Contact:

Re: Using the OpenType calt table

Post by William »

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.

Code: Select all

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;
}
William Overington

4 November 2013
Alfred
Top Typographer
Top Typographer
Posts: 1030
Joined: Thu Apr 18, 2013 8:08 am

Re: Using the OpenType calt table

Post by Alfred »

Interesting. Do you really need a separate function for the f.both glyph substitution? :?

By the way, I can confirm that (as per your previous post) León's 'ty' substitution doesn't give me a y.swashtail in PagePlus.
FC14 Pro (Help) + MT11.0 Pro (Help) • Windows 10
William
Top Typographer
Top Typographer
Posts: 2038
Joined: Tue Sep 14, 2004 6:41 pm
Location: Worcestershire, England
Contact:

Re: Using the OpenType calt table

Post by William »

Alfred wrote:Interesting.
Yes.
Alfred wrote:Do you really need a separate function for the f.both glyph substitution? :?
No. I have just tried it as follows and it works in PagePlus X5.

Code: Select all

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.
Alfred wrote: By the way, I can confirm that (as per your previous post) León's 'ty' substitution doesn't give me a y.swashtail in PagePlus.
Thank you for checking that.

William Overington

5 November 2013
Erwin Denissen
Moderator
Moderator
Posts: 11160
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Using the OpenType calt table

Post by Erwin Denissen »

Alfred wrote:By the way, I can confirm that (as per your previous post) León's 'ty' substitution doesn't give me a y.swashtail in PagePlus.
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.
Erwin Denissen
High-Logic
Proven Font Technology
William
Top Typographer
Top Typographer
Posts: 2038
Joined: Tue Sep 14, 2004 6:41 pm
Location: Worcestershire, England
Contact:

Re: Using the OpenType calt table

Post by William »

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

Code: Select all


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.

William Overington

7 November 2013
León Fridsma
Posts: 694
Joined: Mon Dec 07, 2009 10:26 am
Location: De Bilt, Netherlands
Contact:

Re: Using the OpenType calt table

Post by León Fridsma »

Should theoretically be possible, but I currently don't have the time to have a look at it.
Erwin Denissen
Moderator
Moderator
Posts: 11160
Joined: Fri Oct 04, 2002 12:41 am
Location: Bilthoven, The Netherlands
Contact:

Re: Using the OpenType calt table

Post by Erwin Denissen »

You can double-click the output line which starts with [Error] to jump to the specific line of your OpenType layout script.
otlscripterror.png
otlscripterror.png (65.84 KiB) Viewed 7228 times
Erwin Denissen
High-Logic
Proven Font Technology
Post Reply