deps: use coollabs instead of google fonts

This commit is contained in:
Julien Calixte
2026-01-22 22:52:29 +01:00
parent 3210b78c28
commit 08e9c41c4d
2 changed files with 4 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
import { watchEffect } from "vue" import { watchEffect } from "vue"
import { useUserRepoStore } from "@/modules/repo/store/userRepo.store" import { useUserRepoStore } from "@/modules/repo/store/userRepo.store"
import { downloadGoogleFont } from "@/utils/downloadGoogleFont" import { downloadFont } from "@/utils/downloadFont"
const DEFAULT_FONT_POLICY = "Courier Prime,monospace" const DEFAULT_FONT_POLICY = "Courier Prime,monospace"
const DEFAULT_FONT_SIZE = "16px" const DEFAULT_FONT_SIZE = "16px"
@@ -19,7 +19,7 @@ export const useUserSettings = () => {
const fontFamily = store.userSettings?.chosenFontFamily const fontFamily = store.userSettings?.chosenFontFamily
const fontSize = store.userSettings?.chosenFontSize const fontSize = store.userSettings?.chosenFontSize
downloadGoogleFont(fontFamily || DEFAULT_FONT_POLICY) downloadFont(fontFamily || DEFAULT_FONT_POLICY)
root.style.setProperty("--font-size", fontSize || DEFAULT_FONT_SIZE) root.style.setProperty("--font-size", fontSize || DEFAULT_FONT_SIZE)
}) })
} }

View File

@@ -1,12 +1,12 @@
import FontFaceObserver from "fontfaceobserver" import FontFaceObserver from "fontfaceobserver"
const assembleFontLink = (font: string) => { const assembleFontLink = (font: string) => {
return `https://fonts.googleapis.com/css2?display=swap&family=${font return `https://api.fonts.coollabs.io/css2?display=swap&family=${font
.replaceAll(",", "&family=") .replaceAll(",", "&family=")
.replaceAll(" ", "+")}` .replaceAll(" ", "+")}`
} }
export const downloadGoogleFont = async (font: string): Promise<void> => { export const downloadFont = async (font: string): Promise<void> => {
const href = assembleFontLink(font) const href = assembleFontLink(font)
// check if the href already exists // check if the href already exists