On 8/27/06, Roman Shaposhnik <[EMAIL PROTECTED]> wrote:
On Sun, 2006-08-27 at 14:24 +0200, Tor Andersson wrote:
> It still won't be perfect, since all Linux toolkits snap metrics to
> pixel integer coordinates which gives somewhat uneven spacing.
> Don't even think about CoolType or ClearType in Linux; the Xft code
> does not do filtering across pixel borders so it's a *lot* worse than
> it could be.

  Thanks for the info, but let me ask you this -- is there somebody
working on Xft to make it possible ? Are they pursuing a different
route ?

I'm not sure. If I remember correctly, Keith Packard explicitly decided
that he didn't want the filtering to cross pixel borders because that
might possibly confuse xterm and other character cell based software.
Stupid reason, if you ask me.

Fixing it to the same filter as Gargoyle is a trivial hack. The filter I use
is a simple [ 1 2 3 2 1 ] / 9 as illustrated here:

http://www.grc.com/cttech.htm

> It's not FreeType's fault that Linux text looks bad.
> For reference, with FreeType 2 it is possible to get the kind of
> text quality displayed in the screenshots on this web page:
>
> http://ccxvii.net/gargoyle/screenshots.html
>
> Here I use FreeType2 to render text unhinted, taking in account
> the fractional position of each glyph within the pixel (ie, the render
> of a character is different depending on whether it starts at pixel
> coordinate 0.0 or 0.2 or 0.7, for example). I also apply a 5-component
> wide LCD coloring filter.

  Tor, what kind of software did you use to achieve such a result ? Can
it be leveraged for Xft (at least the filtering part)?

I used pure freetype. The filtering can be done with a minor patch
to Xft; the hard part is not the code, it's the convincing the right people.

  Also, if you don't mind -- can you elaborate a bit on how did you
do fractional positioning (I mean it doesn't seem to be possible
with FT APIs so you must have done something else here).

Use the offset from integer coordinates as the translation part
of the transform matrix, then render unhinted. (Hinting assumes
that the translation is zero, if I recall correctly)

float x, y = ... coordinates of glyph in screen space ...
float xpart = x - floor(x);
float ypart = y - floor(y);

FT_Vector v;
v.x = xpart * 64;
v.y = ypart * 64;

FT_Set_Transform(face, &ctm, &v);
FT_Load_Glyph(face, gid, FT_LOAD_NO_BITMAP, FT_LOAD_NO_HINTING);
FT_Render_Glyph(face->glyph, FT_RENDER_MODE_LIGHT); /* or _LCD */

Tor


_______________________________________________
Freetype mailing list
Freetype@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype

Reply via email to