fix generic fonts not being set

This commit is contained in:
Henry Jameson 2026-07-30 13:38:53 +03:00
commit e0ff4270b4

View file

@ -17,6 +17,16 @@ import {
} from 'src/services/theme_data/theme_data.service.js' } from 'src/services/theme_data/theme_data.service.js'
import { convertTheme2To3 } from 'src/services/theme_data/theme2_to_theme3.js' import { convertTheme2To3 } from 'src/services/theme_data/theme2_to_theme3.js'
const GENERIC_FONT_NAMES = new Set([
'serif',
'sans-serif',
'system-ui',
'cursive',
'fantasy',
'math',
'monospace',
])
export const useInterfaceStore = defineStore('interface', { export const useInterfaceStore = defineStore('interface', {
state: () => ({ state: () => ({
localFonts: null, localFonts: null,
@ -706,11 +716,12 @@ export const useInterfaceStore = defineStore('interface', {
Object.entries(fontMap).forEach(([font, component]) => { Object.entries(fontMap).forEach(([font, component]) => {
const family = mergedConfig[`font${font}`] const family = mergedConfig[`font${font}`]
const variable = font === 'Monospace' ? '--monoFont' : '--font' const variable = font === 'Monospace' ? '--monoFont' : '--font'
if (family) { if (typeof family === 'string') {
const familyString = GENERIC_FONT_NAMES.has(family) ? family : `"${family}"`
hacks.push({ hacks.push({
component, component,
directives: { directives: {
[variable]: `generic | "${family}"`, [variable]: `generic | ${familyString}`,
}, },
}) })
} }