From 08e9c41c4da94cd220a5a2ecd43c3a580c41155b Mon Sep 17 00:00:00 2001 From: Julien Calixte Date: Thu, 22 Jan 2026 22:52:29 +0100 Subject: [PATCH] deps: use coollabs instead of google fonts --- src/modules/user/hooks/useUserSettings.hook.ts | 4 ++-- src/utils/{downloadGoogleFont.ts => downloadFont.ts} | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename src/utils/{downloadGoogleFont.ts => downloadFont.ts} (81%) diff --git a/src/modules/user/hooks/useUserSettings.hook.ts b/src/modules/user/hooks/useUserSettings.hook.ts index a3a7f50..d94c30e 100644 --- a/src/modules/user/hooks/useUserSettings.hook.ts +++ b/src/modules/user/hooks/useUserSettings.hook.ts @@ -1,7 +1,7 @@ import { watchEffect } from "vue" 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_SIZE = "16px" @@ -19,7 +19,7 @@ export const useUserSettings = () => { const fontFamily = store.userSettings?.chosenFontFamily const fontSize = store.userSettings?.chosenFontSize - downloadGoogleFont(fontFamily || DEFAULT_FONT_POLICY) + downloadFont(fontFamily || DEFAULT_FONT_POLICY) root.style.setProperty("--font-size", fontSize || DEFAULT_FONT_SIZE) }) } diff --git a/src/utils/downloadGoogleFont.ts b/src/utils/downloadFont.ts similarity index 81% rename from src/utils/downloadGoogleFont.ts rename to src/utils/downloadFont.ts index 13048cb..c6f4425 100644 --- a/src/utils/downloadGoogleFont.ts +++ b/src/utils/downloadFont.ts @@ -1,12 +1,12 @@ import FontFaceObserver from "fontfaceobserver" 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(" ", "+")}` } -export const downloadGoogleFont = async (font: string): Promise => { +export const downloadFont = async (font: string): Promise => { const href = assembleFontLink(font) // check if the href already exists