diff --git a/docs/en_US/images/preferences_sql_editor.png b/docs/en_US/images/preferences_sql_editor.png index 19416bd29..133e66c5c 100644 Binary files a/docs/en_US/images/preferences_sql_editor.png and b/docs/en_US/images/preferences_sql_editor.png differ diff --git a/docs/en_US/preferences.rst b/docs/en_US/preferences.rst index 0907461e0..52fe8214b 100644 --- a/docs/en_US/preferences.rst +++ b/docs/en_US/preferences.rst @@ -417,6 +417,10 @@ Use the fields on the *Editor* panel to change settings of the query editor. * When the *Code folding?* switch is set to *False*, the editor will disable code folding. Disabling will improve editor performance with large files. +* Use the *Font family* field to specify the font family that will be used in + all SQL text boxes and editors. If the font is not found, the default font + of *Source Code Pro* will be used. + * Use the *Font size* field to specify the font size that will be used in text boxes and editors. diff --git a/web/pgadmin/static/js/components/ReactCodeMirror/components/Editor.jsx b/web/pgadmin/static/js/components/ReactCodeMirror/components/Editor.jsx index ea497eea9..53547b04e 100644 --- a/web/pgadmin/static/js/components/ReactCodeMirror/components/Editor.jsx +++ b/web/pgadmin/static/js/components/ReactCodeMirror/components/Editor.jsx @@ -301,8 +301,9 @@ export default function Editor({ const fontSize = calcFontSize(pref.sql_font_size); newConfigExtn.push(EditorView.theme({ - '.cm-content': { + '& .cm-content': { fontSize: fontSize, + fontFamily: pref.sql_font_family, }, '.cm-gutters': { fontSize: fontSize, diff --git a/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py b/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py index 356a411ef..b71046fc0 100644 --- a/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py +++ b/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py @@ -390,6 +390,18 @@ def register_query_tool_preferences(self): ) ) + self.sql_font_family = self.preference.register( + 'Editor', 'sql_font_family', + gettext("Font family"), 'text', 'Source Code Pro', + category_label=PREF_LABEL_DISPLAY, + help_str=gettext( + 'Specify the font family to be used for all SQL editors. ' + 'The specified font should already be installed on your system. ' + 'If the font is not found, the editor will fall back to the ' + 'default font, Source Code Pro.' + ) + ) + self.display_connection_status = self.preference.register( 'display', 'connection_status', gettext("Connection status"), 'boolean', True,