IONY for review and calt coding help

HaiAnh's picture

Kind greetings to all,

My name is Hai Anh Le and I'm a young designer from Hungary, trying to complete my first font release named IONY:

I didn't have any education in type design, but my love for letters came early on when I was a teenager fascinated by the local graffiti culture. I think this fact gave me more free vision about type design, but my technical skills are still very poor. I know how to draw the vectors and I managed to get the FL file with the kerning nicely but as you can see this particular font needs heavy OpenType coding (i think contextual alternates would be the weapon of choice) which skill I still lack.

FL glyphs:

I was reading Leslie Cabarga's 'Learn FontLab Fast' and ransacked google for additional help, but I just can't get the code working.
So now I've registered here for a chance of getting useful help/suggestions/recommendations from professionals in the topic of coding as well as some criticism about this experimental typeface I loved drawing.

If any of you would happen to have the free time and will to give me some hints, then I would be grateful!

Thank You,
Hai Anh

hrant's picture

Cool stuff.


Bendy's picture

Fun! What exactly would you like OpenType to do? The OpenType Features page on may be of use.

HaiAnh's picture

I'm glad you guys like it!

Thanks for the link Bendy. That was one of the first sources I was reading...maybe I'm too stupid for that:)

AlexanderKatt's picture

I understand how you feel - I also couldn't find a good source info for the calt function. I might as well try to write one:

The Substitude Function
Now, the simplest task you can achieve with the calt feature is to change one character to its alternate, but only it is preceded by another character.
sub e'b by e.alt2;
Means: If you find an "e" character, followed by an "b character, substitude "e" for "e.alt2".
(characters are referred to by name)
This is the only command that you need.
For where and how to write it, see the screenshot at the bottom (but better read on, there is some other important stuff).

Making Groups AKA Classes
The second task is to put some characters in a group. Doing this job without groups is gonna be a major pain in the ass. Even more than with them.

Groups are defined in the following way (you have to have the @ before the group name):
@highaccender = [b k h];
Means: b k and h are now a group, and that group is called "@highaccender".
Follow this syntax strictly. Dont miss the ";".
Using Groups as context
Once you define the group you can easily use it instead of the context glyph (the one that triggers the substitution). Lets revise my first example, and use the group that we already created:

sub e'@highaccender by e.alt2;
Means: If you find an "e" character, followed by any character from the @highaccender group, substitude "e" for "e.alt2".

You can already see why groups are useful. There are a lot of similar glyps, as b k h which should trigger a similar substitution from the glyph that preceedes them and instead of writting three lines:
sub e' b by e.alt2;
sub e' k by e.alt2;
sub e' h by e.alt2;

You write one:
sub e'@highaccender by e.alt2;

And you can use the group more than one time.

Using groups for substitution
So far we used a group as a context. But the alternative glyphs can also be put in a group.
For example, lets say that you have an alternate of "o" called "o.alt", an alternate of "b" called "b.alt" and an alternate of "p", called "p.alt" and you want each of these glyphs to change to its alternate when it is followed by, let's say, the "h" character.

First you put the alternates in a group:
@roundcharactersalt = [o.alt b.alt p.alt];

Second, you make a group that contains the original characters
@roundcharacters = [o b p];
It is crucial that they are in the same order.

Now the substitution is done in the following way.
sub @roundcharacters' h by @roundcharactersalt;
Means: If you find a character from the @roundcharacters group, followed by the "h" character, substitude it with its corresponding character from the @roundcharactersalt group.

Using groups for both
So far groups werent of much use. they only saved a couple of additional lines of code. But consider this:

sub @roundcharacters' @highaccender by @roundcharactersalt;
Means: If you find a character from the @roundcharacters group, followed by a character from the @highaccender group, substitude it with its corresponding character from the @roundcharactersalt group.

You can also have several alternative groups. For example now we have
@roundcharactersalt = [o.alt b.alt p.alt];
but we can also have:
@roundcharactersalt2 = [o.alt2 b.alt2 p.alt2];
Which is a pack of different alternatives to the characters from the group @roundcharacters, that can be used in another rule. Try to do that, without using groups.

A little reminder
If you have more that one substitution the relatinoship between the different rules can be a problem. For example if you have two rules:

sub e'h by e.alt2;
sub b'e by b.alt2;

and you have a text on which both rules should be applied as:
But afte you apply the first rule, the text becomes:
"b e.alt2 h"
so the second one is not to be applied, because the character after "b" is not "e" anymore, but it is "e.alt2".

The solution is simple. Instead of
sub b'e by b.alt2;

@ee = [e, e.alt2]
sub b'@ee by b.alt2;

Groups inside groups
Finally you can have group, one of the characters of which is another group. The concept is the same. Inserting a group in a group is the equivalent of inserting all of its characters. For example:
@mastergroup= [a, b, @roundcharacters];
Means: The group @mastergroup consists of the characters a and b, and of all the characters from the @roundcharacters group.
You can even have a group with alternates of @mastergroup:
@mastergroupalt= [a.alt, b.alt, @roundcharactersalt ];

In this case the rule:
sub @mastergroup' @highaccender by @mastergroupalt;
Means: If you find the characters a and b or any character from the @roundcharacters group, followed by a character from the @highaccender group, substitude it with a.alt, b.alt, or its corresponding character from the @roundcharactersalt group.

Some advice, before you start:
First determine exactly what you are trying to achieve.
Move from simple to complex.
Keep things as organized as you can with groups and subgroups (even if you have only two characters with a similar substitution, it is better to put them in a group).
Name your glyphs and groups in a way that makes sense to you.

For illustration of all of the above, see the code which makes my typeface "Alecko" work:
The typeface itself is

AlexanderKatt's picture

One more thing:
(Not) Using Left and Right Direction alternations
You already know that:
sub e'b by e.alt2;
means: If you find an "e" character, followed by an "b character, substitude "e" for "e.alt2".

And you might also know that if you can change the place of the apostrophe, the function also changes:
sub g e' by e.alt2;
means: If you find an "e" character, preceded by a "g" character, substitude "e" for "e.alt".

My advice is: do not use these two functions in the same font.
If you do, everything becomes a mess. At least that what happened with me.

Even if you defined only these two rules, there already is a conflict in your code (Should the "e" in "geb" be "e.alt" or "e.alt2"?) So choose only one of the two (left or right) and stick to it.

daverowland's picture

sub e g' by e.alt2;
means: If you find an "e" character, preceded by a "g" character, substitude "e" for "e.alt".

I think he meant sub g e' by e.alt2;, what it said there would change the g following an e into an alternate e. For the geb situation, just use sub g e' b by e.alt; no worries

AlexanderKatt's picture

@dave Yup, changed it.

HaiAnh's picture

Wow, Alexander thanks for writing this down and Dave for the contribution!
This is a huge help for me and, I think, for many others in the future.
I'll start working along your lines and hopefully get back to the thread with some results.

AlexanderKatt's picture

No problem. Incidentally, writing, coding and font design are my favourite things in the world.

Syndicate content Syndicate content