[mcclim-devel] making freetype more portable

David Lichteblau david at lichteblau.com
Tue May 23 12:22:04 UTC 2006


Quoting Christophe Rhodes (csr21 at cam.ac.uk):
> > I was thinking about either trying to translate the definer macros to
> > acl ffi or, in the hopes of broader portability, to CFFI.  But it
> > seems like the defining sublanguage for CMUCL & SBCL is fairly
> > different from CFFI.

Translating from alien to cffi is rather easy.  It worked well for me
with clim-cairo.  It is mostly a matter of search&replace.

> I'd suggest not bothering, and spending the time improving the gtkairo
> backend instead: you get antialiased graphics as well as antialiased
> text that way.

There might be code and ideas to steal from clim-freetype for gtkairo's
benefit.  (Warning, I have not actually investigated any of of following
issues in detail, but here is my current impression:)

If I understand correctly, clim-freetype handles two problems: Selecting
fonts through freetype.  And actually drawing text.


Cairo has its own drawing functions, in two varieties: A "toy API" for
text, which gtkairo is currently using.  In addition, there is a much
more nifty glyph-based API which probably has many advantages, although
I am unclear about what those are.

If we wanted to do glyph-based drawing, clim-freetype might be a good
inspiration for that code.


As for selecting fonts, cairo itself gives little control over that, but
instead applications can look up fonts through either freetype or
Windows APIs and use those with cairo.

It would be nice to translate the clim-freetype code for font selection
from alien to cffi and adapt it for gtkairo.

gtkairo on Windows currently finds only sans-serif fonts.  Not sure
whether GTK+ on Windows supports freetype fonts or not, but probably
either freetype or Windows functions will solve that bug.  So it may
turn out that a freetypification of gtkairo on Unix happens to fix the
Windows problem, too.


Finally, if any of you have clim-freetype up and running on SBCL or
CMUCL, can you do an experiment for me?  Gtkairo's font drawing is
currently relatively slow compared to CLX.  What I do not know is how it
compares to clim-freetype.

Could you perhaps benchmark CLX+Freetype for me?  You don't need gtkairo
for that.  Just run clim-demodemo, select the drawing benchmark and run
it with the text drawing option.  The interesting bit would be to
compare the resulting score between CLX with freetype and without.


Thanks,
David



More information about the mcclim-devel mailing list