Firefox Ligature Bug Followup

Thought I’d post a followup on my previous post since it generated a bit of interest. First a quick summary:

  • It is not an Ubuntu Dapper specific bug. With the appropriate combination of fonts and pango versions, it will exhibit itself on other Pango-enabled Firefox builds (it was verified on the Fedora build too).
  • It is not a DejaVu bug, although it is one of the few fonts to exhibit the problem. The simple fact is that not many fonts provide ligature glyphs and include the required OpenType tables for them to be used.
  • It isn’t a Pango bug. The ligatures are handled correctly in normal GTK applications on Dapper. The bug only occurs with Pango >= 1.12, but that is because older versions did not make use of the OpenType tables in the “basic” shaper (used for latin scripts like english).
  • The bug only occurs in the Pango backend, but then the non-Pango renderer doesn’t even support ligatures. Furthermore, there are a number of languages that can’t be displayed correctly with the non-Pango renderer so it is not very appealing.

The firefox bug is only triggered in the slow, manual glyph positioning code path of the text renderer. This only gets invoked if you have non-default letter or word spacing (such as justified text). In this mode, the width of the normal glyph of the first character in the ligature seems to be used for positioning which results in the overlapping text.

It seems that the bug may be fixed in the Firefox 1.6 series, but if that fix can’t be backported easily in time for Dapper, it might be easier to switch to a different default font that doesn’t contain the ligatures (such as Bitstream Vera). That would certainly reduce the chance of the bug occurring.

4 Comments

  1. Posted 7 April, 2006 at 3:08 am | Permalink

    Another observervation is that the bug also appears in the galeon browser…

    BTW the word “fix” looks really cool this way…

  2. michele
    Posted 7 April, 2006 at 3:27 am | Permalink

    Thanks for pointing this bug out James, I’ve missed the your first post, this was really bugging me.

    Yep, the word “fix” looks cool but I prefer it now that I’ve switched to Bitstream Vera (thanks for providing a test case Joachim). :D

  3. Denis Jacquerye
    Posted 10 April, 2006 at 8:45 am | Permalink

    The ligatures could also be disabled in free fonts like DejaVu fonts in distribs that display the bug. I think we even made such a release a few months back because of this bug.

    Bitstream Vera does contain the ‘fi’ and ‘fl’ ligatures but isn’t OpenType so Pango does not perform the substitutions. If Pango starts doing so…

  4. Posted 10 April, 2006 at 7:02 pm | Permalink

    Denis: yeah, I noticed that the Vera font contained a few ligature glyphs (although not as many as Deja Vu) while investigating the problem, but did not have the OpenType tables necessary for them to be used by Pango.

    I’d prefer not to modify the fonts directly, since it affects how documents using that font display. It would be a lot nicer if the pango rendering code in Firefox was fixed …