Contextual alternates for all caps


I’m working on an Opentype feature where some glyphs such as a hyphen and an emdash will be replaced with their alternatives when typesetting in all caps (e.g. a hyphen in a higher position). I did some research and came across this .calt and Germanbliss here:

It seems like I may be able to apply the knowledge from the tutorial to what I need. But since I’m pretty new in type design and coding, I’d welcome your input on whether .calt is the proper way to go for the task I need. Or there’s a better way to do so.

You need a case feature. Add a .case suffix and regenerate your features.

Thanks for your quick reply Mekkablue. You have saved me a lot of time. Are there more steps after added the .case suffix and regenerated the feature? Should I then follow the similar process as shown in the link I mentioned earlier?

" …Then, you add this to the case feature code:

sub @Uppercase hyphen’ @Uppercase by;
sub @Uppercase @Uppercase hyphen’ by; "

And to do so, I have to turn off the generate Feature automatically off, correct?

It is not a good idea to contextualize your punctuation. Don’t do it because it could be triggered where you don’t want it, outside of all caps setting. We had a similar discussion recently here in the forum. It is up to the user to trigger all cap text setting. The case feature including uppercase punctuation comes automatically if you set all caps in indesign, e.g. So, no need for a contextual substitution.

Thank you so much! I really appreciate your help. You saved me a lot of time and headaches. :smile: