Custom font in Sublime Text 2 without installing it

1

In Sublime Text 2, is it possible to use other fonts than those which are installed on the system? If yes, how can I achieve this?

I am working on a Windows 7 machine without admin privileges and am tired of Courier New and Consolas.

ben

Posted 2015-01-23T11:51:56.817

Reputation: 333

Answers

5

This blog post describes using a utility called RegisterFont to add fonts as a regular user. I downloaded the .ttf files I wanted (Liberation Mono looks great in Sublime on all 3 supported platforms), put them in the same directory as as RegisterFont.exe, then created a batch file:

@echo off
RegisterFont.exe add LiberationMono-Regular.ttf LiberationMono-Bold.ttf LiberationMono-BoldItalic.ttf LiberationMono-Italic.ttf

saved it in the same directory, created a shortcut, then moved the shortcut to C:\Users\YourUserName\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup so that it runs every time Windows starts up. You can now go into your user preferences in Sublime and set

"font_face": "Liberation Mono",
"font_options":
[
    "subpixel_antialias",
    "directwrite"
],
"font_size": 9.0

and you should be good to go. The optimum "font_size" will of course vary depending on the font you use and your personal preferences, but these settings work great for me.


One downside to RegisterFont that I've noticed is that it doesn't seem to affect all programs. Sublime picks up the new fonts just fine, as does MS Office, but Firefox doesn't, for some reason. I'm running Win8, so maybe Win7 is different - YMMV.

MattDMo

Posted 2015-01-23T11:51:56.817

Reputation: 4 968

You just made my coding experience at work a little bit better. – ben – 2015-01-23T16:09:44.467