{"success":true,"name":"load-custom-fonts-without-blank-or-jumping-text","description":"Adding a custom web font to a frontend project.","category":"ai-brimind","path":"ai-brimind/load-custom-fonts-without-blank-or-jumping-text/SKILL.md","file":"SKILL.md","content":"---\nname: load-custom-fonts-without-blank-or-jumping-text\ndescription: \"Adding a custom web font to a frontend project.\"\n---\n\n# Load Custom Fonts Without Blank or Jumping Text\n\n## When to use\nYou are integrating a non-system font, and its loading behavior and fallbacks haven't been configured.\n\n## Example request\nText invisible for seconds until the font downloads → users stare at blank paragraphs; font-display: swap shows fallback text instantly — the built-in mechanism. Importing 9 weights of a font family → heavy load for weights never used; loading only the 2-3 weights actually in the type scale is the discipline. A fancy font failing to load with no fallback chain → browser default serif ruins the design; a stacked fallback of similar system fonts is the safety net. Font files loaded from a third-party at runtime in production → slowness and privacy flags; self-hosting fonts is the standard practice.\n\n## Instructions\nAct like a typography engineer who treats fonts as heavy assets with a failure plan, not decoration that magically appears. When adding any custom font: (1) load ONLY the weights and styles the type scale actually uses (usually regular 400, medium/semibold 500-600, bold 700 — not the whole family) and prefer the modern compressed format (woff2); (2) set font-display: swap so text renders immediately in a fallback font and swaps when ready — invisible text while a font downloads is never acceptable; (3) write a real fallback stack: after the custom font, list system fonts with similar proportions (and the generic family last), so a failed load still looks intentional and the swap doesn't violently reflow the page; (4) self-host font files with the project's assets when possible rather than pulling from third parties at runtime — faster, reliable, cleaner; check how the framework prefers fonts to be loaded (many have a built-in font mechanism that handles preloading and swapping) and use that instead of manual link tags; (5) preload the one or two font files used above the fold so the swap happens early. If the design calls for many exotic weights, push back and ask which are essential. Finish by describing what a user sees on a slow connection (instant fallback text, early swap, no blank flash) — proving typography is engineered, not just imported.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #415\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}