How to get a valid font name on linux system which can be used in .Xresources config?
Asked Answered
R

2

26

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?

Riddance answered 6/1, 2013 at 20:29 Comment(0)
C
24

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.

Catenoid answered 6/1, 2013 at 20:54 Comment(0)
D
5

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

Downstairs answered 6/1, 2013 at 20:37 Comment(1)
XFNs can only be used to specify bitmapped fonts, not TTFs.Pewee

© 2022 - 2024 — McMap. All rights reserved.