Skip to content

Commit 13b44ff

Browse files
Add an ability to configure the font family for SQL editors. #392
1 parent fc1a161 commit 13b44ff

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed
-96.5 KB
Loading

docs/en_US/preferences.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,10 @@ Use the fields on the *Editor* panel to change settings of the query editor.
417417
* When the *Code folding?* switch is set to *False*, the editor will disable
418418
code folding. Disabling will improve editor performance with large files.
419419

420+
* Use the *Font family* field to specify the font family that will be used in
421+
all SQL text boxes and editors. If the font is not found, the default font
422+
of *Source Code Pro* will be used.
423+
420424
* Use the *Font size* field to specify the font size that will be used in text
421425
boxes and editors.
422426

web/pgadmin/static/js/components/ReactCodeMirror/components/Editor.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,9 @@ export default function Editor({
301301

302302
const fontSize = calcFontSize(pref.sql_font_size);
303303
newConfigExtn.push(EditorView.theme({
304-
'.cm-content': {
304+
'& .cm-content': {
305305
fontSize: fontSize,
306+
fontFamily: pref.sql_font_family,
306307
},
307308
'.cm-gutters': {
308309
fontSize: fontSize,

web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,18 @@ def register_query_tool_preferences(self):
390390
)
391391
)
392392

393+
self.sql_font_family = self.preference.register(
394+
'Editor', 'sql_font_family',
395+
gettext("Font family"), 'text', 'Source Code Pro',
396+
category_label=PREF_LABEL_DISPLAY,
397+
help_str=gettext(
398+
'Specify the font family to be used for all SQL editors. '
399+
'The specified font should already be installed on your system. '
400+
'If the font is not found, the editor will fall back to the '
401+
'default font, Source Code Pro.'
402+
)
403+
)
404+
393405
self.display_connection_status = self.preference.register(
394406
'display', 'connection_status',
395407
gettext("Connection status"), 'boolean', True,

0 commit comments

Comments
 (0)