help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help in querying xlsfonts for a particular font from elisp


From: Andrew M. Scott
Subject: Help in querying xlsfonts for a particular font from elisp
Date: Fri, 25 Aug 2006 08:41:20 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

I really like the "vera sans mono" font, but it's only available on
some of the platforms I use. 

My .emacs currently uses the elisp fragment below, with a simple (getenv 
"PLATFORM")
kludge in the <need-some-help-here> test section; however this fails if I ssh 
from
a supported platform's xterm onto an unsupported platform.

I'd like help with cleaner solution to test for a supported platform
font.

(when (<need-some-help-here>)
   (set-face-font 'default "-bitstream-bitstream vera sans 
mono-medium-r-*-*-16-120-*-*-*-*-*-1")
   ;; AMS: Not clear why I need these next two lines
   (add-to-list 'default-frame-alist '(font . "-bitstream-bitstream vera sans 
mono-medium-r-*-*-16-120-*-*-*-*-*-1"))
   (add-to-list 'initial-frame-alist '(font . "-bitstream-bitstream vera sans 
mono-medium-r-*-*-16-120-*-*-*-*-*-1"))
   (set-frame-position (selected-frame) -8 -100)
   )

The X11 xlsfonts command seems promising, e.g.

xlsfonts -fn "-bitstream-bitstream vera sans 
mono-medium-r-*-*-16-120-*-*-*-*-*-1" | wc -l
returns
2 
on a supported platform, and the two lines

xlsfonts: pattern "-bitstream-bitstream vera sans 
mono-medium-r-*-*-16-120-*-*-*-*-*-1" unmatched
0

I've played with variations of shell-command e.g.
(when (shell-command "xlsfonts -fn '-bitstream-bitstream vera sans 
mono-medium-r-*-*-16-120-*-*-*-*-*-1' | wc -l" t)
  (message "font exists")
     (message "font doesn't exist"))
but the shell calling subtleties escape me. Is there a non-interactive
version of shell-command?

Thanks,
Andy Scott


reply via email to

[Prev in Thread] Current Thread [Next in Thread]