(OpenType programming) Dynamic ligatures

Hi there everybody!

I'm working on a typeface where I imagine some sort of dynamic ligatures playing a big role. The struggle is that I'm not very good at advanced OpenType features, so I'll try to get some help here from someone who's better than me at that subject. Or maybe someone knows of another resource where I can learn this. I've done some googling, but I have not found anything similar to this.

A good start would be to see if what I imagine is even possible, so here is an explanation of my idéa:



I'd like to create special ligatures for a single letter that has a starting-glyph, a middle-glyph, and an end-glyph.
For example the hyphen:
  • If i type a single hyphen, a regular hyphen appears.
  • If i type two hyphens in a row, the hyphen_start glyph appears, followed by the hyphen_end.
  • If i type three or more hyphens, the hyphen_start appears, followed by one (or more) hyphen_mid, and ends with the hyphen_end.
I imagine there being these three hyphen components i can design.

This concept can then be applied to other glyphs to create some crazy ligatures.

I've attatched a sketch of my concept for some visual reference!

If someone is willing to help me with this I'd also be willing to pay for the trouble :)

Comments

  • Thomas Phinney
    Thomas Phinney Posts: 2,896
    This is probably most easily with contextual alternates, as long as the string wouldn’t get broken by justification. Otherwise you would need a separate ligature for every length of hyphen sequence.
  • Nick Shinn
    Nick Shinn Posts: 2,216
    This kind of contextual substitution has been exploited by many cursive script fonts since the introduction of OpenType, originally by Caflisch Script, 20 years ago. I would imagine there are primers on it at FontLab or Glyphs web sites.
  • John Hudson
    John Hudson Posts: 3,225
    Yes, you can do this with contextual lookups. But be aware that although you can create the appearance of connected glyphs, you cannot control character level behaviours. So using hyphens or other line-breaking characters as the underlying input might not be a good idea.
  • RichardW
    RichardW Posts: 100
    Indeed, hyphens are a bad idea.  I was once using hyphens as input to a transliteration font for a web page, only to find that the hyphens were rendered separately by one browser.
  • Thomas Phinney
    Thomas Phinney Posts: 2,896
    1) Agree that hyphens are a potentially problematic choice. They are handled specially/oddly in layout in some environments. Indeed, some apps like Word already do automatic substitution of a double hyphen with an en dash or em dash.

    2) The code is simple enough that somebody could do it for you in a matter of 5-10 minutes. Use hyphen as an example but swap it to some other glyph name later.  :)
  • Thanks everyone for the input, especially about the hypens!
    Cheers!