TrueType fonts in GNU Emacs

Thu Jul 3 2008
emacs fonts truetype linux unix

Listing installed TrueType fonts in Emacs

In this new fangled age of TrueType support in Emacs it’s really useful to know the names of the Monospace fonts installed on your system in the format that Emacs understands. If you are on a Linux/UNIX system running Xorg with fontconfig installed then add this function to your .emacs file

(defun list-monospace-truetype-fonts ()
  "Provide a list of available monospaced truetype fonts on this
   machine"
  (interactive)
  (set-buffer (get-buffer-create "Monospaced Fonts"))
  (call-process-shell-command "fc-list :spacing=mono:scalable=true family | sort" nil t)
  (setq buffer-read-only t)
  (switch-to-buffer-other-window (current-buffer)))

You can set these fonts in a number of ways, currently I am getting the most joy using this form:

(defun safe-set-initial-font (fontstring)
  "Set the default frame font"
  (interactive "s")
  (setq initial-frame-alist
 `((font . ,fontstring)
   (background-color . ,(face-background 'default))
   (foreground-color . ,(face-foreground 'default))
   (horizontal-scroll-bars . nil)
   (vertical-scroll-bars . nil)
   (menu-bar-lines . 0)
   (height . 40)
   (width . 80)
   (cursor-color . "red")
   (mouse-color . "green")))
  (setq default-frame-alist (copy-alist initial-frame-alist)))

That’s pretty nasty, but it gets round a bug where opening a new frame results in a different font being used.

System Updates With Mixin

Wed May 15 2019
clearlinux mixin linux package-management

Enabling H.264 playback in Firefox on Intel's Clearlinux

Wed May 15 2019
clearlinux h.264 linux

HTML5 and all that

Sun Jan 10 2010
frontend html clojure xml flash google_gears emacs nxml