Make calt code that doesn't affect any other calt code?

I want to make some code to swap over some glyphs in a specific context. I can do that easily.
But, I want that to be applied after all the other calt code has done it’s job. Otherwise it will mess up everything else.

I thought maybe I could put it in a separate lookup at the bottom of calt, but (testing within Glyphs) this did not work. Is there a way?

In case this helps - the rest of the calt code deals with classes that have groups of glyphs with different .ss ending, like .ss01, .ss02 etc. I made two new classes, from a couple of those, giving adding .001 to the glyph names. I don’t know if there’s a trick that makes .001 versions more handy in some way for coding but I just mention that in case.

Put it in lookups. That is exactly what they are made for.

What do you mean by ‘did not work’? The code for the later lookup must take the changes of the previous lookups into account. E.g. if the previous lookup substituted x for x.alt, then the second lookup needs to work with x.alt, because there won’t be any default x left anymore after the first lookup.

1 Like

I checked it only in the Glyphs app as I mentioned, where that additional lookup was not applied in isolation. It caused interference with previous calt code, so was in fact not isolated, apparently. I’ve now tested the exported font in response to your reply. Neither apply the code as I believe it instructs, and both deal with it differently. I will say exactly how below, but first:

I have taken a closer look and I believe I may have found the cause connected with it - in the lookup above this lookup, there is included:
lookupflag IgnoreMarks;

I had problems previously with that lookup with what seemed to be the IgnoreMarks interfering with all the lookups below it relating to marks. That’s why I moved it to the bottom, to stop that. This new lookup also involves marks (colon and semicolon are marks in this font, and that has caused no issues at all so far even if this sounds unusual). I may be mistaken - but, are lookups including IgnoreMarks commands known to cause some interference with separate lookups below them dealing with marks?

So, this is the code for this new lookup, which comes last in the calt feature:
lookup SMALL {
ignore sub @base_reg’ [colon semicolon];
sub @base_reg’ by @base_reg_001;

In the exported font (in Pages on Mac), this gets applied:
sub @base_reg’ by @base_reg_001;

But this does not (i.e. this sub is not ignored):
ignore sub @base_reg’ [colon semicolon];

This is why I suspect this may be the same issue I had before as explained above - IgnoreMarks leaking downwards through lookups.

In the Glyphs app in edit view, both lines of code get applied, but that messes with the rest of the calt code, - the glyph that comes after @base_reg’ [colon semicolon] also changes, so it should not because by the time it reaches this lookup aleady be base_1 , not base_reg, and so should be unaffected. … hmm I just tested and actually even removing this code doesn’t make it rest of the IgnoreMarks-involved calt code work in Glyphs preview… maybe there is something I forgot… does the IgnoreMarks calt code only take effect on the exported font, not in edit view?

Anyway is there a way I can get this code to work? Maybe I made it wrongly? Or if it is indeed the IgnoreMarks command in the separate lookup above it that is causing problem, what can I do? I can’t put it above since I still need this operation to come after the rest of the calt code. Is there a convenient solution?

Thank you!

@mekkablue can I ask, does code need to be merely in a separate lookup in order to not affect the rest of the code; or does all the rest of the code also need to be in lookups too? If the latter, this could explain this problem?

Also can we make nested lookups? (lookups within lookups?)

You can try, but I don’t think so. I wouldn’t know what the advantage of that should be over two separate lookups.

1 Like

Ok thanks. Also I’m really sorry I replied to this thread today but it was by mistake so I deleted it. I meant to write that on the private conversation I made about the problem I am having with the calt code working great in Glyphs but not working when exported. I’ve been stuck on that for about the last 10 days :thinking: Your help would be so much appreciated :pray: