mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-16 09:29:59 +00:00
proper font fallback support (fixes #1041)
This commit is contained in:
parent
cf83bd3798
commit
956d3dc6b1
@ -96,7 +96,7 @@ h3.mb-3 Appearance
|
|||||||
div
|
div
|
||||||
.form-group
|
.form-group
|
||||||
.appearance-preview(
|
.appearance-preview(
|
||||||
[style.font-family]='config.store.terminal.font',
|
[style.font-family]='getPreviewFontFamily()',
|
||||||
[style.font-size]='config.store.terminal.fontSize + "px"',
|
[style.font-size]='config.store.terminal.fontSize + "px"',
|
||||||
[style.background-color]='(config.store.terminal.background == "theme") ? null : config.store.terminal.colorScheme.background',
|
[style.background-color]='(config.store.terminal.background == "theme") ? null : config.store.terminal.colorScheme.background',
|
||||||
[style.color]='config.store.terminal.colorScheme.foreground',
|
[style.color]='config.store.terminal.colorScheme.foreground',
|
||||||
|
@ -8,6 +8,7 @@ import { Component, Inject } from '@angular/core'
|
|||||||
import { ConfigService, HostAppService, Platform, ElectronService } from 'terminus-core'
|
import { ConfigService, HostAppService, Platform, ElectronService } from 'terminus-core'
|
||||||
import { TerminalColorSchemeProvider } from '../api/colorSchemeProvider'
|
import { TerminalColorSchemeProvider } from '../api/colorSchemeProvider'
|
||||||
import { ITerminalColorScheme } from '../api/interfaces'
|
import { ITerminalColorScheme } from '../api/interfaces'
|
||||||
|
import { getCSSFontFamily } from '../utils'
|
||||||
|
|
||||||
/** @hidden */
|
/** @hidden */
|
||||||
@Component({
|
@Component({
|
||||||
@ -98,4 +99,8 @@ export class AppearanceSettingsTabComponent {
|
|||||||
colorsTrackBy (index) {
|
colorsTrackBy (index) {
|
||||||
return index
|
return index
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPreviewFontFamily () {
|
||||||
|
return getCSSFontFamily(this.config.store.terminal.font)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Frontend, ISearchOptions } from './frontend'
|
import { Frontend, ISearchOptions } from './frontend'
|
||||||
import { hterm, preferenceManager } from './hterm'
|
import { hterm, preferenceManager } from './hterm'
|
||||||
|
import { getCSSFontFamily } from '../utils'
|
||||||
|
|
||||||
/** @hidden */
|
/** @hidden */
|
||||||
export class HTermFrontend extends Frontend {
|
export class HTermFrontend extends Frontend {
|
||||||
@ -59,7 +60,7 @@ export class HTermFrontend extends Frontend {
|
|||||||
this.configuredLinePadding = config.terminal.linePadding
|
this.configuredLinePadding = config.terminal.linePadding
|
||||||
this.setFontSize()
|
this.setFontSize()
|
||||||
|
|
||||||
preferenceManager.set('font-family', `"${config.terminal.font}", "monospace-fallback", monospace`)
|
preferenceManager.set('font-family', getCSSFontFamily(config.terminal.font))
|
||||||
preferenceManager.set('enable-bold', true)
|
preferenceManager.set('enable-bold', true)
|
||||||
// preferenceManager.set('audible-bell-sound', '')
|
// preferenceManager.set('audible-bell-sound', '')
|
||||||
preferenceManager.set('desktop-notification-bell', config.terminal.bell === 'notification')
|
preferenceManager.set('desktop-notification-bell', config.terminal.bell === 'notification')
|
||||||
|
@ -172,6 +172,11 @@
|
|||||||
|
|
||||||
/*----*/
|
/*----*/
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "monospace-fallback";
|
||||||
|
src: url(../fonts/Meslo.otf) format("opentype");
|
||||||
|
}
|
||||||
|
|
||||||
.xterm-viewport::-webkit-scrollbar {
|
.xterm-viewport::-webkit-scrollbar {
|
||||||
background: rgba(0, 0, 0, .125);
|
background: rgba(0, 0, 0, .125);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Frontend } from './frontend'
|
import { Frontend } from './frontend'
|
||||||
import { Terminal, ITheme } from 'xterm'
|
import { Terminal, ITheme } from 'xterm'
|
||||||
|
import { getCSSFontFamily } from '../utils'
|
||||||
import { FitAddon } from './xtermAddonFit'
|
import { FitAddon } from './xtermAddonFit'
|
||||||
import { enableLigatures } from 'xterm-addon-ligatures'
|
import { enableLigatures } from 'xterm-addon-ligatures'
|
||||||
import { SearchAddon, ISearchOptions } from './xtermSearchAddon'
|
import { SearchAddon, ISearchOptions } from './xtermSearchAddon'
|
||||||
@ -179,7 +180,7 @@ export class XTermFrontend extends Frontend {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.xterm.setOption('fontFamily', `"${config.terminal.font}", "monospace-fallback", monospace`)
|
this.xterm.setOption('fontFamily', getCSSFontFamily(config.terminal.font))
|
||||||
this.xterm.setOption('bellStyle', config.terminal.bell)
|
this.xterm.setOption('bellStyle', config.terminal.bell)
|
||||||
this.xterm.setOption('cursorStyle', {
|
this.xterm.setOption('cursorStyle', {
|
||||||
beam: 'bar'
|
beam: 'bar'
|
||||||
|
@ -7,3 +7,11 @@ export const WIN_BUILD_WSL_EXE_DISTRO_FLAG = 17763
|
|||||||
export function isWindowsBuild (build: number): boolean {
|
export function isWindowsBuild (build: number): boolean {
|
||||||
return process.platform === 'win32' && parseFloat(os.release()) >= 10 && parseInt(os.release().split('.')[2]) >= build
|
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, ''))
|
||||||
|
fonts.push('monospace-fallback')
|
||||||
|
fonts.push('monospace')
|
||||||
|
fonts = fonts.map(x => `"${x}"`)
|
||||||
|
return fonts.join(', ')
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user