From c8d249d6ceb426e9fdfe51a4a40dd5ae3bf92a1a Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Tue, 10 Feb 2026 13:04:26 +0300 Subject: [PATCH 1/4] feat(app.css): add fallbacks for the fonts to prevent FOUT --- src/app/styles/app.css | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/styles/app.css b/src/app/styles/app.css index 96ec340..61d38c6 100644 --- a/src/app/styles/app.css +++ b/src/app/styles/app.css @@ -117,7 +117,7 @@ } body { @apply bg-background text-foreground; - font-family: 'Karla', system-ui, sans-serif; + font-family: "Karla", system-ui, -apple-system, "Segoe UI", Inter, Roboto, Arial, sans-serif; font-optical-sizing: auto; } } @@ -162,3 +162,7 @@ .animate-nudge { animation: nudge 10s ease-in-out infinite; } + +.barlow { + font-family: "Barlow", system-ui, Inter, Roboto, "Segoe UI", Arial, sans-serif; +} From bb8d2d685c9c7bc69d9a8cfcb015f018e572e483 Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Tue, 10 Feb 2026 13:08:07 +0300 Subject: [PATCH 2/4] feat(Layout): add font loading flag and change head links to prevent FOUT --- src/app/ui/Layout.svelte | 53 ++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/src/app/ui/Layout.svelte b/src/app/ui/Layout.svelte index d4a5835..a934407 100644 --- a/src/app/ui/Layout.svelte +++ b/src/app/ui/Layout.svelte @@ -15,32 +15,69 @@ import GD from '$shared/assets/GD.svg'; import { ResponsiveProvider } from '$shared/lib'; import { ScrollArea } from '$shared/shadcn/ui/scroll-area'; import { Provider as TooltipProvider } from '$shared/shadcn/ui/tooltip'; -import type { Snippet } from 'svelte'; +import { + type Snippet, + onMount, +} from 'svelte'; interface Props { children: Snippet; } -/** Slot content for route pages to render */ let { children }: Props = $props(); +let fontsReady = $state(false); + +/** + * Sets fontsReady flag to true when font for the page logo is loaded. + */ +onMount(async () => { + if (!('fonts' in document)) { + fontsReady = true; + return; + } + + const required = ['100']; + + const missing = required.filter( + w => !document.fonts.check(`${w} 1em Barlow`), + ); + + if (missing.length > 0) { + await Promise.all( + missing.map(w => document.fonts.load(`${w} 1em Barlow`)), + ); + } + fontsReady = true; +}); + +$inspect(fontsReady); + ((e.currentTarget as HTMLLinkElement).media = 'all'))} > - + Compare Typography & Typefaces | GlyphDiff @@ -55,7 +92,9 @@ let { children }: Props = $props();
- {@render children?.()} + {#if fontsReady} + {@render children?.()} + {/if}
From e90b2bede56ba1f6e09c337d04b9f563da78ee20 Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Tue, 10 Feb 2026 13:09:09 +0300 Subject: [PATCH 3/4] feat(Page): add appearance animation that is slightly delayed to ensure font loading and lack of FOIT --- src/routes/Page.svelte | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/routes/Page.svelte b/src/routes/Page.svelte index e9177e7..bd5f546 100644 --- a/src/routes/Page.svelte +++ b/src/routes/Page.svelte @@ -4,7 +4,6 @@ --> -
+
{#snippet icon({ className })} From aefe03d811c490f0dc61933df9cecb400515ed53 Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Tue, 10 Feb 2026 13:09:42 +0300 Subject: [PATCH 4/4] feat: use class for barlow font with fallbacks --- .../Breadcrumb/ui/BreadcrumbHeader/BreadcrumbHeader.svelte | 2 +- src/shared/ui/Logo/Logo.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/entities/Breadcrumb/ui/BreadcrumbHeader/BreadcrumbHeader.svelte b/src/entities/Breadcrumb/ui/BreadcrumbHeader/BreadcrumbHeader.svelte index 80cd3f7..1398d23 100644 --- a/src/entities/Breadcrumb/ui/BreadcrumbHeader/BreadcrumbHeader.svelte +++ b/src/entities/Breadcrumb/ui/BreadcrumbHeader/BreadcrumbHeader.svelte @@ -23,7 +23,7 @@ import { scrollBreadcrumbsStore } from '../../model'; " >
-

+

GLYPHDIFF

diff --git a/src/shared/ui/Logo/Logo.svelte b/src/shared/ui/Logo/Logo.svelte index 9883dd5..98505a8 100644 --- a/src/shared/ui/Logo/Logo.svelte +++ b/src/shared/ui/Logo/Logo.svelte @@ -11,7 +11,7 @@ interface Props { const { class: className }: Props = $props(); -const baseClasses = 'font-[Barlow] font-thin text-5xl sm:text-6xl md:text-7xl lg:text-8xl'; +const baseClasses = 'barlow font-thin text-5xl sm:text-6xl md:text-7xl lg:text-8xl'; const title = 'GLYPHDIFF';