Sublime Forum

Sublime text resetting font size bug

#1

In my user config. file I have the following settings:

“font_face”: “Inconsolata”,
“font_size”: 12,

If I increase the font using ‘ctrl’ + ‘+’, and then go to preferences -> font -> reset. The font is not reset to “font_size”, but to a much smaller size. and the setting ‘“font_size”: 12’ is removed from the user config. file (weird).

Does any body know of a custom keybinding/command, which I could use to reset the font size to “font_size”?

Note: I searched the forum and could not find this issue, apologies If it’s already been reported.

0 Likes

#2

If I remember well, reset font **remove **the font_size entry of your config file.
So it means that it’s the default size that is used after, which is 10.

There’s no command to set a specific font size, so you have to do yourself with something like:

import sublime, sublime_plugin class ResetFontSizeCustomCommand(sublime_plugin.ApplicationCommand): def run(self, size): settings = sublime.load_settings('Preferences.sublime-settings') settings.set('font_size', size) sublime.save_settings('Preferences.sublime-settings')
And call it with something like:

run_command('reset_font_size_custom', {'size' : 12})

In addition, you can create you own settings (‘custom_font_size’) and use it instead of the parameter.

0 Likes

#3

Thanks bizoo, really appreciate the help. I ended up using the custom command as you suggested and it works a treat! :smiley:

0 Likes