Page 1 of 1

Ordinals 1st 2nd 3rd etc as OpenType feature

Posted: Mon Feb 07, 2022 8:04 am
by Dinofore
Hi there

I’m quite a newbie when it comes to typography and type design but I have just finished my first font, and I’m just fine tuning kerning and open type features etc.

I want to substitute the “nd” of 2nd with a single glyph that is called “small_nd” which is way up in the private use register (E679) as suggested on another forum. I want to do this for 1st, 2nd, 3rd and 4th - replacing the suffix with a single glyph for each iteration that I have designed for the purpose. What is the easiest way of doing this, with some example code, as I’m having a real hard time with it and would be very grateful.

I wish for the nd, th, etc only to be substituted with their single glyph counterparts in the context of coming after a numeral.

I hope this all makes sense and I hope someone can assist! ❤️

Re: Ordinals 1st 2nd 3rd etc as OpenType feature

Posted: Mon Feb 07, 2022 8:58 am
by Bhikkhu Pesala
See the tutorial: Enrich your fonts with OpenType features and add an Ordinals feature to your font.

If I remember correctly, this expects to find superscript glyphs for d, h, n, r, and t. If you want nd, rd, th, to be single glyphs I am not sure how it would work.

Re: Ordinals 1st 2nd 3rd etc as OpenType feature

Posted: Mon Feb 07, 2022 9:46 am
by PJMiller
If you want an example then download the Munson font and take a look at the open type features. :D

Re: Ordinals 1st 2nd 3rd etc as OpenType feature

Posted: Mon Feb 07, 2022 11:22 am
by Dinofore
Thank you both so much, I will have a look.

Using superscript N & D for example wouldn’t work in my scenarios, unfortunately, I really need to be able to replace the two characters with one single glyph in that particular context. If anyone knows if it is possible to do so at all, that would be handy as if it isn’t I can spare myself the pain of trying to do the impossible and just settle for having it as a special character, that can be manually triggered.

Re: Ordinals 1st 2nd 3rd etc as OpenType feature

Posted: Mon Feb 07, 2022 11:27 am
by Dinofore
That said if it can’t be done I guess I could make a cheap workaround with making the N super the ND glyph and the D super being just blank padding?

Re: Ordinals 1st 2nd 3rd etc as OpenType feature

Posted: Mon Feb 07, 2022 11:53 am
by Bhikkhu Pesala
Glyph substitutions of two glyphs with one glyph are certainly possible. I have never done ordinals in this way, so I don't know how to write the code for you. I use a 2 to 1 GSUB for my Ornaments feature, for Chess players. Typing bq with the feature enabled will replace bq with a black queen from Misc Symbols.
Two to One Subs.png
Two to One Subs.png (20.62 KiB) Viewed 11919 times

Re: Ordinals 1st 2nd 3rd etc as OpenType feature

Posted: Wed Feb 09, 2022 11:46 am
by PJMiller
Munson uses four single glyphs for 'th', 'st', 'nd', and 'rd' so yes you can put a ligature substitution table into the ordinals feature and it works. Take a look, the first two subtables are for the 'o' and 'a' substitutions but the third subtable is for the British and American ordinals which I suspect will get more use than the European ordinals.

It is free and open source and the FC font project is included in the 'source' folder.