Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
KDE/Freetype antialiased font rendering.
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Sivar
Apprentice
Apprentice


Joined: 25 May 2002
Posts: 266
Location: USA

PostPosted: Sun Jun 09, 2002 1:40 am    Post subject: KDE/Freetype antialiased font rendering. Reply with quote

I very much like the antialiasing features of KDE as it makes fonts look vastly better than they do without...

...However, it seems that the font rendering could be a bit better. Now, I am no expert at font rendering, and I am sure that the powers that be (the programmers) know far more than I do and that there is probably a technical or legal reason thus far for the following problem (Adobe patent?), but I do have a comment:

Antialiased fonts rendered in X look as though they were antialiased using supersampling. I am probably oversimplifying things greatly, and font rendering uses many methods (hinting, for example), and supersampling does look great for some things, such as 3D games. For fonts, however, supersampling makes fuzzy and blurry parts of the font that should be entirely left alone. Example:

If you have a simple capitol letter "E"; one that has no curves but JUST straight vertical and horizontal lines making up the letter, its appearance should not be changed by the font AA engine. Antialiasing should only be performed on the edge of curved areas, such as the rounded part of the letter "P"
AA rendering in X, however, seems to apply filtering to the straight areas of characters as well. For example, as I type this, the right-most pixel of the lower case letter 'l' (lower case 'L') is an average of the white background and the black letter, thus making it dark gray rather than completely black.
This may not seem like a big deal at all, and the font rendering does still look very good, but it does make a difference when one stares at a monitor for a long time and when one needs sharp, clear letters (for example when the letters are small or very tightly packed)
Turning AA on has an effect vaguely similar to having a cheap monitor or a second-order lowpass filter (instead of a fourth or fifth) on a video card, like cheap RAMDAC setups do. It isn't quite as destructive to image quality, but it has similar blurring consequences.

Now, I read a while back when I was researching font antialiasing that Freetype was force to use an inferior method for rendering fonts because of a patent held by Adobe. I do NOT know if this rendering method or the patent by adobe have anything at all to do with the antialiasing problem that I am speaking of. I also read that a small modification to the source code could be made to use the better method, which would of course require a license from Adobe to use.
Does anyone know:

1) If this rendering problem is happening because of a mistake of mine or because the rendering is not yet mature.

2) What that source code modification is, and where one can contact Adobe for such a license

3) Any ideas or solutions/comments/notes about any of this.

I am using all TrueType and OpenType fonts when I can, I have many extra fonts installed, I have manually reemerged the latest version of Freetype and have done all the little tips floating around for fixing unrelated font problems, not because I am experiencing that problem but to see if the fix improves overall rendering.
Thanks for any comments.
_________________
The greatest deeds are still undone, the greatest songs are still unsung...
Back to top
View user's profile Send private message
474
l33t
l33t


Joined: 19 Apr 2002
Posts: 714

PostPosted: Sun Jun 09, 2002 4:30 am    Post subject: Reply with quote

The patents are held by Apple, read this interesting page: http://www.freetype.org/patents.html. Yes, Apple designed and implemented TrueType, not Microsoft or Adobe! Your are correct in your assertions as far as KDE anti-aliasing goes.

First, read some posts I made before (just because you might find some items of interest, and you should see them before what I am going to say below!).

https://forums.gentoo.org/viewtopic.php?t=2233
https://forums.gentoo.org/viewtopic.php?t=3828

Secondly, I don't think re-emerging freetype is going to make any difference. X compiles Freetype statically from source code that is is bundled with the X tarballs - so, it's independent from your freetype build. It uses freetype 2.0.6, except for XFree 4.2.0-r11 which now uses freetype 2.0.9. Having said that, I am not sure how the KDE anti-aliasing mechanism fits into everything else. I presume that turning it on means that it employs the direct render extension (libXft to be precise) in its capacity to render anti-aliased fonts.

Thirdly, as I'm sure you know, the big fuss about Truetype rendering and the patent issue in lieu of freetype concerns the use of the bytecode interpreter option. Gentoo automatically ensures that the macro is enabled before compilation in the case of standalone freetype and the X bundled one. When it is not enabled, auto-hinting is used which isn't supposed to be as good in terms of hinting the glyphs and rendering the fonts at small sizes. Now here's the funny thing: it's been reported that you get better results using methods which have nothing to do with it. Well, specifically: a guy called David Chester patched libXft, calling it the "Xft-slight" patch). This does not make use of the bytecode interpreter, but for best results the auto-hinter should be on. And guess what? It really does seem to look way better! My tests went well (I manually extracted the i586 pre-compiled libXft from his tar.gz just to test it, rather than patch and recompile X and freetype :wink: ). Comments on the MandrakeForum were in favour of it also. I suggest you go and check his site, and look at the examples. On one of them, you can clearly see that the unpleasant blurring effect on straight lines is not there, or at least nowhere near as pronounced. The kerning and sizing of the characters also seems to be much better :D

http://www.cs.mcgill.ca/~dchest/xfthack/

Even better, he is working on moving the patch into freetype itself. According to him:
Quote:
This way, GNOME 2, OpenOffice, Mozilla, and other applications/environments will more easily be able to make use of the slight hinting code. I am aware of gdkxft and the xft-mozilla patch, but moving my changes into freetype seems to make the most sense. I have also tweaked a few lines in the freetype code itself which has resulted in better quality rendering with my slight hinting. In some cases, the improvement is significant. I hope to have the code moved over and finish up some other details within a few weeks.

Yay! This is very good news indeed. I recommend you check it out.

Also, I think the XFree build in Gentoo applies some alternative freetype|Xft patch, and someone in this forum said it was a bad patch and just made things worse. Sorry, I can't verify it right now because I'm not on my Gentoo box but if you check the ebuild you should be able to see for yourself. I would get rid of it, especially if you want to try using Chester's patch.

Fourthly (!), freetype 2.1.0 has been released. I was intrigued when I heard about this and here's why:
Quote:
LATEST CHANGES BETWEEN 2.1.0 and 2.0.9

I. IMPORTANT BUG FIXES

- The TrueType bytecode interpreter has been fixed to produce
_exactly_ the same output as FreeType 1.x. Previous differences
were due to slightly distinct fixed-point computation routines
used to perform dot products and vector length measurements.
It seems that native TrueType hinting is _extremely_ sensitive
to rounding errors. The required vector computation routines have
been optimized and placed within the "ttinterp.c" file.
- Fixed the parsing of accelerator tables in the PCF font driver
- Fixed the Type1 glyph loader routine used to compute the font's
maximum advance width.

Hmm, sounds good yes? I guess we'll have to wait a bit before it becomes properly supported, though I'm not convinced that it will necessarily negate or better Chester's contributions, even then. I might try compiling 2.1.0 into X myself just to see what it's like, when I get a spare moment or two.

Finally, on the subject of applying for a license I suspect most people would say "screw Apple and their patent". I mean, AFAIK every USA Gentoo user is violating the patent because Gentoo enables the bytecode interpreter by default!! Let's put it this way, I wouldn't lose too much sleep over it ...

BTW, if you want to control the size ranges for fonts where AA will be applied in your Xftconfig file then you must use the "match any pixelsize" directive, as well as "match any size". At least, that is the only way to control it in the KHTML engine (Konqueror). You will probably want to disable AA at fonts between 8-14pt or so because it just isn't necessary.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum