Fonts and DPI
August 8, 2007
Making nice looking fonts on your screen takes a little bit on know how. I found out recently that the settings for my fonts were wrong this entire time.
And I don’t mean wrong as in pull out the ugly stick wrong, they just needed some personal attention. The best best to improve the fonts is to learn the correct DPI of the screen. This was my problem. I had been using the original DPI the X server choose sine I installed Gnome and I wasn’t sure that it was a good idea to change it. The DPI could be listed in PC handbook that came with the computer which is the best place to look. It, however, isn’t very difficult to figure this out one’s self.
Since most specifications now just list the diagonal length of the screen, I’m gonna use that. The MacBook I uses a 13.3″ (diagonal) LCD screen with 1280 x 800 resolution. I used the Pythagorean Theorem here to correspond the diagonal and horizontal/vertical measurements. 1280² x 800² = c² So the measurement on my MacBook diagonally in pixels is 1509.436… Now figuring your dots per inch is simple, just divide this value by the actual size of the screen diagonally. 1509/13.3. So the DPI of my LCD is 113.49… This is the value to set in Gnomes Font Preferences. Of course, this now means you’ll have to enter all new sizes for the fonts.
To make this even simpler by using a function for bc (command line calculator):
echo 'scale=5;sqrt(1200^2+800^2)/12.1' | bc
Xserver and xdpyinfo can also discover the dots per inch. Careful though as the value may not always be correct. Xserver will default to 75×75 if it cannot discover a value.
To discovered these values:
xdpyinfo | grep resolution
cat /var/log/Xorg.0.log | grep DPI
When the fonts are set its best to use whole numbers and partial ones may crunch the fonts (i.e. not show them proportionally).
Thanks to Padaa for showing me that my fonts weren’t up snuff, though I berated him for getting off topic
.
Entry Filed under: Linux. .
4 Comments Add your own
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed




1.
jfb3 | August 11, 2007 at 8:33 pm
Unless I’ve missed something ‘newspr’ isn’t a USE flag for libXft or cairo. Even ‘euse -i newpr’ returns nothing.
Via grep
Checked cairo:
1.2.6
1.4.4
1.4.6
1.4.8
1.4.10
Checked libXft:
2.1.10
2.1.12
When I ‘xdpyinfo|grep resloution’ I get “resolution: 129×126 dots per inch” as an answer. Which number should I use?
2.
dirkrgently | August 13, 2007 at 10:13 am
I haven’t located a description yet either jfb3 but I can clearly see them:
emerge -pv cairo libXft
These are the packages that would be merged, in order:
Calculating dependencies… done!
[ebuild R ] x11-libs/cairo-1.4.10 USE=”X glitz opengl newspr svg -debug -directfb -doc -xcb” 0 kB
[ebuild R ] x11-libs/libXft-2.1.12 USE=”newspr -debug” 0 kB
Alot of changes I’ve noticed in portage lately, maybe it’s your best bet to try “emerge –sync” again. Also I noticed a could people have it in their overlays.
As for the DPI, there isn’t much that I know of that you can do. Since the font manager figures DPI in a square number… perhaps a different resolution?
3.
jfb3 | August 13, 2007 at 10:50 pm
I *did* a sync immediately prior to checking for newspr in cairo and libXft.
My guess is that you’re using overlays of cairo and libXft not the standard ebuilds
My screen resolution on my laptop is 1680×1050 and no, a different resolution isn’t a proper option that’s the native resolution of the lcd.
4.
dirkrgently | August 14, 2007 at 2:54 pm
Very very interesting. Yes I do use an overlay, but I deleted the overlay and pretend emerged, from Gentoo portage, cairo and libXft and saw the “newspr” flag. There must be a central repository for USE, hmm. Yeah ok, use the “xeffects” overlay it has them in there, it’s part of layman so it’s simple to add.
“When I ‘xdpyinfo|grep resloution’ I get “resolution: 129×126 dots per inch” as an answer. Which number should I use?”
It doesn’t hurt to enter DPI value into font preferences, they are so close to each other that it probably doesn’t matter.