You are not logged in.

#1 2012-04-19 12:07:43

foggy
Member
Registered: 2012-01-25
Posts: 31

Fonts, libs and chaos

Hello there,

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"):

  1. Get the font glyphs you're interested in using fontconfig and freetype2.

  2. Render the text using one of the following libs:

    1. Xft/Freetype2 (which apparently is the same? Or is it?)

    2. Pango, which has several backends (from man pango-view): cairo, ft2, xft, or x

    3. 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?

Bye!

Offline

#2 2012-04-20 12:00:17

foggy
Member
Registered: 2012-01-25
Posts: 31

Re: Fonts, libs and chaos

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)

Offline

#3 2012-04-20 12:13:57

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Fonts, libs and chaos

foggy wrote:

Both cairo and Xft respect fontconfig settings

The bug report is still open - after 4 years sad

Offline

#4 2012-04-20 12:27:32

foggy
Member
Registered: 2012-01-25
Posts: 31

Re: Fonts, libs and chaos

Huh, guess I am lucky that it looks the same...

Offline

Board footer

Powered by FluxBB