Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
471 changes: 471 additions & 0 deletions apps/landing/scripts/fonts/subset-fonts.py

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions apps/landing/src/components/FontPreloads.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
// The core subsets from scripts/fonts/subset-fonts.py. Every page draws both
// families (Geist Mono is the body face), so both are preloaded; the extended
// files stay behind their unicode-range.
import geistCore from "../fonts/geist-core.woff2?url&no-inline";
import geistMonoCore from "../fonts/geist-mono-core.woff2?url&no-inline";
---

<link rel="preload" href={geistMonoCore} as="font" type="font/woff2" crossorigin />
<link rel="preload" href={geistCore} as="font" type="font/woff2" crossorigin />
Binary file added apps/landing/src/fonts/geist-core.woff2
Binary file not shown.
Binary file added apps/landing/src/fonts/geist-ext.woff2
Binary file not shown.
Binary file added apps/landing/src/fonts/geist-mono-box.woff2
Binary file not shown.
Binary file added apps/landing/src/fonts/geist-mono-core.woff2
Binary file not shown.
Binary file added apps/landing/src/fonts/geist-mono-ext.woff2
Binary file not shown.
2 changes: 2 additions & 0 deletions apps/landing/src/layouts/DocsLayout.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
import "../styles/global.css";
import FontPreloads from "../components/FontPreloads.astro";
import DocsSidebar from "../components/docs/DocsSidebar.astro";
import TableOfContents from "../components/TableOfContents.astro";
import DocsPrevNext from "../components/docs/DocsPrevNext.astro";
Expand Down Expand Up @@ -46,6 +47,7 @@ const metaDescription = description.replaceAll("`", "");
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<FontPreloads />
<meta name="description" content={metaDescription} />
<meta name="theme-color" content="#171410" />
<meta name="robots" content={noindex ? "noindex" : "index,follow"} />
Expand Down
2 changes: 2 additions & 0 deletions apps/landing/src/layouts/Layout.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
import { getRelativeLocaleUrl } from "astro:i18n";
import "../styles/global.css";
import FontPreloads from "../components/FontPreloads.astro";
import MediaLightbox from "../components/MediaLightbox.astro";

interface Props {
Expand Down Expand Up @@ -67,6 +68,7 @@ const absoluteImage = image.startsWith("http")
<link rel="apple-touch-icon" sizes="192x192" href="/logo192.png" />
<link rel="manifest" href="/manifest.json" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<FontPreloads />
<meta name="description" content={description} />
<meta name="theme-color" content={themeColor} />
<meta name="robots" content="index,follow" />
Expand Down
57 changes: 57 additions & 0 deletions apps/landing/src/styles/fonts.generated.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* Generated by scripts/fonts/subset-fonts.py. Do not edit; rerun the script.
Core files hold ASCII and common punctuation and are preloaded (FontPreloads.astro);
the others only download on pages that use one of their characters. `no-inline`
keeps Vite from inlining a small file into the CSS every page loads. */

@font-face {
font-family: "Geist Variable";
font-style: normal;
font-display: swap;
font-weight: 400 900;
src: url("../fonts/geist-core.woff2?no-inline") format("woff2-variations");
unicode-range:
U+0009-000A, U+0020-007E, U+00A9, U+00B7, U+200B, U+2011, U+2013-2014, U+2018-2019, U+201C-201D,
U+2026;
}

@font-face {
font-family: "Geist Variable";
font-style: normal;
font-display: swap;
font-weight: 400 900;
src: url("../fonts/geist-ext.woff2?no-inline") format("woff2-variations");
unicode-range:
U+00A0-00A8, U+00AA-00AC, U+00AE-00B6, U+00B8-0113, U+0116-012B, U+012E-0137, U+0139-013E,
U+0141-0148, U+014A-014D, U+0150-017E, U+0300, U+2022, U+203A, U+2191, U+2193, U+2212;
}

@font-face {
font-family: "Geist Mono Variable";
font-style: normal;
font-display: swap;
font-weight: 400 900;
src: url("../fonts/geist-mono-core.woff2?no-inline") format("woff2-variations");
unicode-range:
U+0009-000A, U+0020-007E, U+00A9, U+00B7, U+200B, U+2011, U+2013-2014, U+2018-2019, U+201C-201D,
U+2026;
}

@font-face {
font-family: "Geist Mono Variable";
font-style: normal;
font-display: swap;
font-weight: 400 900;
src: url("../fonts/geist-mono-ext.woff2?no-inline") format("woff2-variations");
unicode-range:
U+00A0-00A8, U+00AA-00AC, U+00AE-00B6, U+00B8-0113, U+0116-012B, U+012E-0131, U+0134-0137,
U+0139-013E, U+0141-0148, U+014A-014D, U+0150-017E, U+0300, U+2022, U+203A, U+2191, U+2193, U+2212;
}

@font-face {
font-family: "Geist Mono Variable";
font-style: normal;
font-display: swap;
font-weight: 400 900;
src: url("../fonts/geist-mono-box.woff2?no-inline") format("woff2-variations");
unicode-range: U+2500, U+2502, U+2514, U+251C;
}
3 changes: 1 addition & 2 deletions apps/landing/src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
here (enforced by `bun run check:tokens`). Must come after tailwindcss.
Landing is dark-only: Layout.astro pins class="dark" on <html>. */
@import "@maple/ui/styles/tokens.css";
@import "@fontsource-variable/geist-mono";
@import "@fontsource-variable/geist";
@import "./fonts.generated.css";

@source "../../../../packages/ui/src";

Expand Down
4 changes: 3 additions & 1 deletion knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
"apps/landing": {
// scripts/figures/*.mjs generate blog figures and covers, run by hand with node.
// iso/ is a vendored drawing kit; only part of its API is used.
// The fontsource packages are read by path in src/lib/docs-og.ts for OG images;
// the site itself serves the subsets from scripts/fonts/subset-fonts.py.
"entry": ["src/worker.ts", "tools/**/*.ts", "tools/**/*.js", "scripts/figures/*.mjs"],
"ignore": ["src/components/blog/foldkit/iso/**"],
"ignoreDependencies": ["@paper-design/shaders"]
"ignoreDependencies": ["@paper-design/shaders", "@fontsource-variable/geist", "@fontsource-variable/geist-mono"]
},
"apps/api": {
// src/worker.ts was auto-detected from wrangler.jsonc's `main` until the
Expand Down
Loading