Defining a glyph with a full word

Hello :),

I was wondering if it is possible to create a symbol font which works like this:
If for example I type the words “cat” followed by space, followed by “table” I would get a symbol of a cat followed by a smbol of a table.

So a symbol font which works by typing the symbols you want.

I am a complete noob when it comes to symbol fonts so I have no idea if this is a no brainer or a bit tricky.

Thanks for all kind of tips!

Yes you can! You can put such a feature in several places. The CALT, the LIGA or the DLIG are obvious candidates. What you describe are so called GSUBs, you can read about how they work here: Rules

You can give your cats and tables Unicode Private-Use code-points. You can read about that here: FAQ - Private-Use Characters, Noncharacters, and Sentinels

1 Like

Careful because this is breaking your font for languages other than English and even within English, for all meaning of the word except for one. E.g. a table can also be a timetable or an Excel table, not just the thing you eat upon.

The best way to do this is to look for emojis that already have this meaning like :cat2: for cat. And then rely on the input method to insert them.

However if you know what you are doing, and it is for a very specific closed purpose only, this is how it would work. Technically your images are ligatures. Read up on them in the Ligatures tutorial.

Call your symbol c_a_t. Create them and let your dlig feature be autogenerated in Font Info (Cmd-I) > Features (Cmd-4).

And only for full words, right? You would need to make sure it does not apply to longer words like ‘catch’ or ‘muscat’. In the Features, add a predefined group called @AllLetters:

image

Then turn off automation for your ligature feature, consider renaming it to liga (for the ligatures being on by default), and split the code into different parts for lengths of words, from longest to shortest. Here is the part for three-letter words like ‘cat’:

lookup WORDS3 {
   ignore sub @AllLetters @AllLetters' @AllLetters' @AllLetters';
   ignore sub @AllLetters' @AllLetters' @AllLetters' @AllLetters;
   sub c' a' t' by c_a_t;
   sub d' o' g' by d_o_g;
   sub b' e' e' by b_e_e;
} WORDS3;

The ignore sub lines make sure the substitution only applies to three-letter sequences. The ticked @AllLetters' represent the letters of the word, so you have three ticked letters twice, once preceded, once followed by an unticked @AllLetters. The sub lines (which you took from the automation), need to be retrofitted with tickmarks '. The lookup name WORDS3 is arbitrary but make sure you stay consistent so you can keep the oversight, so the one four-letter words would be called WORDS4 . Lookups for longer words come first, shorter words later.

HTH

3 Likes