Font hinting in Inkscape

I was recently chatting with the programmers of inkscape and lamenting the lack of font hinting. The developers responded that font hinting didn’t seem applicable because Inkscape is a vector application used to create resolution independent graphics and it didn’t really make sense to add a resolution dependent feature. This is logical and the conclusion is that font-hinting belongs in your raster application, such as the GIMP.

font hinting

(font hinting is the magical property of high quality fonts to manually adjust their size and shape in very minor ways so that they line up with pixel boundaries and avoid blurred or invisible portions of the text)

So this leads to the problem of how to get your work from inskcape to a raster application. Right now, it’s not possible to make use of hinting, but someone with GIMP fu skills could make it happen. There is a plugin for inkscape that lets you export to GIMP’s xcf format while maintaining layers. It’s functional but it currently works by exporting each layer as a png.

Ideally this could be improved in a couple ways:

  • Preserve type layers as type: This means that if a layer is made up of only one or more text objects when it gets exported, instead of exporting it as a png, create type objects with the same coordinates. This could be very challenging because some coordinate translation would need to be done. And while we’re at it,
  • Allow resolution selection when exporting: Right now it appears to export at a fixed 90dpi, which is fine for web graphics but nothing else.

The benefit of this is that GIMP, which does have font hinting support, could be used to slice and export the graphics and hopefully have better results with the typography.

The code is a combination of python and gimp-fu (see the source of the plugin which is linked above). It’s pretty easy to read through and understand what is happening, but I am unable to do more than research the problem and encourage someone to help out. So, if you are the person that just needs a little encouragement and someone to point you in the right direction, have at it!

If I were doing it, I’d attack it this way:

  • Use GIMP-fu to create an image with a text object using a specific type-face and size and try to target a specific coordinate. Experiment with different alignment options such as left, right or center.
  • Try to do the above multiple times in the same image and get predictable results
  • Try to adjust the gimp_xcf.py plugin so that type objects show up in GIMP as type objects (though maybe not in predictable locations with the correct font face or size)
  • Try to get the font objects in the correct place and with the right size and alignment.
  • Revel in the glory of your major accomplishment!

Is anyone up for it?

Comments

And why...

Why should this feature be added to Inkscape and not the GIMP? Two reasons:

  1. I like using Inkscape, I don’t like using GIMP.
  2. GIMP’s SVG import is a miserable failure

Hinting would still be useful

It would seem that I’m late to the party…

Inkscape’s rendering of text is correct in the purist sense - it does its best to position on screen pixels to where the vector paths fall, using transparency appropriately.

But… I’m sure that I am not the only one who uses Inkscape for work that is primarily intended for on screen viewing. (There’s yourself for a start!). As a result, fonts in finished work look terrible.

Importing to the GIMP or similar loses the benefits of using Inkscape (a vector application) in the first place, and as you suggest - the impact to a designer’s workflow is very serious.

It would be great to see the developers implement a modern text renderer. Surely hinting could be optional for the purists?

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You can use Markdown syntax to format and style the text.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
2 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Back to top