lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Broken ligatures in recent LilyPond versions


From: Werner LEMBERG
Subject: Re: Broken ligatures in recent LilyPond versions
Date: Fri, 13 Feb 2015 08:36:46 +0100 (CET)

> So do I understand you correctly, that if a font contains a ligature
> for a given sequence of characters, then Lilypond will always
> typeset that character sequence using the ligature,

It is more complicated than that.  Here is the ideal model for
OpenType ligature handling.

  1. Get the current script (for example `latn' for Latin).
  2. Get the current language (for example `TRK ' for Turkish – yes,
     the final space is part of the four-letter tag).
  3. Activate the default features for the current script/language
     pair.
  4. Let the user control additional features of the current font.
  5. Typeset the input string, using the feature set related to items
     3 and 4.

Right now, *none* of those items are controlled by Lilypond;
everything is handled by Pango.  While this is the right thing
basically, we lack control in case the default settings don't apply.

Items 1 and 2 are initially controlled by the locale, but the user
should of course be able to override those values.  Item 3 belongs
partly to items 1 and 2 and partly to the font's capabilities.  Item 4
is the place to control small caps, old-style figures, and the like
(and it hurts most that Lilypond can't handle that currently).

Now let's come back to the `fi' ligature.  I mentioned Turkish for a
good reason: If you are in a `latn/TRK' environment, the font *must
not* apply the `fi' ligature!  In Turkish words you can find both `fi'
and `fı', and using the `fi' ligature would thus confuse the reader.
So even if the font in question has an `fi' ligature, you won't get it
by default in a Turkish environment.

> and it is not possible to typeset them as separate glyphs?

Unicode defines a special, invisible character, U+200C `ZERO WIDTH
NON-JOINER' (usually abbreviated as `ZWNJ').  To break up a ligature,
you should insert this character between the ligature elements.

> That is to say, the following naive example is not possible to
> implement, because if FontA defines that f followed by i will always
> be ligatured, it is not possible (at least in Lilypond) to typeset
> them separately?
>
> \markup "this is FontA with a ligature: fi"
> \markup "this is FontA without a ligature: fi"

It is indeed dependent on the font whether it has an `fi' ligature or
not.  However, if it has one, and you want to avoid it, you should use
ZWNJ:

  \markup { "this is FontC that has an fi ligature,"
            "but I want to avoid it: f" \char ##200C "i" }

Here, I've used `\char' for clarity.  In languages where the use of
ZWNJ is essential (e.g., Arabic), you would rather enter the character
directly.

> And if there is a ligature for AE, then likewise for the capitalized
> vowels?

There doesn't exist an `AE' ligature; `Æ' is a separate character.

It is an important thing to avoid mixing up input and output
ligatures.  An output ligature is mapping some glyph combinations to
other glyphs.  An input ligature is just a convenience for better
input.  For example, in LaTeX it is custom to write

  ``foo''

to get “foo”.  The font itself doesn't contain ligatures for `` or '';
it is LaTeX that maps this letter combination to separate glyphs.
Similarly, LaTeX maps `foo' to ‘foo’ (thus my bad habit to use ` and '
everywhere :-)


    Werner

reply via email to

[Prev in Thread] Current Thread [Next in Thread]