Domanda

I'm interested in how can i get a valid font name to use in in .Xresources file. I've installed ttf-ms-fonts and want to switch my terminal to courier font. But setting it like this does't work

urxvt*font:     cour
urxvt*boldFont: courbd

How do i specify a valid name?

È stato utile?

Soluzione

First, you have to decide if you want to use core protocol or Xft for font rendering. As you see in another answer, xfontsel is the right tool to get a correct font name for core protocol. But it's unlikely to be what you want for truetype fonts (do you want antialiasing? Then Xft is your choice).

If urxvt is built with Xft support (check urxvt --help 2>&1 | grep options to be sure), you might want to give it font names prefixed by xft:

URxvt.font: xft:Courier New

Other options affecting font matching and rendering may be specified in xft font name:

URxvt.font: xft:Courier New:pixelsize=18:antialias=false

(search man rxvt for xft: for further details)

All available font names can be queried with fc-list. E.g. fc-list|grep courbd.ttf shows you the font name is Courier New and style is Bold (append :style=Bold to select it).

Use fc-match "Courier New" to check which font is the best match for a given name from Xft's point of view.

Other applications may have their own conventions for X11 and Xft font names. E.g. the same xft: prefix is used by emacs; xterm uses faceName and renderFont resources to determine whether to use Xft and which font to request; xedit supports core protocol only. The mere fact that the application is configurable from X resources isn't enough to tell how the font names are interpreted.

Altri suggerimenti

i think you can use the program

xfontsel

to get the complete name of the font. The font name looks like this:

-*-courier-bold-*-*-*-*-*-*-*-*-*-*-*

Best wishes, Matthias

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top