diff --git a/terminus-terminal/src/components/appearanceSettingsTab.component.ts b/terminus-terminal/src/components/appearanceSettingsTab.component.ts index 49108d4c..664c40c2 100644 --- a/terminus-terminal/src/components/appearanceSettingsTab.component.ts +++ b/terminus-terminal/src/components/appearanceSettingsTab.component.ts @@ -32,7 +32,11 @@ export class AppearanceSettingsTabComponent { async ngOnInit () { if (this.hostApp.platform === Platform.Windows || this.hostApp.platform === Platform.macOS) { const fonts = await new Promise((resolve) => fontManager.findFonts({ monospace: true }, resolve)) - this.fonts = fonts.map(x => `${x.family} ${x.style}`.trim()) + if (this.hostApp.platform === Platform.Windows) { + this.fonts = fonts.map(x => `${x.family} ${x.style}`.trim()) + } else { + this.fonts = fonts.map(x => x.family.trim()) + } this.fonts.sort() } if (this.hostApp.platform === Platform.Linux) { @@ -101,6 +105,6 @@ export class AppearanceSettingsTabComponent { } getPreviewFontFamily () { - return getCSSFontFamily(this.config.store.terminal.font) + return getCSSFontFamily(this.config.store) } } diff --git a/terminus-terminal/src/config.ts b/terminus-terminal/src/config.ts index 280bab20..6cba8733 100644 --- a/terminus-terminal/src/config.ts +++ b/terminus-terminal/src/config.ts @@ -15,6 +15,7 @@ export class TerminalConfigProvider extends ConfigProvider { frontend: 'xterm', autoOpen: false, fontSize: 14, + fallbackFont: null, linePadding: 0, bell: 'off', bracketedPaste: false, diff --git a/terminus-terminal/src/frontends/htermFrontend.ts b/terminus-terminal/src/frontends/htermFrontend.ts index 2111a28d..a5503683 100644 --- a/terminus-terminal/src/frontends/htermFrontend.ts +++ b/terminus-terminal/src/frontends/htermFrontend.ts @@ -60,7 +60,7 @@ export class HTermFrontend extends Frontend { this.configuredLinePadding = config.terminal.linePadding this.setFontSize() - preferenceManager.set('font-family', getCSSFontFamily(config.terminal.font)) + preferenceManager.set('font-family', getCSSFontFamily(config)) preferenceManager.set('enable-bold', true) // preferenceManager.set('audible-bell-sound', '') preferenceManager.set('desktop-notification-bell', config.terminal.bell === 'notification') diff --git a/terminus-terminal/src/frontends/xtermFrontend.ts b/terminus-terminal/src/frontends/xtermFrontend.ts index 1a9a6f84..c8425ac3 100644 --- a/terminus-terminal/src/frontends/xtermFrontend.ts +++ b/terminus-terminal/src/frontends/xtermFrontend.ts @@ -197,7 +197,7 @@ export class XTermFrontend extends Frontend { } }) - this.xterm.setOption('fontFamily', getCSSFontFamily(config.terminal.font)) + this.xterm.setOption('fontFamily', getCSSFontFamily(config)) this.xterm.setOption('bellStyle', config.terminal.bell) this.xterm.setOption('cursorStyle', { beam: 'bar', diff --git a/terminus-terminal/src/utils.ts b/terminus-terminal/src/utils.ts index 8a5d0476..be385f06 100644 --- a/terminus-terminal/src/utils.ts +++ b/terminus-terminal/src/utils.ts @@ -8,8 +8,11 @@ export function isWindowsBuild (build: number): boolean { return process.platform === 'win32' && parseFloat(os.release()) >= 10 && parseInt(os.release().split('.')[2]) >= build } -export function getCSSFontFamily (fontList: string): string { - let fonts = fontList.split(',').map(x => x.trim().replace(/"/g, '')) +export function getCSSFontFamily (config: any): string { + let fonts = config.terminal.font.split(',').map(x => x.trim().replace(/"/g, '')) + if (config.terminal.fallbackFont) { + fonts.push(config.terminal.fallbackFont) + } fonts.push('monospace-fallback') fonts.push('monospace') fonts = fonts.map(x => `"${x}"`)