Font hinting in Inkscape
I was recently chatting with the programmers of [inkscape](http://www.inkscape.org) and lamenting the [lack of font hinting](https://bugs.edge.launchpad.net/inkscape/+bug/170392). 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 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](http://bearfruit.org/blog/2007/09/14/fuzzy-lines-and-text-in-web-graphics))
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](http://inkscape.svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/share/extensions/gimp_xcf.py?view=markup) 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?




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](http://icanhascheezburger.com/2008/03/11/funny-pictures-flying-ur-doin-it-wrong/)
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?
This is one of my biggest concerns with Inkscape. I like to use it for creating web graphics, but using it with text is just out of the question. If you’re using large fonts hinting doesn’t really seem to be problematic, but if your using something like 12px the results are really bad. I truly hope the developers change there mind in the future, and I don’t think a solution should have to be gimp-specific.
Hinting in Inkscape is not as easy as it might seem. A well hinted font does change its proportions depending on size. The word “Test” in Verdana renders to 38x14px, in half the height it is 23 pixels wide (i.e. 23x7px, not 19×7 as one might expect). How should Inkscape handle this?
The job belongs as part of the SVG->Raster export, which Inkscape does have. It’s all very nice SVG being resolution independent, but most output devices are raster, and the SVG is going to look better with a decent raster conversion.
It should be possible to go beyond just fonts though, and also do hinting on lines. Thin horizontal and vertical lines easily end up ugly as it is. A 1px black line not aligned to the pixels will become a 2px grey line instead, whereas it would be useful to have an option to allow the position to shift a bit to sharpen it up.
This is one of my biggest concerns with Inkscape. I like to use it for creating web graphics, but using it with text is just out of the question. If you’re using large fonts hinting doesn’t really seem to be problematic, but if your using something like 12px the results are really bad. I truly hope the developers change there mind in the future, and I don’t think a solution should have to be gimp-specific.
With Inkscape 0.47 you can save as “Cairo PNG” and then it does have font hinting.