Fonts, Swashes, Linux, Problems

I recently bought a font called Jolie Romantique (for a future, er, project), and it worked without any problems: I plopped the .ttf file into ~/.fonts, created an SVG file with some text in it, ran it through ImageMagick “convert” and got this:

Of special interest here is that end-of-word swash.  (That’s apparently the technical term for those things: Swashes.  I know.)

Here’s the SVG file:

<svg width="600" height="200" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <rect width="600" height="200" x="0" y="0" fill="white"></rect> <text y="100" x="65" text-anchor="left" font-family="JRS" fill="black" stroke="black" font-weight="regular" font-size="120">Like#02</text> </svg>

Did you catch the fun bit?  Yes, it’s that “#02” in there.  The swashes are apparently implemented as ligatures or something, and they’re encoded in the font as #01, #02 and #03.  Here’s the same file with the #03 swash:

Fun!

Like I said, this worked perfectly…  on my Debian jessie machine.  Then I upgraded it to Debian stretch, and the swashes stopped working.  Now the results look like this:

This is sad.

And I have no idea where to report this bug.  It’s not a bug in imagemagick or the SVG libraries, because X programs (mis)behave the same way.  So it’s in the TTF rendering libraries?  What’s responsible for that?

I’ve tried googling for this, but the pickings are rather slim.  Apparently not too many people are that into swashing.

If I can’t get this fixed, I’ll have to set up an Emacs-as-a-Service thing on a jessie machine to create the images for my er project.  So, no biggie.  But! This should just, like work.  And it doesn’t.

I just tried this on Ubuntu 17.10, and it doesn’t work there, either.  So it’s a cross-platform bug, I guess?

5 thoughts on “Fonts, Swashes, Linux, Problems”

    1. Hm…

      [larsi@stories ~]$ ldd /usr/bin/convert | grep -i type
      libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007efefd332000)

      Yes, that seems to be the only library that deals with fonts that’s linked into convert… I’ll try sending off a bug report to them.

  1. Hm! On jessie convert uses libsrvg:

    [larsi@potato ~]$ strace convert tmp/like.svg /tmp/1.png 2>/tmp/s
    [larsi@potato ~]$ grep rsvg /tmp/s
    open(“/usr/lib/x86_64-linux-gnu/librsvg-2.so.2”, O_RDONLY|O_CLOEXEC) = 3

    On stretch, it doesn’t:

    [larsi@stories ~]$ strace convert tmp/like.svg /tmp/1.png 2>/tmp/s
    [larsi@stories ~]$ grep rsvg /tmp/s

    Perhaps that’s the problem?

  2. It was! I built ImageMagick from source with –with-rsvg, and now the swashes work again.

    *phew*

    I guess the built-in SVG renderer in ImageMagick doesn’t understand advanced OpenType features.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s