[R] Categorizing Fonts using Statistical Methods

Leonard Mada lmada at gmx.net
Sun May 4 19:26:04 CEST 2008


Dear list members,

Every "modern" OS comes with dozens of useless fonts, so that the 
current font drop-down list in most programs is overcrowded with fonts 
one never will use. Selecting a useful font becomes a nightmare.

In an attempt to ease the selection of useful fonts, I began looking 
into sorting fonts using some statistical techniques. I summed my ideas 
on the OpenOffice.org wiki:
http://wiki.services.openoffice.org/wiki/User_Experience/ToDo/Product/Font_Categories

Of course, there is NO guarantee that something useful will emerge, but 
at least someone has tried it.

I would like to try various statistical methods using R, unfortunately, 
I got rather stuck in my attempts.

I wish to compute:
   - the length of a standard string for the various fonts
   - the weight
   - some variance-type measures for the OX and OY-axis
   - DCT (possibly analysing separately the low/high-frequencies)
   - maybe some other measures
     [I am open to suggestions]

1.) First and foremost, I need the list of fonts installed on my system.
[I am using Win2k]

Is there any way to get it automatically in R?

IF this is not possible, I could create one by hand, though this is 
cumbersome, but the 2nd problem is more severe.

2.) How do I create/get the 2D-pixel matrix?

I need of course the f(x,y)-image representation for a standard text.

The following seems a rather ugly hack and I do not actually have the 
exact text-box size.

 > png(file="mytestfontimage.png")
 > plot.new()
 > title("This is a font")
 > dev.off()

strwidth() and strheight() seem to be able to look into the fonts. But 
how do I get the pixels?
And more importantly, can I get also the exact pixel-matrix?
[Though, it seems there are no pixel-units in strheight()/width(), but I 
might be wrong on this.]

3.) The image-analyses capabilities of R are rather limited.
I couldn't find any reference to a DCT transform (or other techniques). 
A search yielded only the following thread:
http://tolstoy.newcastle.edu.au/R/help/06/01/19615.html

As I do not know (and have access to) mathlab, I am rather confined to 
R. Which is not bad, but I need a lot of help to accomplish this task.

Any help is highly appreciated.

Sincerely,

Leonard Mada



More information about the R-help mailing list