I wrote earlier about how to set up X forwarding between FreeBSD and Windows. Unfortunately, once all that was done, my Emacs came out looking like this:


Ugly Emacs

Now what? Again, things are kind-of backwards from what I assumed. My first instinct was to install nicer fonts into Xming somehow, but I never found anything.

So after some experimentation, it occurred to me that the fonts are for the X client (i.e. my BSD machine), and the X server is just responsible for rendering. Said and done, I searched for free good programming fonts and ended up at a page with an opinion (I don’t care so much, so if someone says it’s a good font, chances are I’ll be happy with it.) I settled for Droid Sans Mono. Does it exist for FreeBSD? Turns out yes. So given this package name, I now know to do:

$ sudo pkg install droid-fonts-ttf

Since this is an X-client-side concern, I should now be able to restyle Emacs as if I was running X on the local BSD machine (if you’ll excuse the Elisp):

;; X11-specific settings.
(when (display-graphic-p)
    (set-default-font "Droid Sans Mono 14")
    (load-theme 'zenburn t)
    (tool-bar-mode -1))

And voilá, here’s what Emacs looks like when I launch it from a PuTTY SSH session:


Pretty Emacs

Unfortunately, it’s all but useless, because it thinks my keyboard layout is US English. I’m a Swede, born and raised, and can’t live without the Swedish keyboard layout (which sucks for programming, by the way, but we’re hardy people so we take it in stride.)

OK, another client/server conundrum… Who owns the keyboard layout? Intuitively I’d say the X server, because it’s in charge of user input and graphics rendering. So I search the web for ”Xming Swedish keyboard” and find a nice article from the University of Uppsala, describing how to set this up in Xming. It turns out the recommended layout for Swedes is Finnish. I’m not going to argue — my grandmother was Finnish — so I update my launch shortcut for Xming to say:

"C:\Program Files (x86)\Xming\Xming.exe" :0 -clipboard -multiwindow -xkbmodel pc104 -xkblayout fi

Finally, this setup actually works!