I am trying to make a font with some stylistic alternates

I am trying to make a font with some stylistic alternates.

It is a test for trying out the Serif Affinity Publisher program.

I have thus far made one post in the following thread.

https://forum.affinity.serif.com/index.php?/topic/75641-copying-text-out-of-a-pdf-document-when-the-font-has-opentype-ligature-capability/

What I am trying to do now is to modify a copy of the attached font (to become ligatst3.otf) so as to add two alternates for the letter e. Each has a swash ending, the second with a larger swash than the first. This is just a test so as to find out how Affinity Publisher handles it and what happens if one tries to copy and paste from out of a PDF document produced from Affinity Publisher.

I cannot remember whether I ever got alternates working before. I have a vague recollection of there being aalt, calt and salt.

Anyway to get started I searched this forum and found a thread which has in one post a code sample kindly supplied by Bhikkhu Pesala.

I adapted that to my needs and thus ended up with the following OpenType code, using FontCreator 8.

script latn {
  # Latin
  feature StandardLigatures1;
}

feature StandardLigatures1 liga {
  # Standard Ligatures
  lookup Ligature1;
}

lookup Ligature1 {
  # Referenced by feature "StandardLigatures1"
  sub c t -> c_t;
  sub e t -> e_t;
  sub s t -> s_t;
}

feature StylisticAlternates salt {
    lookup StylisticAlternates;
}

lookup StylisticAlternates {
    sub e -> [e e.alt1 e.alt2];
}

This compiled but has the following.

[Hint] (18,9) : Feature StylisticAlternates declared but never used.

[Hint] (22,8) : Lookup StylisticAlternates declared but never used.

Can anyone advise what is wrong please?

William Overington

Thursday 27 December 2018
ligatst2.otf (11.1 KB)

You need to include the feature to the script as follows:

script latn {
  # Latin
  feature StandardLigatures1;
  feature StylisticAlternates;
}

Thank you Erwin.

I have changed the script and it compiles without hints.

Excellent.

William

Here is the font.

ligatst3.otf (11.4 KB)
This font not only has some ligatures but also two stylistic alternates for lowercase e, intended for the ends of (some) lines in poetry, which stylistic alternates are not ligatures.

William

Here is a PDF document which contains a poem that I have written which shows the font in action.

white.pdf (9.32 KB)
What is really good about the Serif Affinity Publisher Beta program is that the PDF document produced is such that although three ligatures and two stylistic alternates are used, copying the text from the PDF document and pasting into WordPad gives the underlying plain text, not text with blanks where ligatures and stylistic alternates occur.

William