[Sugar-devel] More information on font scaling problem

Albert Cahalan acahalan at gmail.com
Mon Jun 8 06:35:46 EDT 2009


Tomeu Vizoso wrote:

> In 0.84 Pango knows the resolution of the screen and scales all
> fonts accordingly. This means that by using, say 10, the font
> will always look good in all hw.

I wish this were so. Consider 3 ways to measure font size:

1. number of pixels
2. physical size on the screen
3. angular size (depends on physical size and viewer distance)

For readability, both #1 and #3 have lower limits. That "10"
you feed into Pango has nothing to do with either; it's #2.
On the screen, almost nobody actually cares about #2. Lots
of systems lie about it, including Browse.

Normally people sit far away from a large screen. If we assume
that people tend to fill their eye's viewing area with the
screen, then pixels per character should scale according to
the number of pixels across the screen. (diagonal perhaps)

Most everything tends to break down when using a projector.
You may be at 5 DPI, yet the angular size is smaller than
normal.

A practical way to size things is to make font and icon pixel
dimensions scale with the square root of the screen pixel
dimensions. Tux Paint does this for stamps. Like this:

d = sqrt(x*x+y*y); // diagonal screen size in pixels
d0 = sqrt(x0*x0+y0*y0); // same, for a standard reference screen
s = sqrt(d)/sqrt(d0); // scale factor

So if the reference is 640x480 and you want to display on a
2560x1920 display, the scale factor is 2.

(the idea is that people want to use extra resolution both for
more object detail and more objects; this splits the usage)


More information about the Sugar-devel mailing list