fix generic fonts not being set
This commit is contained in:
parent
4c288d7095
commit
e0ff4270b4
1 changed files with 13 additions and 2 deletions
|
|
@ -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}`,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue