Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 305
roman Avatar asked Jan 06 '13 20:01

roman


People also ask

How do I get the font name in Linux?

Try fc-list command. It is a quick and handy command to lists fonts and styles available on the Linux system for applications using fontconfig. You can use fc-list to find out whether a particular language font is installed or not.

What is font hinting Linux?

Font hinting (also known as instructing) is the use of mathematical instructions to adjust the display of an outline font so that it lines up with a rasterized grid. At low screen resolutions, hinting is critical for producing clear, legible text.

What fonts are available for xterm?

The “fixed” alias is used as the default font for xterm windows. (Twelve-point Helvetica bold roman has the alias “variable” and is used by default for labels such as those in the titlebar twm puts on windows.)

What is xft font?

About Xft. The current version of Xft (2.0) provides a client-side font API for X applications. It uses FontConfig to select fonts and the X protocol for rendering them. When available, Xft uses the Render extension to accelerate text drawing.


2 Answers

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.

like image 55
Anton Kovalenko Avatar answered Sep 25 '22 11:09

Anton Kovalenko


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

like image 41
Matthias Avatar answered Sep 23 '22 11:09

Matthias