in my (long ago started) attempt to get nice font rendering in my system, I finally got very confused:
So from what I understand, the general mechanism for rendering fonts in X is (omitting the old "X only way"):
Get the font glyphs you're interested in using fontconfig and freetype2.
Render the text using one of the following libs:
Xft/Freetype2 (which apparently is the same? Or is it?)
Pango, which has several backends (from man pango-view): cairo, ft2, xft, or x
Cairo, which does its very own rendering using nothing of the above
So what this implies is, that in the end, on a modern desktop, the actual pixels of a text are drawn by either Cairo or Xft/Freetype2 (which again, seem to be one and the same), both of which respect the settings provided by fontconfig (or do they?).
So to get uniform font rendering across applications, one has to make sure, that cairo does exactly the same thing as Xft/Freetype2 when it comes to rendering.
Is that at all possible?
What is the difference between pangos xft and ft2 backend? I thought they were identical, but provide very different rendering outputs!
In pango, cairo and xft provide exactly the same results. How is that even possible? Isn't cairo doing its own damn thing?
It's a mess... Can somebody PLEASE shed some light on this?
Okay, so I asked in the cairo IRC channel (why didn't I think of that before?) and got my answer.
In case anyone is interested, here it is:
Both cairo and Xft respect fontconfig settings and use Freetype2 for glyph rendering and Xrender for compositing. So, when it comes to text rendering in X11, they both do the same thing, but with different drawing models and suitable for their respective APIs, of course. This is why the output of the xft and cairo backends in pango looks the same.
EDIT: The following statements are part of my own research again, not in IRC.
Also, Xft and Freetype2 are not strictly the same. Xft uses Freetype2 to provide text rendering for X11 (as does cairo), while Freetype2 is agnostic of any graphical environment (well, that one is kind of obvious in hindsight, if you look at the package dependencies).
Last but not least (I have not strictly checked the following statement as the recommended way of text rendering in pango is Xft, so it may be wrong, but it sounds reasonable enough), the ft2 backend of pango directly uses Freetype2 without Xft to render text in its own way, bypassing fontconfig. That explains the different output of the xft and ft2 backends of pango.
Last edited by foggy (2012-04-20 12:03:23)
Huh, guess I am lucky that it looks the same...