I'm trying to find a command that will report what font a given X window is configured to use. Does such a command exist?
Looking through these tools I did not see an option that would give me this:
- xwininfo
- xdpyinfo
- xprop
- xlsclient
Looking through the output of lsof
I see font files that appear to be in use, however it's not clear which ones, if any, are actually being used by a given window.
Example
$ lsof |grep gnome-ter|grep font | head -8
gnome-ter 3282 saml mem REG 253,0 223040 1180775 /usr/lib64/libfontconfig.so.1.4.4
gnome-ter 3282 saml mem REG 253,0 3656228 1588238 /usr/share/fonts/un-core/UnDotum.ttf
gnome-ter 3282 saml mem REG 253,0 585272 266781 /usr/share/fonts/gnu-free/FreeSans.ttf
gnome-ter 3282 saml mem REG 253,0 323284 1447753 /usr/share/fonts/dejavu/DejaVuSansMono.ttf
gnome-ter 3282 saml mem REG 253,0 190240 1588229 /usr/share/fonts/paktype-naqsh/PakType_Naqsh.ttf
gnome-ter 3282 saml mem REG 253,0 683528 1447770 /usr/share/fonts/dejavu/DejaVuSans.ttf
gnome-ter 3282 saml mem REG 253,2 42144 10488291 /home/saml/.fonts/ProggyCleanSZBP.ttf
gnome-ter 3282 saml mem REG 253,0 15504 1966923 /var/cache/fontconfig/87f5e051180a7a75f16eb6fe7dbd3749-le64.cache-3
To be clear, I'm not interested in this solution, titled: How to check which font the system uses?:
$ gconftool-2 --get /apps/gnome-terminal/global/profile_list
[Default,Profile0]
$ gconftool-2 --get /apps/gnome-terminal/profiles/Default/font
Monospace 12
$ gconftool-2 --get /apps/gnome-terminal/profiles/Profile0/font
TakaoMincho Bold 36
I want to determine this information via X if possible.
Best Answer
Most modern applications, including all Gtk (→ GNOME) and Qt (→ KDE) applications, use xft, which performs the rendering client-side and sends an image to the server. (Possibly via the XRender extension, but it's an image that gets sent for rendering, not text). So for these applications the X server has no notion of fonts. You can't do any better than checking whether the application has (had) the font file opened.
Even for old-fashioned applications that use server-side fonts, I don't think there's a way in Xlib to query which fonts another client is using.