mirror of
https://github.com/Eugeny/tabby.git
synced 2024-12-25 11:33:35 +03:00
fallback font setting (#324)
This commit is contained in:
parent
2ee336bef8
commit
3ddbb62658
@ -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<any[]>((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)
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ export class TerminalConfigProvider extends ConfigProvider {
|
||||
frontend: 'xterm',
|
||||
autoOpen: false,
|
||||
fontSize: 14,
|
||||
fallbackFont: null,
|
||||
linePadding: 0,
|
||||
bell: 'off',
|
||||
bracketedPaste: false,
|
||||
|
@ -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')
|
||||
|
@ -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',
|
||||
|
@ -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}"`)
|
||||
|
Loading…
Reference in New Issue
Block a user