[Share Code] Custom editor font
lukaskollmer last edited by
Recently, I asked if it is possible to use custom fonts in the editor.
After some experimentation with this, I ended up with a script to automatically load a custom font and set it as Pythonistas default font.
You can download the example font from http://cdn.kollmer.me/embed/SFMono-Regular.otf
Add the script to your
site-packagesFolder and add the following lines to your
import custom_editor_font import editor import console # point this to your font file font_path = "file://" + os.path.expanduser("~/Documents/Fonts/SFMono/SFMono-Regular.otf") custom_editor_font.load_custom_font(font_path) font_name = "SFMono-Regular" font_size = 15 custom_editor_font.set_editor_font(font_name, font_size) console.set_font(font_name, font_size) editor._get_editor_tab().reloadFile()
Now, just change the font name and size based on your preferences.
NOTE: This is not a perfect solution and may crash or stop working at any time
TutorialDoctor last edited by TutorialDoctor
Seems like it would be nice to put this into UI form using the
dialogsmodule. Perhaps an updated where fonts can be loaded from a server too. Cool.