From: Tomas Frydrych (tomas@frydrych.uklinux.net)
Date: Tue Feb 26 2002 - 17:24:53 GMT
I have been looking into using the FreeType font renderer 
(www.freetype.org) , and I was rather suprprised how simple it 
would be to implement our drawChars and measureCharWidth 
functions with it.
I was initially looking at this as a means to solve our Unix font 
problems, and there is no doubt in my mind that this is the way to 
go -- not only would using FreeType completely resolve the font 
mess, but we would also get rid off the Unicode->8-bit-locale 
translation that we currently have to do at every text-drawing and 
text-measuring operation.
As I have been examining what FreeType offers, I came to the 
conclusion that we would in fact be well advised to use it from our 
XP code, getting rid off the platform specific measureCharWidth 
and drawChars functions. There are several good reasons for this:
(1) We should be able to improve the WYSIWIGness of our screen 
output; on win32 in particular we currently struggle with 
cummulative truncating errors in width calculations for which there 
is no simple cure -- with FreeType we should be able to get a 
better precision.
(2) We would be able to add font aliasing to all our platforms.
(3) We would be able to use proper kerning on all platforms with 
very little coding effort. This is very desirable and at present would 
be lot of work to implement (in platform code).
(4) We would be able to use the scalable fonts supported by 
FreeType on all our platforms -- i.e., you could use pfa/pfb fonts on 
Windows, if  you wanted to. FreeType supports TrueType, 
OpenType, PostScript, CID keyed fonts, and others.
(5) Finally, and IMO most importantly, having an xp font renderer 
would greatly simplify maintanance and further development. What 
has proved to be the worst nightmare in the bidi work, is getting 
RTL text out on the screen correctly under different OS's. For 
instance, the capbilities of the various flavours of win32 differ 
widely, with no standard way of determining what they are; inspite 
of hours of work and long nights, RTL text still does not display 
correctly on some flavours of win32 when using some fonts. We 
end up with unreliable heurstics trying to convince the system to 
do what we want it to do. We will have to relive this again and again 
when someone will get to getting bidi work on Mac, BeOS, QNX ... 
With FreeType we would have a single layout engine with single 
set of bugs and equal (and excellent) capabilities on all platforms.
There is one drawback -- we may loose some OS specific 
capabilities. For instance some bidi-enabled win32 can do 
glyphshaping using OpenType fonts; FreeType2 at the moment 
cannot. I consider this a small price to pay. At the moment we do 
not make use of it, and will not in forseeable future. We will want 
this in the medium to long-term, but even then to do glyphshaping 
in the platform code would be a maintanance nightmare; the 
FreeType folk started a separate project on a layout library that will 
provide this functionality, so in long term there will be an xp 
solution.
It seems to me that the benefits of using FreeType far outweight 
any drawbacks. If we can agree on this, then migrating to FreeType 
should be one of the first things to do after the 1.0 release.
Tomas
This archive was generated by hypermail 2.1.4 : Tue Feb 26 2002 - 12:32:06 GMT