Contextual and positional alternates

Let’s say I have a lowercase ‘g’ in my typeface that, depending of its position inside a word, creates a ‘gap’ when is preceded by another lowercase ‘g’. (In my case, I have a ‘ear’ on my g that goes up creating this ‘gap’ between the ‘g’ and the ‘g’ that precedes it), but I also have an alternate ‘g’ in which the ‘ear’ goes to the right, so I want this alternate ‘ eartotheright’ to substitute any ‘standard’ ‘g’ that goes behind/to the left of the standard ‘g’, meaning that, always, only the ‘g’ on the rightmost position will be the standard one (with the ‘ear’ going up). How do I tell glyphs that, whenever it finds one or more ‘gg’ combination inside a word (like ‘gg’, ‘ggg’ or ‘gggg’ and so on…), it should substitute all lowercase 'g’s by a stylistic alternate ‘g’ (the eartotheright) except for the last one on the right? Also, I want this to work only in my blackest weight/master or maybe that one and one instance ‘behind’ it. (because all this only happens in my blackest weights). Is this possible? How do I do it? I’m sorry if I’m not making myself clear.

Maybe I am missing something, but I guess you mean:

@g = [g gcommaaccent gdotaccent];
@galt = [g.alt gcommaaccent.alt gdotaccent.alt];
sub @g' @g by @galt;

And put it in calt.

1 Like

Wow! Exactly that! Thank you so much, Rainer! <3

Is it possible to apply this only to the black master?

Master? How would it interpolate?

You can use the Remove Features custom parameter in the instances you do not want it in.

1 Like

Exactly what I wanted! Thank you!