[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: truetype fonts in x11, wrong metrics?



On Mon, 30 Apr 2007 09:38:22 +0200
"BALLABIO GERARDO" <GERARDO.BALLABIO@mpsgr.it> wrote:

> Hi all,
> 
> I've recently switched from Sarge to Etch (I've decided to do a
> reinstall, not an upgrade, because I also wanted to repartition the
> hard disk) and in the last few days I've been restoring my
> customizations.
> 
> I've run into a problem with fonts. In Sarge I had configured Emacs to
> use the same font as the Gnome Terminal, and I want to do the same
> thing in Etch. The font family Gnome is using is "DejaVu" (package
> ttf-dejavu). As this is a TrueType font, it isn't immediately
> available from Emacs: it has to be registered first as an X11 font. I
> had been able to do that in Sarge by following directions from this
> page: http://www.paulandlesley.org/linux/xfree4_tt.html
> (specifically, section 4.2) and tried to do the same in Etch.
> Basically the procedure is: 1. go to the directory where the TrueType
> fonts are stored (that is /usr/share/fonts/truetype/ttf-dejavu)
> 2. run ttmkfdir (creates fonts.scale)
> 3. run mkfontdir (creates fonts.dir)
> 4. in /etc/X11/xorg.conf add the following line to Section "Files":
>    FontPath /usr/share/fonts/truetype/ttf-dejavu
> 5. restart the X server
> (of course must be done as root)

The x-ttcidfont-conf package takes care of the registration of truetype
fonts for you.

> So this worked in Etch too: after the procedure, "xlsfonts | grep
> dejavu" shows quite a lot of fonts. The one I want seems to be
> "-misc-dejavu sans mono-medium-r-normal--15-150-75-75-m-0-iso10646-1"
> (in the Gnome font panel it's listed as "Monospace, 12 pt"). But
> strangely, when I run Emacs with this font, the text window isn't
> dimensioned correctly: it should be 80 characters wide, but only 72
> fit within. There's also some extra spacing between lines. See
> attached screenshot: the Gnome Terminal window shows what it should
> look like.

Are you sure that the screen width is not an Emacs setting, rather than
a font issue? What width do you get if you switch to a non-truetype
font?

> 
> I guess that Emacs doesn't get the font metrics correctly. I don't
> know which I should blame -- the font files, Emacs or X-Windows.
> Anyway, does anyone know what I could do to fix this?

From your screenshot, I see that Emacs (or is it xemacs?) is a GTK1
application. gnome-terminal is a GTK2 application. The former gets its
idea of screen resolution directly from the X server, whereas the
latter uses the X resource database. Compare the output of the
following two commands:

    xdpyinfo | grep resol
    xrdb -q | grep dpi

Are the DPI values different?

> 
> Please Cc: me, I'm not subscribed.
> 
> Thanks everybody
>  Gerardo


-- 

Liam



Reply to: