In the font I’m working on, I want to include a few common catchwords like “the”, “and” “of”. What would be the best way to encode/activate them?

I thought of a_n_d.dlig but that might have unexpected consequences if someone tries to type in “hand”. Any ideas?

1 Like

If it is dlig, the user is expected to activate the ligature manually. BTW, you do not need to add the .dlig suffix, most ligatures go into dlig automatically.

What you could do, is create a class called AllLetters, set it to update automatically, and have code like this:

script latn;
language ENG;
ignore sub @AllLetters t’ h’ e’, t’ h’ e’ @AllLetters;
sub t’ h’ e’ by t_h_e;

That will substitute “the” only if:

  • the language is set to English (works only in software that supports languages, e.g., InDesign, but not TextEdit)
  • there is no preceding letter
  • there is no following letter

The question remains where you want to put it. Depends on the kind of typeface and intended audience. dlig (off by default) is one possibility, or calt (on by default) perhaps.

1 Like

Or you could store the substitution in something like the titling feature. Assuming that in the end you’ll provide a feature overview anyway for easter eggs like catchwords.

Thanks guys, It makes sense to put it in dlig, since I’m already using calt for pseudorandom character variation. Mekkablue, if I can ask a few questions since I don’t have much (any) experience with writing opentype code manually.

A) How do i set up the class to update automatically? I mean, I can create the class and add all letters myself, but checking “generate feature automatically” wont do anything- will it?
B) The second part of the code would go into the dlig feature, correct?
Thank you!

The Auto update of the AllLetters class was added to the beta version of Glyphs 2 two days ago.
All code needs to go in the dlig feature.

Ah, great! Still working on glyphs1 with this one. Thanks !

Hi Mekkablue

I wanted to use and expand on your code to take into account uppercase, lowercase and mixed, plus a variety of other catchwords I’ve created. However I think I’m structuring it incorrectly despite trying various options/research, and wondered if you would please point me in the right direction.

I did this, which seems to work OK:

ignore sub @AllLetters t’ h’ e’, t’ h’ e’ @AllLetters;
ignore sub @AllLetters T’ h’ e’, T’ h’ e’ @AllLetters;
ignore sub @AllLetters T’ H’ E’, T’ H’ E’ @AllLetters;
sub t’ h’ e’ by T_H_E;
sub T’ h’ e’ by T_H_E;
sub T’ H’ E’ by T_H_E;

But then I have other catchwords and wanted to account for them too, so tried adding WITH:

ignore sub @AllLetters t’ h’ e’, t’ h’ e’ @AllLetters;
ignore sub @AllLetters T’ h’ e’, T’ h’ e’ @AllLetters;
ignore sub @AllLetters T’ H’ E’, T’ H’ E’ @AllLetters;
ignore sub @AllLetters W’ I’ T’ H’, W’ I’ T’ H’ @AllLetters;
sub t’ h’ e’ by T_H_E;
sub T’ h’ e’ by T_H_E;
sub T’ H’ E’ by T_H_E;
sub W I T H by W_I_T_H;

But typing WITHER still creates the substitution.
All tips appreciated!

Actually I got this to work by adding the markers (doh!):

sub W’ I’ T’ H’ by W_I_T_H;

I’m not sure if I’ve structure is correctly or if there’s a better way.

Plus I’ve also made catchwords in French, German and Spanish. Is assume that i’d seperate the actions with the relevant terms between each set?:

script latn;
language ESP;
ignore sub @AllLetters Y’ @AllLetters;
etc. and repeat those that fall into two languages? Le, La, De?

Best to use lookups to avoid overlaps of ignore statements. ignore statements are only valid within a lookup, so e.g.:

    language ....;
    ignore ....;
    sub ....;
1 Like

Thank you! I’ll give it a whirl