I have a headless Gentoo box and would like to run X app on it but forward the display to a Cygwin Xorg server running on my Windows PC.

It works but I am not sure in this case if I specify some fonts to use in the X app, which font will be actually used? the one on the Gentoo box(where the X app is running)? or the one installed in my Cygwin (where the X app is being displayed)?

For example I want to use font DejaVu Sans Mono in urxvt, my ~/.Xresources on the Gentoo box looks like this:

URxvt*font: xft:DejaVu Sans Mono:size=12

On the Gentoo box I have the font installed and enabled. The following is the output of eselect fontconfig list

  [1]   10-autohint.conf
  [2]   10-no-sub-pixel.conf
  [3]   10-scale-bitmap-fonts.conf *
  [4]   10-sub-pixel-bgr.conf
  [5]   10-sub-pixel-rgb.conf
  [6]   10-sub-pixel-vbgr.conf
  [7]   10-sub-pixel-vrgb.conf
  [8]   10-unhinted.conf
  [9]   11-lcdfilter-default.conf
  [10]  11-lcdfilter-legacy.conf
  [11]  11-lcdfilter-light.conf
  [12]  20-unhint-small-dejavu-sans.conf
  [13]  20-unhint-small-dejavu-sans-mono.conf
  [14]  20-unhint-small-dejavu-serif.conf
  [15]  20-unhint-small-vera.conf *
  [16]  25-unhint-nonlatin.conf
  [17]  30-metric-aliases.conf *
  [18]  30-urw-aliases.conf *
  [19]  40-nonlatin.conf *
  [20]  45-latin.conf *
  [21]  49-sansserif.conf *
  [22]  50-user.conf *
  [23]  51-local.conf *
  [24]  57-dejavu-sans.conf
  [25]  57-dejavu-sans-mono.conf *

Then run xrdb on the Gentoo box to enable the resource (this makes me believe the font on Gentoo box will be used):

xrdb ~/.Xresources

When I start urxvt it complains:

urxvt: unable to load base fontset, please specify a valid one using -fn, aborting.

The output of both xdb -query and appres URxvt are same (only the 2 lines below):

URxvt*font:     xft:DejaVu Sans Mono:size=12
URxvt*scrollBar:        false

I think the font is installed without problem, output of fc-list|grep "DejaVu Sans Mono":

/usr/share/fonts/dejavu/DejaVuSansMono-BoldOblique.ttf: DejaVu Sans Mono:style=Bold Oblique
/usr/share/fonts/dejavu/DejaVuSansMono.ttf: DejaVu Sans Mono:style=Book
/usr/share/fonts/dejavu/DejaVuSansMono-Bold.ttf: DejaVu Sans Mono:style=Bold
/usr/share/fonts/dejavu/DejaVuSansMono-Oblique.ttf: DejaVu Sans Mono:style=Oblique

The output of strace urxvt is quite long, the following is the part which appears to have something to do with the font being specified in ~/.Xresources:

poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6, revents=POLLOUT}])
writev(6, [{"1\1\t\0\240\17\34\0", 8}, {"xft:DejaVu Sans Mono:size=12", 28}, {"", 0}], 3) = 36
poll([{fd=6, events=POLLIN}], 1, -1)    = 1 ([{fd=6, revents=POLLIN}])
recv(6, "\1\0=\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 4096, 0) = 32
recv(6, 0x817b310, 4096, 0)             = -1 EAGAIN (Resource temporarily unavailable)
recv(6, 0x817b310, 4096, 0)             = -1 EAGAIN (Resource temporarily unavailable)
write(1, "urxvt: ", 7urxvt: )                  = 7
write(1, "unable to load base fontset, ple"..., 77unable to load base fontset, please specify a valid one using -fn, aborting.
) = 77
  • Some overriding resource, maybe? Please post the output of appres UXrvt and appres uxrvt. – Gilles Oct 3 '13 at 23:44
  • Please post the output of strace urxvt, so that we can see what it's trying to load. – Gilles Oct 4 '13 at 0:00
  • That's not enough of the trace to be sure, but it looks like urxvt is sending the font string to the X server. This would only happen if urxvt is compiled without xft support. I've edited my answer to mention that. – Gilles Oct 7 '13 at 0:53
  • Please do not edit the title of your question to say “solved”. That's what accepting an answer is for. – Gilles Oct 7 '13 at 8:50
up vote 1 down vote accepted

The traditional X11 interface to display fonts has the client send a message to the X server that says, in effect, “display this string in this font”. So the font lives on the X server. X servers load fonts either locally or from an X font server (such as xfs). Font servers are mostly useful for displays with no or little disk space; this has become a niche use case. Rxvt uses the traditional interface if you specify an X11 font string (with the prefix x: or no prefix).

The traditional X11 interface is limited to bitmap fonts. Modern systems tend to use methods that render text on the client sides and send the resulting bitmap to the server. When you use the prefix xft:, URxvt uses the xft font rendering interface. The rendering is performed on the client side, from fonts loaded on the client machine.

Run xrdb -query to check what resources are loaded. Run appres URxvt and appres urxvt to see which resources apply (resources for the instance urxvt take precedence over resources for the class URxvt). One thing that may explain that your font setting isn't used is if some other setting (perhaps for URxvt.font or urxvt*font) overrides yours.

It's possible that your URxvt was compiled without Xft support (it's a compile-time option). Run urxvt --help 2>&1 | grep buffered: to see if the buffered resource is listed — it's only present when Xft support is present. Without Xft support, urxvt interprets the value of the fn resource as an X font string, which isn't valid.

The apps use the fonts on (available to) your X server, not where they actually run.

  • True when using X11 APIs to render fonts, but Xft uses client-side fonts. – Gilles Oct 3 '13 at 22:29

I solved the problem installing the xorg-xfd package. I read the answer posted by Gilles and I decided to list my packages. The libxft was installed but not works when I build the rxvt-unicode package. So, I listed the optional dependencies used by Xorg assigned to Xft. The Xfd it's responsible to display all fonts using X11 core protocol OR using libxft.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.