How to create a class with all glyphs exept one?

Lea Verou's picture

Hi all!

Does anyone know how can I create class that will contain ALL glyphs exept a particular one? (lowercase s in my case)

I have googled for hours and studied the FontLab manual a lot, but I can't find an answer.

I could perhaps do it with character ranges, but which ones should I use? Based on which encoding?

Sorry if its a stupid question, I'm quite a beginner in all this...

Thanks in advance!

John Hudson's picture

You can make classes in FontLab by first creating a new class in the Classes panel and then simply selecting the glyphs you want to include from the Font Window and dragging them into the top right portion of the Classes panel. So, create a new class, then use Ctrl+A (or Mac equivalent) to select all the glyphs in the Font Window, then use Ctrl click to unselect the one that you do not want in the class, then drag and drop all the selected glyphs into the Classes panel.

Lea Verou's picture

Thanks for your reply John.
I thought about this (and its my last resort), but what happens when I add new glyphs? :/
What I'm looking for is some kind of [not s] definition for a class. If I have to add the glyphs manually, I know how to do it...

Also, adding the glyphs manually doesn't account for the case of start or end of the text...

Theunis de Jong's picture

Would the 'ignore sub' option work for you? You might want to expand on what you are attempting to do.

Lea Verou's picture

I tried the ignore sub with many ways, but it doesn't seem to work for what I want it to do.

What I want to do is:
I have 2 alternate s, that change based to the preceding or next character.
I also have two different s that are used when the next or preceding character (respectively) is also an s, and another s to be used when both the preceding and next character is an s.
This totals to 1 normal s and 7 contextual alternates.

The code from the calt feature that has to do with any of them is the below (irrelevant subs removed):

@not_s = [a-r t-z e.alt s.alt2 space period .notdef CR ];
@is_s = [s s.alt s.alt1 s.alt11 s.alt2 s.alt21 s.alt22 s.alt3];
sub @not_s s' [a f t z w u y b] by s.alt;
sub @is_s s' [a f t z w u y b] by s.alt22;
sub @not_s s' s by s.alt1;
sub @not_s s.alt2' s by s.alt11;
sub [s.alt1 s.alt11 s.alt3] s' s by s.alt3;
sub @is_s s' @not_s by s.alt21;
sub s.alt3 s.alt' by s.alt22;
# fresset!
sub f.alt r.alt e.alt s.alt11 s.alt21 e' t' by s_t.logo;

Of course the @not_s class is completely temporary and doesn't contain lots of glyphs. What I want it to contain is every glyph that is not a lowercase s (including start and end of lines, even though they aren't glyphs, although I doubt its possible :( ).
If that isn't possible, can anyone think of a way to do it with ignore sub? I have a strong feeling that ignore sub is the way to go, but everything I tried with it doesn't work :(
This is troubling me for several hours but I can't figure out a more complete solution... :(

Lea Verou's picture

Okay, lets simplify the problem a bit.
Lets suppose I only have s.alt1 which I want to place instead of s before every lowercase s and s.alt3 which I want to place instead of s when s is between two other s (sss). The problem is that in the second case, the middle s would be substituted by s.alt1 because it also precedes an s.

This does not work:

lookup calt_s1 {
ignore substitute s s' s;
sub s' s by s.alt1;
} calt_s1;

lookup calt_s3 {
sub s s' s by s.alt3;
} calt_s3;

This neither:

lookup calt_s1 {
ignore substitute s s' s;
sub s' s by s.alt1;
} calt_s1;

lookup calt_s3 {
sub s.alt1 s' s by s.alt3;
} calt_s3;

but this does:

lookup calt_s1 {
ignore substitute s s' s;
sub [a-z space] s' s by s.alt1;
} calt_s1;

lookup calt_s3 {
sub s.alt1 s' s by s.alt3;
} calt_s3;

The reason I don't want the latter solution is that I have to create a class with every glyph, and it would still be incomplete, because I would also have to match somehow the start and end of the text.
What seems to be the problem, is that ignore sub does not work if the pattern given to it is not an exact subcase of the substitution below. In the first case, since ignore sub had s s' s and the pattern was s' s, it didn't work. When we converted the substitution pattern to [a-z space] s' s it worked, as s s' s is a subcase of that.
However this behavior conflicts with the Adobe specification (see example 1, even though the pattern is [a e n] d' and the exceptions f [a e] d' and a d' d, they are supposed to work.

So, the possibilities are two:
1. I'm not grasping something correctly
2. Its a FontLab bug (?!)

My bet would be on 1. So what am I missing? :(

Lea Verou's picture

Nevermind, I figured it out with a weird way and lots of lines of code that even I don't understand or can reproduce :P

Nick Shinn's picture

Here's my code for long s.
For words like "scissors", "satisfaction" and "offside".

sub s by longs;
sub longs' f by s;
sub longs longs' by s;
sub f longs' by s;
ignore sub longs' @letter;
sub longs' by s;

Nick Shinn's picture

I had to play around with the sequence to get it to function correctly.
It seems to me that designing according to a logical understanding of how software is supposed to work often falls short.
So I proceed by trial and error and try to get an effect to work in the FontLab preview panel, and then test it in InDesign.
Seems like Lea does similar.

Syndicate content Syndicate content