MCPcopy Index your code
hub / github.com/monkeytypegame/monkeytype / applyFontFamily

Function applyFontFamily

frontend/src/ts/ui.ts:31–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29}
30
31export async function applyFontFamily(): Promise<void> {
32 let font = Config.fontFamily.replace(/_/g, " ");
33
34 const localFont = await fileStorage.getFile("LocalFontFamilyFile");
35 if (localFont === undefined) {
36 //use config font
37 qs(".customFont")?.empty();
38 } else {
39 font = "LOCALCUSTOM";
40
41 qs(".customFont")?.setHtml(`
42 @font-face{
43 font-family: LOCALCUSTOM;
44 src: url(${localFont});
45 font-weight: 400;
46 font-style: normal;
47 font-display: block;
48 }`);
49 }
50
51 document.documentElement.style.setProperty(
52 "--font",
53 `"${font}", "Roboto Mono", "Vazirharf", monospace`,
54 );
55}
56
57export function clearFontPreview(): void {
58 if (!isPreviewingFont) return;

Callers 3

FontFamilyFunction · 0.90
font-family.tsFile · 0.90
ui.tsFile · 0.85

Calls 4

qsFunction · 0.90
getFileMethod · 0.80
emptyMethod · 0.80
setHtmlMethod · 0.45

Tested by

no test coverage detected