Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Make system fonts work more reliably #8602

Merged
merged 17 commits into from
May 23, 2022
13 changes: 12 additions & 1 deletion src/settings/watchers/FontWatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ export class FontWatcher implements IWatcher {
};

private setSystemFont = ({ useSystemFont, font }) => {
document.body.style.fontFamily = useSystemFont ? font : "";
if (useSystemFont) {
// Make sure that fonts with spaces in their names get interpreted properly
document.body.style.fontFamily = font
.split(',')
.map(font => {
font = font.trim();
if (!font.startsWith('"')) font = '"' + font;
if (!font.endsWith('"')) font = font + '"';
t3chguy marked this conversation as resolved.
Show resolved Hide resolved
return font;
})
.join(',');
}
wooster0 marked this conversation as resolved.
Show resolved Hide resolved
};
}