Creating Swashes

As you can see in the photo I would like to add a swash feature to the beginning and ending of all my lowercase letters at the end of the word and uppercase as the beginning of the word. I am a beginner. I have created about 7 different swashes in illustrator identically for the left and right sides to match. Could someone send me an example code of how I would make this work? Would I use CALT and sswh code? Also in my example, if I just create a stylistic alternate for a few letters, I would need to edit the letters in order for my end steams of the previous letter to match.

What you need is a so-called Opentype feature. There are a few tutorials about them. In particular you need the one in the Positional Alternates tutorial. Look for the code of the initial and final lookups, and adapt to your needs. It is up to you if you want to put the lookup in calt (on by default, user can disable it) or swsh (off by default, user can enable it if the software supports it).

If you don’t understand what the tutorial is about, start with part 1 of the feature tutorials:

Hello Thank You however as you can see here my s swash does not work. Maybe my code is incorrect. I also refreshed and save but still nothing. Please advise

Additional photo

You need to use the ignore statement as described in the tutorial.

I definitely must be doing something wrong because I cannot get it to work

  • do not use space as context
  • use lookups
  • start the lookups with the ignore statement, because an ignore statement is valid for everything until the end of the lookup
  • use the final lookup from the tutorial as starting point, adapt it for what you need
  • put the lookup inside the calt code

Can you try reading the tutorial again, and tell me what you do not understand in the text? Perhaps I can make the text more accessible if something is hard to understand.

I am not understanding the actual code language. It seems as if I am confusing how to code the actual letter to match the correct code in the calt panel

This is a lookup structure:


The word lookup followed by an arbitrary name (ASCII letters only, no spaces), curly braces, repeating of the name, and a semicolon.

Whatever is between the curly braces {…} is considered ‘inside a lookup’.

What do we want to do? We want to substitute an s by the final swash s. Let’s put that inside the lookup:

    sub s by s.finalswash;

So far so good. The problem is: this will substitute every s, which is not what we want. What we want is: It should only substitute an s if no other letter comes after it. In other words: The substitution (sub s by s.finalswash;) should be ignored if there is any letter following it.

So, we need to also put an ignore statement inside the lookup. An ignore statement is valid from where it is until the end of the lookup. So we need to put it in front of our substitution, but still inside the lookup, like this:

    ignore sub s' @AllLetters;
    sub s' by s.finalswash;
  • Note that the ignore statement is inside the lookup, i.e., between the curly braces.
  • ignore sub tells the features to ignore all substitutions of the kind that follows.
  • What follows is: s' @AllLetters
    • note that the s has a tick mark '
    • which means the substitution of an s (=the marked letter) followed by any letter (=the automatic class @AllLetters).
  • The semicolon concludes the ignore statement.
  • Note, very importantly: I also added a tick mark (') after the s in the sub line. This means that this is the s that the ignore statement is talking about. If we do not add the tick mark (=a single straight quote) there, the ignore statement would not be applied to the substitution.

So we have it in full bloom, in plain English: ‘substitute every s with a swash s, unless any letter follows the s’:

    ignore sub s' @AllLetters;
    sub s' by s.finalswash;
  • Consider using @All instead of @AllLetters in case you want to ignore the substitution for any following glyph (including punctuation), not just following letters.
  • Consider expanding the lookup for other final letters with a different ignore line. See the tutorial on how to do that. And if there is something you do not understand in the text, please be considerate and tell me what exactly you do not understand. Point me to the exact sentence that is too difficult, please. That enables me to improve the text.

Thank You so I coded everything in CALT and received no errors so that is good. When I went in to type the letter and to see if the swash letter would appear, nothing happened. I believe that the way I coded the actual letter s is correct but why is nothing happening? Also if I would like to create an initial swash all I would have to do is use the code that was created but instead replace initial for final? Please see photo

In order for a feature to be used in the text preview panel, you need to activate it in the Features dropdown (dropup?), so the one on your last photo. Activate Contextual Alternates and see whether it works.

Yes I understand how this feature works however when I clicked on it, my other s was activated and not my swash s. Is there something that needs to be changed in the coding? May change s’ to something else?

In the feature code, there is an earlier rule that replaces s with a glyph called s.end. That means by the time the lookup gets to substitute the s, it is not there anymore because it has been replaced already.

Tip: you don’t need to take photos of your screen with your phone. You can make screenshots with Cmd-Shift-4 or Cmd-Shift-5.

Pro tip: Or simply copy and paste the feature code rather than taking pictures of it. After you pasted it, select it and press the </> button. It will be formatted like code.

1 Like

So what exactly are you saying? I know that there is an s.end feature code which is for my alternate s (not my swash s) so are you saying that I need an additional feature code for my swash s.end?

What I am saying is that you have two substitutions for the s:

  1. s → s.end
  2. s (at the end) → s.finalswash

Both of them take the s and replace it for an alternate letter. Let’s see what happens. First, let’s say you type sis. the glyphs you get are:

s i s

Now the first substitution s→s.end is applied. Now the text consists of these glyphs::

s.end i s.end

Now the second substitution s (at the end)→s.finalswash is applied. Now we have this:

s.end i s.end

It is the same as before. Even though the feature substitution did exactly what we told it to do. It substituted every s at the end of a word, just that there are no s’s left among the glyphs. Why? Because every s has been replaced with s.end already.

Now I do not know what the purpose of the s.end in your font is. But I can tell you that the lookup FINALSWASH will never be accessed because by the time the lookup is applied, there is no more s left, just s.end.

Consider reordering the substitutions, or removing substitutions you do not want. Or moving the lookup definition into a Prefix and just calling the lookup in the feature.