[sugar] X fonts, and Cairo fonts

Don Hopkins dhopkins at DonHopkins.com
Wed Mar 14 00:13:06 EDT 2007


Two questions about fonts:

For an X application, which fonts are available? Which are recommended? 
xlsfonts does not list a lot of them, and the ones listed have ugly 
sounding names. (Does the latest build add more fonts? I'm downloading 
it now.) Are there more fonts available to X applications that I can't 
see with xlsfonts? Specifically the OLPC Human Interface Guidelines 
recommends Bitstream Vera Sans, which I would like to use. What font 
string can I pass to the standard old X library functions to get that 
nice font, and what sizes are available?

Maybe I'm just hallucinating, but for a Cairo/Pango application (pie 
menus), it seems that the size a font is rendered depends on the screen 
resolution. On my laptop/vmware/fedora core/x11 development system, I 
configured all the pie menu fonts so they looked nice on the 75dpi 
screen. But then when I ran the same Python code on the actual OLPC's 
200 dpi screen, the fonts came out way too big compared to the graphics. 
So I had to reduce the point size of the font by multiplying by a factor 
of 75/200 or so. But that was clumsy because Cairo font specs are 
strings that look like "zapf-dingbats 64", and the point size is not a 
number that's easy to scale mathematically.

It's kinda weird that the text adjust the font size for the dpi, but the 
rest of the graphics don't. Is this a Pango thing or a Cairo thing? 
Should I be checking the dpi and factoring that into the scale of the 
graphics I draw, but not the text? (That's pretty inconvenient... Not 
the way PostScript works. I'd prefer that all drawing scales according 
to the screen resolution, not just fonts.) Is there a way to fake out 
the dots per inch so the development machine acts like it has a 200 dpi 
screen? Maybe the X configuration file? Or is there a better approach 
that would enable the program to work correctly on any dpi screen, 
without bending over backwards?

    -Don



More information about the Sugar mailing list