Alternative letters in the same Open Type font

Primary tabs

12 posts / 0 new
Last post
Mario arturo's picture
Offline
Joined: 26 Mar 2011 - 2:26am
Alternative letters in the same Open Type font
0

Hello experts on the field

I created a font that has 2 variations of the capital letters and 3 variations of the lower cases. It is a serif font traced from a popular children's book from the end of the 19th century so it was done by hand. I consulted the 2006 post by steff_en and got some answers.

http://typophile.com/node/17887#comment-511377

I set my classes and followed twardoch instructions and I got no errors, I generated the font but it does not do what I intended. That is: everytime I type a particular letter for the second or third time I want them different. As I mentioned, I made 3 versions of every small cap letters and 2 versions of the capital letters.
Ex: in the word "tomorrow", I would like the three "o"s and the two "r"s to be diferent in the same word.

Please help!

Mario arturo's picture
Offline
Joined: 26 Mar 2011 - 2:26am
0

UPDATE, I no longer get the WARNING thanks to frode frank, but I do need help with the programming mentioned above. Regards

Frode Bo Helland's picture
Joined: 26 Feb 2007 - 1:03pm
0
Mario arturo's picture
Offline
Joined: 26 Mar 2011 - 2:26am
0

Thanks frode frank!

Pieter van Rosmalen's proposal (pasted right below) seems the simplest to me, for I can barely program.

feature salt {
lookup rotate {
sub @set_1 @set_1' by @set_2;
sub @set_2 @set_1' by @set_3;
sub @set_3 @set_1' by @set_4;
sub @set_4 @set_1' by @set_5;
sub @set_5 @set_1' by @set_1;
} rotate;
lookup rotate;
} salt;

----------------
MY QUESTION IS THIS:
Should I rename my classes to set_1, set_2 and set_3 to make this coding work??? You can see the image that contains my classes.

Frode Bo Helland's picture
Joined: 26 Feb 2007 - 1:03pm
0

Hmm. Assuming the swashes is a feature on its own, your code would look like this:

feature salt {
lookup rotate {
sub @class1 @class1' by @alt1;
sub @alt1 @class1' by @alt2;
sub @alt2 @class1' by @class1;
} rotate;
lookup rotate;
} salt;

Mario arturo's picture
Offline
Joined: 26 Mar 2011 - 2:26am
0

Yes the swash is a feature on its own. I will give it a shot and let you know. THANX!

Mario arturo's picture
Offline
Joined: 26 Mar 2011 - 2:26am
0

This is what I did: on the OPENTYPE window under salt, I erased what I had for the text you sugest. I got this error:

[ERROR] Target glyph class in sub-rule doesn't have the same number of elements as the replacement class; the target has 1, the replacement, 56117856 [/Users/Arturete/Library/Application Support/FontLab/Studio 5/Features/fontlab.fea 8]
[FATAL] aborting because of errors

What did I do wrong?

Thanks in advance

Frode Bo Helland's picture
Joined: 26 Feb 2007 - 1:03pm
0

You get this error because the classes doesn’t have the same number of elements.

lc: a b c d
smcp: a.smcp b.smcp c.smcp d.smcp

In the example above, each class has four elements. I can now call the classes in my OpenType code, like this:

feature smcp {
sub @lc by @smcp;
} smcp;

If the small cap feature is activated, a /d/ (which is in the @lc class, remember) will be subsituted for the glyph occupying the same “slot” in the @smcp class. In this case /d.smcp/. If the @smcp class only has three letters there’s no way for the OT engine to know what to do.

Justin Callaghan's picture
Joined: 10 Oct 2003 - 12:49am
0

It shouldn't affect the compilation, but wouldn't the rotation code be better placed in the calt feature? Your original salt code looked appropriate for defining alternate glyphs, which is really what that feature is for.

(Edit: this was also [[http://typophile.com/node/19625#comment-278274|discussed in the older thread]].)

Mario arturo's picture
Offline
Joined: 26 Mar 2011 - 2:26am
0

I am sorry Frank, I don't understand what I should do on CLASSES in order to keep your coding:

feature salt {
lookup rotate {
sub @class1 @class1' by @alt1;
sub @alt1 @class1' by @alt2;
sub @alt2 @class1' by @class1;
} rotate;
lookup rotate;
} salt;

Thanks

Frode Bo Helland's picture
Joined: 26 Feb 2007 - 1:03pm
0

If you want, I can look at your files. You can PM me.

Justin Callaghan's picture
Joined: 10 Oct 2003 - 12:49am
0

The bottom of the Classes panel shows the total number of glyphs in the selected class (110 in your screenshot). In order to substitute a class by another class, each class must contain the same number of glyphs, sorted in the same order relative to the other. If @class1 contains 110 glyphs [A B C ...], then @alt1 must contain 110 alternates [A.alt1 B.alt1 C.alt1 ...], and @alt2 as well [A.alt2 B.alt2 C.alt2 ...].

I created a font that has 2 variations of the capital letters and 3 variations of the lower cases.

This could be the source of the problem. If @alt2 contains only lowercase alternates, it can't be substituted for a class that also contains capitals. A solution would be to separate up the upper- and lowercase glyphs into different sets of classes (with related classes containing the same number of glyphs), and "rotate" each set independently.

Also, see [[http://typophile.com/node/19625#comment-269297|Miguel Sousa's explanation]] of the code, including why certain parts may be unnecessary. Even after separating by case, the whole thing should work with only one rule for the uppercase and two for the lowercase.

sub @uppercase @uppercase' by @uppercase_alt1;
sub @lowercase @lowercase' by @lowercase_alt1;
sub @lowercase_alt1 @lowercase' by @lowercase_alt2;