Skip to content

Commit

Permalink
Added support for specifying a custom font family.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmecham committed Feb 27, 2018
1 parent abfb0e7 commit 656fd18
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 7 additions & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down
11 changes: 5 additions & 6 deletions lib/terminal-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 656fd18

Please sign in to comment.