Sublime Forum

How to determine font faces?

#1

I’m on MacOS Sierra, and having installed a lot of fonts (and more) I’m struggling to get their names right in the config file, especially when I’m trying to switch between them to pick one. Some of them have the style and family combined in the name, some have spaces or dashes, and some only work if you use CamelCase names. What makes this more difficult is that sometimes font differences are subtle, you might not even realize that you aren’t really changing the font, but simply looking at default fallback. Is there a consistent way to know all the possible valid "font_face" strings?

Ideally there’d be a Choose Font fuzzy menu, but unfortunately the only plugin in existence isn’t compatible with ST3.

1 Like

#2

You can open a issue on its issue tracker asking for the maintainer to upgrade the package to Sublime Text 3:

  1. https://github.com/jolleyjoe/OSX-Font-Chooser/issues

Some times, simple package available only for Sublime Text 2, are working without any modification on Sublime Text 3. They are just not available to by Package Control. Then you can try to manually install the package and see if it is working:

  1. https://stackoverflow.com/questions/31945735/how-to-install-sublime-package-without-package-control
0 Likes

#3

Having posted the issue, and being reluctant to test the plugin on ST3, I’m still thinking there must be a way to get that list somehow.

0 Likes

#4

The implementation is here, and it works just fine as a plain python 2 script. Minimally:

import Cocoa
print(Cocoa.NSFontManager.sharedFontManager().availableFontFamilies())

Run that with the default system Python and you’re good to go.

1 Like

#5

This worked thanks! For future googlers: you should specifically run this with /usr/bin/python, if you installed pythons via homebrew (/usr/local/bin/python) it will say “No module named Cocoa”, since it’s not compiled with macos bindings. Just run /usr/bin/python and copy the script into the prompt.

0 Likes