()
| 29 | } |
| 30 | |
| 31 | export 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 | |
| 57 | export function clearFontPreview(): void { |
| 58 | if (!isPreviewingFont) return; |
no test coverage detected