# 'Two sided' OpenType Script Question (Calt)

## Primary tabs

5 posts / 0 new
Offline
Joined: 22 Jan 2004 - 4:19pm
'Two sided' OpenType Script Question (Calt)

I have started to experiment with code to support special glyph forms based on shapes of neighboring glyphs. For example:

Round Left, x, Round Right
Round Left, x, Flat Right
Flat Left, x, Round Right
Flat Left, x, Flat Right
Diagonal Left, x, Round Right
Diagonal Left, x, Flat Right
Diagonal Left, x, Diagonal Right
Round Left, x, Diagonal Right
Flat Left, x, Diagonal Right

Note: x= is the glyph to be modified

Note:
Round Right = o,b,e etc
Round left = o,d,q etc
Flat Right = n,d,u etc
Flat Left = n,b,u
Diagonal Right= v,w,y
Diagonal Left= v,w,y

I understand how to do the classes now but I am not sure in a calt expression how you would best order things. I suspect that you would pick a standard say for instanace 'Flat' and make that the default. Then it's a matter of making the class' for Round, Diagonal, and for ligatures and special cases. That is fine.

What I don't seem to be able to do is to effectively figure out is what is the smart way of doing this.

This is what I did so far was this. I did it for an 'f' whose crossbar I am altering gently. It seems to be working.

sub @rnd.rt f' @rnd.lft by f.rnd.bth;
sub @rnd.rt f' @flat.lft by f.rnd.lft;
sub @flat.rt f' @rnd.lft by f.rnd.rt;

Offline
Joined: 5 Oct 2006 - 11:03am
0

On first read, what you have there seems fine. Once you get all your variations in there, maybe some trouble would reveal itself -- but I think what you're sketching out here is basically simple.

But... things will get squirrely pretty fast if you're going to change the third glyph after the second one changes. Will the third glyph's change affect what the second glyph should be? Then you'll have a sort of reverse cascade. Ow. My head is hurting now.

This is the kind of thing that can drive one crazy when figuring out contextual substitution. Perhaps you don't intend to get that sophisticated about it, which would save you a lot of trouble!

As a general remark, I once read something about programming (which might be elementary to any programmer, but maybe not so obvious to font developers): Concentrate first on writing code that just works, without worrying about efficiency or elegance. Once you have something that does what you want, you can then turn to distilling the code into something more efficient or less messy.

Offline
Joined: 22 Jan 2004 - 4:19pm
0

Thanks Christopher! Happily there are only a few glyphs that I think benefit from this kind of treatment but yes, it is the combinations that could get me. Things like a the double o where the second o changes and is followed by for instance an f. I think that probably just expanding the class' members should sort out any problems but I can imagine an unforeseen circumstance biting me later. Next time I will probably sketch out a list of likely targets/combinations ahead of time!

Offline
Joined: 8 Jul 2003 - 11:00am
0

Did I send you a pdf on the Calt workshop I gave at TypeCon Boston?

It might be good to make "round left" the default, as that will come in handy for when there is no lower case letter to the left-- e.g. following a capital, figure, punctuation or space.

Offline
Joined: 22 Jan 2004 - 4:19pm
0

Yes you did. Thanks for the reminder! This thing is not actually a script but I imagine the code there will be useful all the same.

I will post some examples when it's starting to gel enough to make sense.