add firacode font

This commit is contained in:
sawka 2024-03-13 16:13:46 -07:00
parent 5be08516a5
commit 427540dd61
4 changed files with 22 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

@ -87,6 +87,7 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove
const availableFontFamilies: DropdownItem[] = []; const availableFontFamilies: DropdownItem[] = [];
availableFontFamilies.push({ label: "JetBrains Mono", value: "JetBrains Mono" }); availableFontFamilies.push({ label: "JetBrains Mono", value: "JetBrains Mono" });
availableFontFamilies.push({ label: "Hack", value: "Hack" }); availableFontFamilies.push({ label: "Hack", value: "Hack" });
availableFontFamilies.push({ label: "Fira Code", value: "Fira Code" });
return availableFontFamilies; return availableFontFamilies;
} }

View File

@ -5,6 +5,7 @@ let isJetBrainsMonoLoaded = false;
let isLatoFontLoaded = false; let isLatoFontLoaded = false;
let isHackFontLoaded = false; let isHackFontLoaded = false;
let isBaseFontsLoaded = false; let isBaseFontsLoaded = false;
let isFiraCodeLoaded = false;
function addToFontFaceSet(fontFaceSet: FontFaceSet, fontFace: FontFace) { function addToFontFaceSet(fontFaceSet: FontFaceSet, fontFace: FontFace) {
// any cast to work around typing issue // any cast to work around typing issue
@ -55,6 +56,25 @@ function loadLatoFont() {
latoFontBold.load(); latoFontBold.load();
} }
function loadFiraCodeFont() {
if (isFiraCodeLoaded) {
return;
}
isFiraCodeLoaded = true;
let firaCodeRegular = new FontFace("Fira Code", "url('public/fonts/firacode-regular.woff2')", {
style: "normal",
weight: "400",
});
let firaCodeBold = new FontFace("Fira Code", "url('public/fonts/firacode-bold.woff2')", {
style: "normal",
weight: "700",
});
addToFontFaceSet(document.fonts, firaCodeRegular);
addToFontFaceSet(document.fonts, firaCodeBold);
firaCodeRegular.load();
firaCodeBold.load();
}
function loadHackFont() { function loadHackFont() {
if (isHackFontLoaded) { if (isHackFontLoaded) {
return; return;
@ -104,6 +124,7 @@ function loadFonts() {
loadLatoFont(); loadLatoFont();
loadJetBrainsMonoFont(); loadJetBrainsMonoFont();
loadHackFont(); loadHackFont();
loadFiraCodeFont();
} }
export { loadFonts }; export { loadFonts };