mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
add firacode font
This commit is contained in:
parent
5be08516a5
commit
427540dd61
BIN
public/fonts/firacode-bold.woff2
Normal file
BIN
public/fonts/firacode-bold.woff2
Normal file
Binary file not shown.
BIN
public/fonts/firacode-regular.woff2
Normal file
BIN
public/fonts/firacode-regular.woff2
Normal file
Binary file not shown.
@ -87,6 +87,7 @@ class ClientSettingsView extends React.Component<{ model: RemotesModel }, { hove
|
||||
const availableFontFamilies: DropdownItem[] = [];
|
||||
availableFontFamilies.push({ label: "JetBrains Mono", value: "JetBrains Mono" });
|
||||
availableFontFamilies.push({ label: "Hack", value: "Hack" });
|
||||
availableFontFamilies.push({ label: "Fira Code", value: "Fira Code" });
|
||||
return availableFontFamilies;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ let isJetBrainsMonoLoaded = false;
|
||||
let isLatoFontLoaded = false;
|
||||
let isHackFontLoaded = false;
|
||||
let isBaseFontsLoaded = false;
|
||||
let isFiraCodeLoaded = false;
|
||||
|
||||
function addToFontFaceSet(fontFaceSet: FontFaceSet, fontFace: FontFace) {
|
||||
// any cast to work around typing issue
|
||||
@ -55,6 +56,25 @@ function loadLatoFont() {
|
||||
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() {
|
||||
if (isHackFontLoaded) {
|
||||
return;
|
||||
@ -104,6 +124,7 @@ function loadFonts() {
|
||||
loadLatoFont();
|
||||
loadJetBrainsMonoFont();
|
||||
loadHackFont();
|
||||
loadFiraCodeFont();
|
||||
}
|
||||
|
||||
export { loadFonts };
|
||||
|
Loading…
Reference in New Issue
Block a user