0004917: Make Graphics module use modern X fonts instead of X core fonts

Description

X core fonts have been deprecated for many years. Fedora are trying to identify pieces of software which still use X core fonts and could be changed to use modern X fonts (based on Xft and FontConfig). The OCaml Graphics module is one such place.

The attached patch changes the Graphics module to use modern X fonts. The changes are relatively simple - changing calls such as XDrawString to use the Xft equivalent (XftDrawString8).

One immediate advantage is that Graphics users will see anti-aliased fonts.

Another advantage is that Graphics users can specify font names like "Times-12" instead of the massive and incomprehensible XLFD strings ("-*-times-*-r-....")

One of the reasons against adding anti-aliased primitives without a configuration option is that invalidates invariants like the ability to blank out a primitive after having plotted it by plotting the same primitive in the background colour, and people reading colours at a point from the image and relying on the result.

So if we're going to go down this route without breaking existing programs, there should be a configuration option in the Graphics module to enable the antialiasing.

John is correct that with antialiasing you cannot overwrite a string with the background colour and expect that it will completely disappear (instead you will see that the outline of the font remains).

However with FontConfig it's very easy to select non-antialiased fonts. Just add ":antialias=false" to the end of the font name, as in the example program below: