This is what a default installation of EmacsW32 looks like.
Oh horror! You guys are kidding, right? Courier? Seriously?
Naturally, my first inclination was to use Inconsolata again. Just like in Mac OS X. However, this is what Inconsolata looks like.
WTF? What’s with all the blurred text? Well, it turns out that anti-aliasing and text rasterization differ significantly between Mac OS X and Windows. Oh well. Scratch that plan.
Then I remembered that Incosolata is actually based on Consolas, which is a font Microsoft created specifically for programming.
I downloaded and installed Consolas, and voila! Beautiful Emacs once again.
Now it was just a matter of figuring out what the font was called. I
had changed the font by clicking on the Emacs frame and pressing the
shift key. In order to see what that does, I ran the
function by typing
C‑h k, then clicking on the frame while holding
the shift key. That told me the function that is called is
mouse‑set‑font and it’s defined in
c:/Program Files/Emacs/emacs/lisp/term/w32-win.elc. You can click on
the file link and Emacs will take you to the function definition.
(defun mouse-set-font (&rest fonts) "Select an Emacs font from a list of known good fonts and fontsets. If `w32-use-w32-font-dialog' is non-nil (the default), use the Windows font dialog to display the list of possible fonts. Otherwise use a pop-up menu (like Emacs does on other platforms) initialized with the fonts in `w32-fixed-font-alist'. If `w32-list-proportional-fonts' is non-nil, add proportional fonts to the list in the font selection dialog (the fonts listed by the pop-up menu are unaffected by `w32-list-proportional-fonts')." (interactive (if w32-use-w32-font-dialog (let ((chosen-font (w32-select-font (selected-frame) w32-list-proportional-fonts))) (and chosen-font (list chosen-font))) (x-popup-menu last-nonmenu-event ;; Append list of fontsets currently defined. ;; Conditional on new-fontset so bootstrapping works on non-GUI compiles (if (fboundp 'new-fontset) (append w32-fixed-font-alist (list (generate-fontset-menu))))))) (if fonts (let (font) (while fonts (condition-case nil (progn (setq font (car fonts)) (set-default-font font) (setq fonts nil)) (error (setq fonts (cdr fonts))))) (if (null font) (error "Font not found")))))
Now, I don’t know what all of that does, but it seems like
(set‑default‑font font) is the one function that actually sets the
font. In order to figure out what the font is called, I copied all of
the function to the good old
scratch buffer, and added a call to
(message font) right after the call to
(set‑default‑font font). Then I redefined the function by typing
C‑x C‑e at the end of it. After shift clicking on the frame again
and selecting the Consolas font I had all the information I needed.
Now it was just a matter of putting the following snippet in my
Ahh… I feel so much better now… now what was I doing in Windows again?