From 656fd18c3fce0c4594e0137e127bbe17fa1dcd83 Mon Sep 17 00:00:00 2001 From: Justin Mecham Date: Tue, 27 Feb 2018 17:00:28 -0500 Subject: [PATCH] Added support for specifying a custom font family. --- CHANGELOG.md | 1 + lib/config.js | 7 +++++++ lib/terminal-view.js | 11 +++++------ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0956d5e..b23ec31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Unreleased +* Added support for specifying a custom font family. * Cleaned up the settings configuration with better descriptions and layout. ## 0.5.3 diff --git a/lib/config.js b/lib/config.js index 0baaaef..fe6717a 100644 --- a/lib/config.js +++ b/lib/config.js @@ -15,6 +15,13 @@ export default { ] }, + fontFamily: { + title: 'Font Family', + description: 'The name of the font family used for terminal text. By default, this matches the editor font family.', + type: 'string', + default: '' + }, + matchTheme: { title: 'Match Theme', description: 'When enabled, the look of the terminal will match the currently configured Atom theme.', diff --git a/lib/terminal-view.js b/lib/terminal-view.js index 9caa3bc..7d81a05 100644 --- a/lib/terminal-view.js +++ b/lib/terminal-view.js @@ -131,6 +131,7 @@ export default class TerminalView { // observeAndApplyTypeSettings() { if (this.isObservingTypeSettings) return; + this.disposables.add(atom.config.onDidChange('terminal-tab.fontFamily', this.applyTypeSettings.bind(this))); this.disposables.add(atom.config.onDidChange('editor.fontFamily', this.applyTypeSettings.bind(this))); this.disposables.add(atom.config.onDidChange('editor.fontSize', this.applyTypeSettings.bind(this))); this.disposables.add(atom.config.onDidChange('editor.lineHeight', this.applyTypeSettings.bind(this))); @@ -167,12 +168,10 @@ export default class TerminalView { // // Set the font family in Xterm to match Atom. // - let fontFamily = atom.config.get('editor.fontFamily'); - if (fontFamily) { - this.session.xterm.setOption('fontFamily', fontFamily); - } else { - this.session.xterm.setOption('fontFamily', 'Menlo, Consolas, "DejaVu Sans Mono", monospace'); - } + const fontFamily = atom.config.get('terminal-tab.fontFamily') + || atom.config.get('editor.fontFamily') + || 'Menlo, Consolas, "DejaVu Sans Mono", monospace'; // Atom default (as of 1.25.0) + this.session.xterm.setOption('fontFamily', fontFamily); // // Set the font size in Xterm to match Atom.