[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft] Regression in rendering quality with subpixel antialiasing

From: David Turner
Subject: Re: [ft] Regression in rendering quality with subpixel antialiasing
Date: Sun, 24 Sep 2006 05:55:13 +0200

Hello Bernd,

> Um, I have to admit that I simple added the marillat archive into our 
> sources.list, so there's everything available. Anyway, if Christian
> Marillat wouldn't do his really great work, I wouldn't care much about the
> multimedia stuff on our institut systems, its just not required for our work.
> However, we are looking all the day on the screen and are programming, 
> writing 
> articles, etc., so good fonts are really neccessary.
> Anyway, I will discuss this with Steve, maybe we can create two
> libfreetype6 packages - one in the main archive without bytecode and one in 
> non-free
> with bytecode..
I must say I've never heard of Christian Marillat, or even know who Steve is,
but, hey, any way to fix the situation would be appreciated :-)

> Ah, for me this is absolutely not so abvious, I only see two different
> font graphs and one is a bit more blurry than the other ;)
Yeah, it takes a little training to distinguish them :-)

> May I ask you for some basic help with libXft, libfreetype and
> libfontconfig? 
> So far I don't even know about there relations to each other. I guess a 
> program does a function call to libxft and libxft does a function call to 
> libfreetype to finally render the font, doesn't it? But who of them is 
> calling libfontconfig, libxft or libfreetype?

OK, I'll try to be brief, though this is going technical:

- freetype:
  as you know, it's a font engine, it basically takes a font file as
  input, and provides you with various tables, metrics as well as the
  ability to generate/transform glyph images

- fontconfig:
  this library is all about font "configuration", which really means
  knowing which fonts are installed on your system, what are their
  properties (e.g. supported languages & scripts), how to perform
  font mapping (which file corresponds to "Sans" or "Mono", for example),
  and a few oher things, like the default hinting and rendering modes
  that the user selected

  fontconfig works in a very unique way where you query it by passing
  something called a "pattern", which is simply a list of (key,value)
  pairs, and the library replies with another pattern that contains
  more specific information about what matched in its database.

  for example, you can pass a simply query like:

     (font_name=Mono, size=10pt)

  and it would answer something like:

     (font_name="Bitstream Vera Sans", 
      ....      // and a lot more stuff !!

  note the "hinting", "antialias" and "rgb" keys here, their value
  usually comes from your fonts.conf file, and correspond to the
  hinting/rendering mode you selected in your font properties dialog

  I will not detail how patterns are scanned and processed by fontconfig,
  but be confident it is complex and that there is certainly a full Lisp
  implementation hidden in its code to do that properly :-)

- libXft:

  this library is used to render anti-aliased text through the
  Xrender interface (or even core Xlib if the later is not available).
  you must pass it a fontconfig pattern that has a value for the
  "file" key (or something similar). libXft will scan the pattern
  then use FreeType to generate the corresponding glyph images needed
  for text rendering.

- cairo:

  this graphics library is used primarily by GTK2. It provides a
  uniform drawing interface to draw an all kinds of surfaces
  (in-memory buffers, X11 surfaces, PDF files, etc...), and also
  includes code similar to libXft that takes a fontconfig pattern
  as input, and uses FreeType to generate glyph images that are
  later used in rendering or path generation.

  note that Cairo and libXft should not be used concurrently by
  the same program. libXft shall be used as a better text rendering
  interface for "simple" programs like xterm that used to deal
  directly with core XLib calls. Cairo is used by recent versions
  of GTK2 and thus by all applications that use this framework.

  Qt still uses libXft as far as I know, or maybe re-implements
  its thing on top of fontconfig and FreeType.

  the funny thing is that, not very long ago, libXft and Cairo
  didn't interpret the hinting/rendering values from the fontconfig
  pattern the same way, resulting in surprising behaviour for
  some users :-)

> Hmm, a 'ldd soffice.bin' shows me that it is not linked to libXft. So
> either 
> my guess to the function call order is wrong or OpenOffice really calls 
> freetype functions without libXft.
> Is there a typical function call to libfreetype? I would just like to
> compare 
> what openoffice does differently.

first, don't always trust the output of ldd, because some programs open
some of the system libraries through explicit calls to the dynamic linker
(i.e. dlopen) in order to support a variety of versions of a given library
installed on the system. I know that at least FireFox and Thunderbird do

does OpenOffice links to Cairo ?

Another point to note is that an application is free to change a fontconfig
pattern freely, for example to enfore its own hinting style that may be
different from the default in fonts.conf.

Hope this helps,

- David Turner
- The FreeType Project  (

reply via email to

[Prev in Thread] Current Thread [Next in Thread]