From f6dfecb43fd9dba5cc67f6d208bf8cc89deeeaf9 Mon Sep 17 00:00:00 2001 From: "jac-made[bot]" <350467601+jac-made[bot]@users.noreply.github.com> Date: Fri, 20 Nov 2026 00:29:12 +0100 Subject: [PATCH 1/7] site: one design system for the four sites The approved design (19 Nov) gives machine-made, openfluids, BoringQuantSystems and type one system. The type site now uses it. - site/assets/system.css is copied unchanged from machine-made/machine-made.github.io at f895aedbcab1a117cd9ba644ed428bca2843f7cf. Its first lines name that commit. build.py writes it into each page. - The home page and the 404 page (site/home.py) equal the approved page: - the type line; - Latest: the newest release of each family; - the tester: one line per family, with a slider per axis; the full fonts load the first time the reader types; - the families; - the release table, built from the release files, the licence and the workflows; - the houses row: the newest release of each house, from the GitHub API; - the footer. - Each family page and the download page now has the same two bars and footer and the same dark colours. site.css keeps only the specimen parts, on the tokens of the system. The Warp page keeps its ink-blue palette between the bars. - The facts come through gh, with GH_TOKEN in both workflows. A failed call stops the build, so a page with stale facts is never deployed. - The build checks what it writes: - contrast pairs; - one h1 and heading order on every page; - homebrew-tap is never listed; - banned words on the pages this module writes; - Latest has no repeat; - font subsets keep every axis and the features the style uses. - site/shots.py is the browser check, run by hand: no sideways scroll at 320 to 1920 px, 44 px links on a phone, no system-font glyph on the home and 404 pages, axe-core on every page. - The wordmark and favicon drawn from the Weft outlines are replaced by the 3 x 3 mark of the system. Pillow joins the requirements for the images. Co-authored-by: Ricardo Frantz <4220623+ricardofrantz@users.noreply.github.com> --- .github/workflows/release.yml | 3 + .github/workflows/site.yml | 7 +- README.md | 7 +- site/assets/site.css | 207 +++------ site/assets/system.css | 224 ++++++++++ site/build.py | 221 ++-------- site/home.py | 574 +++++++++++++++++++++++++ site/img/banner-boringquantsystems.jpg | Bin 0 -> 114091 bytes site/img/banner-machine-made.jpg | Bin 0 -> 107709 bytes site/img/banner-openfluids.jpg | Bin 0 -> 245578 bytes site/img/og.jpg | Bin 0 -> 64854 bytes site/pages/404.html | 11 - site/pages/download/index.html | 2 +- site/pages/index.html | 93 ---- site/requirements.txt | 3 +- site/shots.py | 178 ++++++++ site/templates/layout.html | 50 +-- 17 files changed, 1109 insertions(+), 471 deletions(-) create mode 100644 site/assets/system.css create mode 100644 site/home.py create mode 100644 site/img/banner-boringquantsystems.jpg create mode 100644 site/img/banner-machine-made.jpg create mode 100644 site/img/banner-openfluids.jpg create mode 100644 site/img/og.jpg delete mode 100644 site/pages/404.html delete mode 100644 site/pages/index.html create mode 100644 site/shots.py diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1b6334a..33f528e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -606,6 +606,9 @@ jobs: python -m pip install -r site/requirements.txt - name: Build site + # The home page reads the newest releases through gh; a failed call fails the build. + env: + GH_TOKEN: ${{ github.token }} run: python site/build.py - name: Make the release files diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml index 79b021b..aefe6ce 100644 --- a/.github/workflows/site.yml +++ b/.github/workflows/site.yml @@ -41,6 +41,9 @@ jobs: # it stops with an error when a file is missing, so the deploy fails # and the live site stays as it is. - name: Build site + # The home page reads the newest releases through gh; a failed call fails the build. + env: + GH_TOKEN: ${{ github.token }} run: python site/build.py - name: Check the built site @@ -50,8 +53,8 @@ jobs: fonts/warp/MachineMadeWarp-Regular.woff2 fonts/warp/MachineMadeWarp-Italic.woff2 \ fonts/warp/MachineMadeWarp-Bold.woff2 fonts/warp/MachineMadeWarp-BoldItalic.woff2 \ fonts/warp/MachineMadeWarpDisplay-Regular.woff2 fonts/warp/MachineMadeWarpDisplay-Italic.woff2 \ - data/readability.json data/heddle.json data/warp.json index.html weft/index.html heddle/index.html \ - warp/index.html; do + data/readability.json data/heddle.json data/warp.json index.html 404.html weft/index.html heddle/index.html \ + warp/index.html fonts/home/weft.woff2 fonts/home/heddle.woff2 og.jpg; do test -s "site/_site/$f" || { echo "::error::site/_site/$f is missing."; exit 1; } done python -c 'import json,sys; r=json.load(open("site/_site/data/readability.json")); sys.exit(0 if r.get("rows") else 1)' diff --git a/README.md b/README.md index 6ce0558..bd260ce 100644 --- a/README.md +++ b/README.md @@ -140,9 +140,14 @@ Site (from the repository root): ```sh python -m pip install -r site/requirements.txt -python site/build.py # site/_site/ +python site/build.py # site/_site/; reads the newest releases through gh (set GH_TOKEN) +uv run --with playwright==1.65.1 python3 site/shots.py --axe axe.min.js # browser check, by hand ``` +The home page and the 404 page follow the design system of the four +machine-made sites. `site/assets/system.css` is copied unchanged from +machine-made/machine-made.github.io; its first line names the commit. + ## Repository layout | Path | Content | diff --git a/site/assets/site.css b/site/assets/site.css index 2c1f542..aac8ff8 100644 --- a/site/assets/site.css +++ b/site/assets/site.css @@ -1,38 +1,24 @@ -/* machine-made/type site. Layout: a foundry proof sheet. One ruled column of - sections; black, white and one red dot. The UI text is set in mm Sans; the - samples are set in the family they show. */ +/* machine-made/type site: the specimen components of the family and download pages. The bars, the footer, + the colours, the grid and the home page come from system.css (the design system of the four sites); this file + maps its own names onto those tokens. The samples are set in the family they show. */ :root { - --paper: #F4F5F3; - --panel: #EAECE9; - --ink: #121314; - --muted: #555A5E; - --rule: #D3D6D2; - --red: #D42A1F; - --sans: "mm Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; - --mono: "mm Weft", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; - --heddle: "mm Heddle", "Helvetica Neue", Arial, sans-serif; - --warp: "mm Warp", Georgia, "Times New Roman", serif; - --warp-display: "mm Warp Display", "mm Warp", Georgia, serif; - --step-0: 0.8125rem; - --step-1: 1rem; - --step-2: 1.25rem; - --step-3: clamp(1.5rem, 1.2rem + 1.4vw, 2rem); - --step-4: clamp(2.25rem, 1.4rem + 4vw, 4.25rem); - --gutter: max(16px, env(safe-area-inset-left, 0px)); + --paper: var(--ground); + --panel: var(--surface); + --ink: var(--text); + --rule: var(--line); + --red: var(--accent); + --sans: var(--f-sans); + --mono: var(--f-weft); + --heddle: var(--f-heddle); + --warp: var(--f-warp); + --warp-display: "mm Warp Display", var(--f-warp); + --ss-0: 0.8125rem; + --ss-1: 1rem; + --ss-2: 1.25rem; + --ss-3: clamp(1.5rem, 1.2rem + 1.4vw, 2rem); + --ss-4: clamp(2.25rem, 1.4rem + 4vw, 4.25rem); --sans-features: normal; - color-scheme: light; -} -@media (prefers-color-scheme: dark) { - :root { - --paper: #0E0F10; - --panel: #17191B; - --ink: #ECEDEA; - --muted: #A2A8AC; - --rule: #2E3134; - --red: #FF5446; - color-scheme: dark; - } } *, *::before, *::after { box-sizing: border-box; } @@ -43,16 +29,16 @@ body { color: var(--ink); font-family: var(--sans); font-feature-settings: var(--sans-features); - font-size: var(--step-1); + font-size: var(--ss-1); line-height: 1.55; -webkit-font-smoothing: antialiased; overflow-x: hidden; } img, svg { display: block; max-width: 100%; } h1, h2, h3 { margin: 0; line-height: 1.12; font-weight: 650; letter-spacing: -0.015em; text-wrap: balance; } -h1 { font-size: var(--step-4); } -h2 { font-size: var(--step-3); } -h3 { font-size: var(--step-2); font-weight: 600; } +h1 { font-size: var(--ss-4); } +h2 { font-size: var(--ss-3); } +h3 { font-size: var(--ss-2); font-weight: 600; } p { margin: 0; max-width: 68ch; } a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; } a:hover { text-decoration-color: var(--red); } @@ -60,49 +46,20 @@ code, pre, kbd { font-family: var(--mono); font-size: 0.92em; } :focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 1px; } main:focus { outline: none; } -.wrap { - max-width: 1160px; - margin: 0 auto; - padding-left: var(--gutter); - padding-right: max(16px, env(safe-area-inset-right, 0px)); -} .visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; } -.skip { - position: absolute; left: 16px; top: -100px; z-index: 10; - background: var(--ink); color: var(--paper); padding: 8px 14px; font-weight: 600; -} -.skip:focus { top: 12px; } .muted { color: var(--muted); } .weft { font-family: var(--mono); font-feature-settings: normal; } .sans { font-family: var(--sans); } .heddle { font-family: var(--heddle); font-feature-settings: normal; } .warp { font-family: var(--warp); font-feature-settings: normal; } -/* Header */ -/* The row of sites, the same on every machine-made house: machine-made, openfluids, fonts, BoringQuantSystems. */ -.houses-in { display: flex; flex-wrap: wrap; gap: 4px 24px; margin-block: 0; padding-block: 10px; list-style: none; } -.houses a { font-family: var(--mono); font-size: 0.8125rem; letter-spacing: -0.03em; color: var(--muted); text-decoration: none; } -.houses a:hover, .houses a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-underline-offset: 0.3em; } -.site-head { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); } -.site-head-in { - display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; - gap: 10px 24px; padding-block: 14px; -} -.brand { display: inline-flex; align-items: flex-end; gap: 10px; text-decoration: none; color: var(--ink); } -.brand .wordmark { height: 22px; width: auto; } -.brand-sub { font-size: var(--step-0); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); line-height: 1; padding-bottom: 1px; } -.nav { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0; padding: 0; list-style: none; } -.nav a { display: inline-block; padding: 6px 0; font-size: 0.9375rem; font-weight: 550; text-decoration: none; border-bottom: 2px solid transparent; } -.nav a:hover { border-bottom-color: var(--rule); } -.nav a[aria-current="page"] { border-bottom-color: var(--red); } - /* Eyebrow and dot */ .eyebrow { display: block; - font-size: var(--step-0); font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; + font-size: var(--ss-0); font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); max-width: none; } .dot { width: 9px; height: 9px; background: var(--red); border-radius: 50%; flex: none; display: inline-block; vertical-align: 0.05em; } @@ -112,9 +69,9 @@ main:focus { outline: none; } .band { display: grid; gap: 22px; padding-block: 48px; border-bottom: 1px solid var(--rule); } .sec-head { display: grid; gap: 10px; } .intro { color: var(--muted); } -.cap { font-size: var(--step-0); font-weight: 600; letter-spacing: 0.04em; color: var(--muted); } -.note { font-size: var(--step-0); color: var(--muted); } -.lede { font-size: var(--step-2); line-height: 1.45; max-width: 56ch; } +.cap { font-size: var(--ss-0); font-weight: 600; letter-spacing: 0.04em; color: var(--muted); } +.note { font-size: var(--ss-0); color: var(--muted); } +.lede { font-size: var(--ss-2); line-height: 1.45; max-width: 56ch; } .page-hero { display: grid; gap: 18px; padding-block: 48px 40px; border-bottom: 1px solid var(--rule); } /* Buttons */ @@ -126,40 +83,14 @@ main:focus { outline: none; } .btn:hover { background: transparent; color: var(--ink); } .btn-ghost { background: transparent; color: var(--ink); } .btn-ghost:hover { background: var(--ink); color: var(--paper); } -.btn-small { padding: 5px 12px; font-size: var(--step-0); } +.btn-small { padding: 5px 12px; font-size: var(--ss-0); } @media (forced-colors: active) { .btn { border: 1px solid ButtonText; } } -/* Home */ -.hero { display: grid; gap: 22px; padding-block: 56px 44px; border-bottom: 1px solid var(--rule); } -.hero-mark .wordmark { width: 100%; height: auto; color: var(--ink); } -.hero-line { font-family: var(--mono); font-size: clamp(1.25rem, 0.9rem + 1.8vw, 2.25rem); line-height: 1.2; max-width: none; } -.families { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--rule); padding-inline: 0; } -.fam { display: grid; gap: 16px; align-content: start; padding: 40px var(--gutter); min-width: 0; } -.fam + .fam { border-left: 1px solid var(--rule); } -.fam-head { display: grid; gap: 8px; } -.fam h2 a { text-decoration: none; } -.fam h2 a:hover { text-decoration: underline; text-decoration-color: var(--red); } -.fam-sample { font-size: clamp(3.5rem, 2rem + 6vw, 7rem); line-height: 1; overflow-wrap: anywhere; } -.fam-sample.sans { font-weight: 500; letter-spacing: -0.02em; } -.fam-text { font-size: var(--step-2); } -.fam-links { margin-top: 4px; } -.fam-heddle { grid-column: 1 / -1; border-top: 1px solid var(--rule); } -.fam + .fam.fam-heddle { border-left: 0; } -.fam-sample.heddle { font-variation-settings: "wght" 800, "wdth" 100; letter-spacing: 0; } -@media (max-width: 760px) { - .families { grid-template-columns: minmax(0, 1fr); } - .fam + .fam { border-left: 0; border-top: 1px solid var(--rule); } -} -.pair { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 32px; } -@media (max-width: 760px) { .pair { grid-template-columns: minmax(0, 1fr); } } -.pair-col { display: grid; gap: 10px; align-content: start; min-width: 0; } -.pair-sans { font-size: 1.125rem; line-height: 1.6; } -.pair-code { margin: 0; font-size: 15px; line-height: 1.6; background: var(--panel); padding: 16px; border-radius: 2px; overflow-x: auto; } -.pair-code code { font-size: inherit; } -.facts { margin: 0; padding: 0; list-style: none; display: grid; border-top: 1px solid var(--rule); } -.facts li { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 16px; padding-block: 12px; border-bottom: 1px solid var(--rule); } +/* Download facts */ +.dl-facts { margin: 0; padding: 0; list-style: none; display: grid; border-top: 1px solid var(--rule); } +.dl-facts li { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 16px; padding-block: 12px; border-bottom: 1px solid var(--rule); } .fact-k { font-weight: 600; } -@media (max-width: 520px) { .facts li { grid-template-columns: minmax(0, 1fr); gap: 2px; } } +@media (max-width: 520px) { .dl-facts li { grid-template-columns: minmax(0, 1fr); gap: 2px; } } /* Weft playground */ .play { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 28px; align-items: start; } @@ -168,8 +99,8 @@ main:focus { outline: none; } .field { display: grid; gap: 6px; } .field[hidden], .axis-missing[hidden] { display: none; } .field-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; } -.label { font-size: var(--step-0); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; } -output { font-variant-numeric: tabular-nums; font-size: var(--step-0); color: var(--muted); } +.label { font-size: var(--ss-0); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; } +output { font-variant-numeric: tabular-nums; font-size: var(--ss-0); color: var(--muted); } textarea { width: 100%; resize: vertical; min-height: 92px; font: 0.9375rem/1.45 var(--mono); color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 2px; padding: 10px; @@ -188,7 +119,7 @@ input[type=range] { width: 100%; accent-color: var(--red); margin: 4px 0; min-he .chip[data-k="safe"] { color: var(--ink); background: var(--paper); } .chip[data-k="head"] { color: var(--muted); } .chip[data-k="title"] { color: var(--red); } -.axis-missing { font-size: var(--step-0); color: var(--muted); border-left: 3px solid var(--rule); padding-left: 10px; } +.axis-missing { font-size: var(--ss-0); color: var(--muted); border-left: 3px solid var(--rule); padding-left: 10px; } .stage { min-width: 0; border: 1px solid var(--rule); border-radius: 2px; padding: 20px; min-height: 220px; overflow: hidden; } .stage-text { font-size: 72px; line-height: 1.15; white-space: pre-wrap; overflow-wrap: anywhere; max-width: none; margin: 0; } @@ -196,9 +127,9 @@ input[type=range] { width: 100%; accent-color: var(--red); margin: 4px 0; min-he .stages { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: 2px; } .stages li { display: grid; gap: 2px; padding: 14px; min-width: 0; } .stages li + li { border-left: 1px solid var(--rule); } -.stage-range { font-family: var(--mono); font-size: var(--step-2); } +.stage-range { font-family: var(--mono); font-size: var(--ss-2); } .stage-name { font-weight: 600; } -.stage-use { font-size: var(--step-0); color: var(--muted); } +.stage-use { font-size: var(--ss-0); color: var(--muted); } .stages li:nth-child(-n+2) .stage-use::after { content: " · safe"; color: var(--ink); font-weight: 600; } @media (max-width: 700px) { .stages { grid-template-columns: repeat(2, minmax(0, 1fr)); } @@ -209,15 +140,15 @@ input[type=range] { width: 100%; accent-color: var(--red); margin: 4px 0; min-he .axis-rows[hidden] { display: none; } .axis-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; align-items: center; padding-block: 8px; border-top: 1px solid var(--rule); } .axis-row:first-child { border-top: 0; } -.axis-row .v { font-family: var(--mono); font-size: var(--step-2); } -.axis-row .s { display: block; font-size: var(--step-0); color: var(--muted); } +.axis-row .v { font-family: var(--mono); font-size: var(--ss-2); } +.axis-row .s { display: block; font-size: var(--ss-0); color: var(--muted); } .axis-row .t { font-family: var(--mono); font-size: clamp(2rem, 1rem + 5vw, 4.5rem); line-height: 1.1; white-space: nowrap; overflow: hidden; } @media (max-width: 560px) { .axis-row { grid-template-columns: minmax(0, 1fr); gap: 2px; } } /* Size specimen */ .sizes { margin: 0; padding: 0; list-style: none; display: grid; } .sizes li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 16px; align-items: baseline; padding-block: 10px; border-top: 1px solid var(--rule); } -.size-k { font-family: var(--sans); font-size: var(--step-0); color: var(--muted); font-variant-numeric: tabular-nums; } +.size-k { font-family: var(--sans); font-size: var(--ss-0); color: var(--muted); font-variant-numeric: tabular-nums; } .size-v { line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: clip; min-width: 0; } @media (max-width: 560px) { .sizes li { grid-template-columns: minmax(0, 1fr); gap: 2px; } @@ -234,12 +165,12 @@ input[type=range] { width: 100%; accent-color: var(--red); margin: 4px 0; min-he background-size: 100% 1px; background-repeat: no-repeat; background-position: 0 80%; } @media (max-width: 840px) { .glyph-big { font-size: 112px; padding-inline: 12px; } } -.glyph-meta { margin: 0; display: grid; gap: 6px; font-size: var(--step-0); } +.glyph-meta { margin: 0; display: grid; gap: 6px; font-size: var(--ss-0); } .glyph-meta div { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 8px; } .glyph-meta dt { color: var(--muted); } .glyph-meta dd { margin: 0; overflow-wrap: anywhere; } .glyph-group + .glyph-group { margin-top: 18px; } -.glyph-group h3 { font-size: var(--step-0); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; } +.glyph-group h3 { font-size: var(--ss-0); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; } .glyph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); border-top: 1px solid var(--rule); border-left: 1px solid var(--rule); } .glyph-grid button { appearance: none; border: 0; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); @@ -258,9 +189,9 @@ input[type=range] { width: 100%; accent-color: var(--red); margin: 4px 0; min-he /* Readability report */ .pending { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: baseline; color: var(--muted); max-width: 80ch; } .cer-table { width: 100%; max-width: 760px; border-collapse: collapse; font-variant-numeric: tabular-nums; } -.cer-table caption { text-align: left; font-size: var(--step-0); color: var(--muted); padding-bottom: 8px; } +.cer-table caption { text-align: left; font-size: var(--ss-0); color: var(--muted); padding-bottom: 8px; } .cer-table th, .cer-table td { text-align: left; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--rule); vertical-align: middle; } -.cer-table th { font-size: var(--step-0); font-weight: 600; letter-spacing: 0.04em; color: var(--muted); } +.cer-table th { font-size: var(--ss-0); font-weight: 600; letter-spacing: 0.04em; color: var(--muted); } .cer-table td.num { font-family: var(--mono); white-space: nowrap; } .cer-bar { height: 10px; background: var(--ink); min-width: 1px; border-radius: 1px; } .cer-table tr.over .cer-bar { background: var(--red); } @@ -274,7 +205,7 @@ input[type=range] { width: 100%; accent-color: var(--red); margin: 4px 0; min-he .cards { grid-template-columns: minmax(0, 1fr); } .card + .card { border-left: 0; border-top: 1px solid var(--rule); } } -.commits { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: var(--step-0); } +.commits { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: var(--ss-0); } .commits li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; } .commits .sha { font-family: var(--mono); } .commits .meta { grid-column: 2; color: var(--muted); } @@ -287,14 +218,14 @@ input[type=range] { width: 100%; accent-color: var(--red); margin: 4px 0; min-he .sans-copy { display: grid; gap: 18px; min-width: 0; } .sans-l { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem); line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; } .sans-m { font-size: 1.125rem; line-height: 1.6; } -.sans-s { font-size: var(--step-1); line-height: 1.6; overflow-wrap: anywhere; color: var(--muted); } +.sans-s { font-size: var(--ss-1); line-height: 1.6; overflow-wrap: anywhere; color: var(--muted); } .sans-italic { font-style: italic; } .waterfalls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; } @media (max-width: 840px) { .waterfalls { grid-template-columns: minmax(0, 1fr); } } .waterfalls > div { display: grid; gap: 8px; align-content: start; min-width: 0; } .waterfall { margin: 0; padding: 0; list-style: none; } .waterfall li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: baseline; padding-block: 6px; border-top: 1px solid var(--rule); } -.wf-label { font-size: var(--step-0); color: var(--muted); font-variant-numeric: tabular-nums; } +.wf-label { font-size: var(--ss-0); color: var(--muted); font-variant-numeric: tabular-nums; } .wf-text { font-size: clamp(1.375rem, 1rem + 1.6vw, 2.125rem); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: clip; } .forms { display: grid; gap: 0; border-top: 1px solid var(--rule); } .form-row { display: grid; gap: 8px; padding-block: 18px; border-bottom: 1px solid var(--rule); } @@ -303,7 +234,7 @@ input[type=range] { width: 100%; accent-color: var(--red); margin: 4px 0; min-he .form-sharp { font-feature-settings: "ss02" 1; } .form-sharp.off { font-feature-settings: normal; } .toggle { display: inline-flex; gap: 6px; align-items: center; margin-right: 12px; color: var(--ink); font-weight: 600; } -.credit { font-size: var(--step-2); } +.credit { font-size: var(--ss-2); } .weft-title { font-family: var(--mono); font-weight: 400; letter-spacing: 0; } .sans-title { font-family: var(--sans); } @@ -313,8 +244,8 @@ input[type=range] { width: 100%; accent-color: var(--red); margin: 4px 0; min-he .page-heddle .glyph-grid button, .page-heddle .glyph-big { font-family: var(--heddle); } .rows { margin: 0; padding: 0; list-style: none; display: grid; } .rows li { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 16px; align-items: baseline; padding-block: 8px; border-top: 1px solid var(--rule); } -.row-k { font-size: var(--step-0); color: var(--muted); } -.row-v { display: block; font-size: var(--step-2); color: var(--ink); font-variant-numeric: tabular-nums; } +.row-k { font-size: var(--ss-0); color: var(--muted); } +.row-v { display: block; font-size: var(--ss-2); color: var(--ink); font-variant-numeric: tabular-nums; } .row-t { font-size: clamp(2.25rem, 1rem + 5.5vw, 5rem); line-height: 1.05; white-space: nowrap; overflow: hidden; min-width: 0; } .rows-tight .row-t { font-size: clamp(1.75rem, 0.9rem + 3.6vw, 3.5rem); } @media (max-width: 560px) { .rows li { grid-template-columns: minmax(0, 1fr); gap: 2px; } .row-v { display: inline; margin-right: 8px; } } @@ -323,7 +254,7 @@ input[type=range] { width: 100%; accent-color: var(--red); margin: 4px 0; min-he .parts li + li { border-left: 1px solid var(--rule); } .part-glyph { font-size: clamp(4rem, 2rem + 6vw, 7.5rem); line-height: 1; font-variation-settings: "wght" 800, "wdth" 100; } .part-name { font-weight: 600; } -.part-text { font-size: var(--step-0); color: var(--muted); } +.part-text { font-size: var(--ss-0); color: var(--muted); } @media (max-width: 700px) { .parts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .parts li:nth-child(3) { border-left: 0; } @@ -333,23 +264,15 @@ input[type=range] { width: 100%; accent-color: var(--red); margin: 4px 0; min-he /* Warp: a journal frontispiece, after the approved sketch page. Ivory paper, hairline rules, small capitals, one deep ink blue. Set in Warp. */ -.page-warp { - --paper: #F7F2E6; - --panel: #EFE8D8; - --ink: #1B1712; - --muted: #6E6556; - --rule: #D8CEBA; - --accent: #1E3466; -} -@media (prefers-color-scheme: dark) { - .page-warp { - --paper: #15120E; - --panel: #1D1914; - --ink: #ECE4D2; - --muted: #A39985; - --rule: #3A332A; - --accent: #AFBEE6; - } +.page-warp main { + --paper: #15120E; + --panel: #1D1914; + --ink: #ECE4D2; + --muted: #A39985; + --rule: #3A332A; + --accent: #AFBEE6; + background: var(--paper); + color: var(--ink); } .page-warp main { font-family: var(--warp); font-size: 1.0625rem; line-height: 1.5; } .page-warp main h2, .page-warp main h3 { font-family: var(--warp-display); font-weight: 400; letter-spacing: 0; } @@ -435,15 +358,11 @@ input[type=range] { width: 100%; accent-color: var(--red); margin: 4px 0; min-he .page-warp .card h3 { font-family: var(--warp-display); } .warp-cta { justify-items: center; text-align: center; } .warp-dl-title { font-family: var(--warp-display); font-weight: 400; letter-spacing: 0; } -.fam-sample.warp { font-family: var(--warp-display); letter-spacing: 0; } -.fam-text.warp { font-family: var(--warp); font-style: italic; } -.fam-warp { grid-column: 1 / -1; border-top: 1px solid var(--rule); } -.fam + .fam.fam-warp { border-left: 0; } /* Specimen rows: a label and a sample, one per line */ .spec { margin: 0; padding: 0; list-style: none; display: grid; border-top: 1px solid var(--rule); } .spec li { display: grid; grid-template-columns: minmax(0, 190px) minmax(0, 1fr); gap: 8px 24px; align-items: baseline; padding-block: 12px; border-bottom: 1px solid var(--rule); } -.spec-k { font-family: var(--sans); font-size: var(--step-0); color: var(--muted); } +.spec-k { font-family: var(--sans); font-size: var(--ss-0); color: var(--muted); } .spec-k code { display: block; font-family: var(--mono); } .spec-v { min-width: 0; overflow-wrap: anywhere; line-height: 1.25; } .spec-pre { margin: 0; background: none; padding: 0; overflow-x: auto; line-height: 1.2; } @@ -463,12 +382,6 @@ math { font-family: var(--warp); } .snippet pre code { font-size: inherit; } .snippet .copy { position: absolute; top: 8px; right: 8px; margin: 0; } -/* Footer */ -.site-foot { padding-block: 32px 40px; font-size: var(--step-0); color: var(--muted); } -.site-foot-in { display: grid; gap: 12px; } -.foot-mark { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); } -.foot-links { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0; padding: 0; list-style: none; } - @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } } diff --git a/site/assets/system.css b/site/assets/system.css new file mode 100644 index 0000000..3e8727d --- /dev/null +++ b/site/assets/system.css @@ -0,0 +1,224 @@ +/* Copied unchanged from machine-made/machine-made.github.io, src/system.css at commit + f895aedbcab1a117cd9ba644ed428bca2843f7cf. Change it there first, then copy it here. */ +/* machine-made web system. One file for machine-made, openfluids, BoringQuantSystems and type. + A page sets only its house tokens (ground, surface, line, text, muted, accent) and its banner. + + TYPE SCALE: ratio 1.25 (major third) on 1rem = 16 px. Every text style is one step. + step -1 0.8rem 12.8 px Weft meta: bar 1, bar 2 sections, section labels, plate facts, footer, table keys + step 0 1rem 16 px Sans reading text: captions, latest entries, table values, notes + step 1 1.25rem 20 px proposal page small headings only + step 2 1.5625rem 25 px bar-2 wordmark (type) + step 2-3 fluid 25 -> 31.25 px between 390 and 1280 px: the house line (--t-line) + step 3-5 fluid 31.25 -> 48.8 px between 390 and 1280 px: tester lines (--t-display) + step 4 2.441rem 39 px family tiles on the type site + SPACING: 4 8 12 16 24 32 48 64 96 px, nothing else. + GRID: 12 columns, 24 px gutter, 1200 px content at most, 16 px side margin on a phone. + ACCENT: four uses only. Bar 1 marker, bar 2 marker, section-label cell, link underline. */ +:root { + --step--1: 0.8rem; + --step-0: 1rem; + --step-1: 1.25rem; + --step-2: 1.5625rem; + --step-3: 1.953rem; + --step-4: 2.441rem; + --step-5: 3.052rem; + --t-line: clamp(1.5625rem, 1.391rem + 0.702vw, 1.953rem); + --t-display: clamp(1.953rem, 1.472rem + 1.975vw, 3.052rem); + --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px; --sp-9: 96px; + --side: var(--sp-4); + --gutter: var(--sp-5); + --max: 1200px; + --bar1: 40px; + --bar2: 64px; + --b1h: 41px; /* bar 1 plus its line: where bar 2 starts to stick */ + --f-weft: "mm Weft", ui-monospace, monospace; + --f-sans: "mm Sans", system-ui, sans-serif; + --f-heddle: "mm Heddle", "mm Sans", system-ui, sans-serif; + --f-warp: "mm Warp", serif; + --ease: cubic-bezier(0.2, 0, 0, 1); +} +@media (min-width: 720px) { :root { --side: var(--sp-5); } } +@media (min-width: 1100px) { :root { --side: var(--sp-6); } } + +*, *::before, *::after { box-sizing: border-box; } +html { color-scheme: dark; background: var(--ground); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; scroll-padding-block-start: calc(var(--bar2) + var(--sp-4)); } +body { margin: 0; min-height: 100dvh; background: var(--ground); color: var(--text); font: 400 var(--step-0)/1.5 var(--f-sans); } +h1, h2, h3, p, ul, ol, figure { margin: 0; } +ul, ol { padding: 0; list-style: none; } +img { display: block; max-width: 100%; height: auto; } +a { color: inherit; text-decoration: none; } +:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; } +.wrap { width: 100%; max-width: calc(var(--max) + 2 * var(--side)); margin-inline: auto; padding-left: max(var(--side), env(safe-area-inset-left)); padding-right: max(var(--side), env(safe-area-inset-right)); } +.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } +.skip { position: absolute; top: calc(-1 * var(--sp-8)); left: var(--sp-4); z-index: 10; padding: var(--sp-2) var(--sp-4); background: var(--text); color: var(--ground); font: 400 var(--step--1)/1 var(--f-weft); } +.skip:focus { top: var(--sp-2); } +.n { font-family: var(--f-weft); font-variant-numeric: tabular-nums; font-feature-settings: "ss01" 1; } + +/* Bar 1: the four sites, same order and face everywhere. Scrolls away. On a phone it scrolls sideways. */ +.b1 { border-bottom: 1px solid var(--line); } +.b1 ul { display: flex; align-items: center; gap: var(--sp-5); height: var(--bar1); font: 400 var(--step--1)/1 var(--f-weft); white-space: nowrap; overflow-x: auto; scrollbar-width: none; } +.b1 ul::-webkit-scrollbar { display: none; } +.b1 li { flex: none; height: 100%; } +.b1 a, .b1 span { display: inline-flex; align-items: center; height: 100%; color: var(--muted); } +@media (hover: hover) { .b1 a:hover { color: var(--text); } } +.b1 [aria-current] { color: var(--text); text-decoration: underline 2px var(--accent); text-underline-offset: 6px; } + +/* Bar 2: logo left, sections right. Sticks to the top; its bottom line shows only after scrolling. */ +.b2 { position: sticky; top: 0; z-index: 5; background: var(--ground); border-bottom: 1px solid transparent; } +@media (prefers-reduced-motion: no-preference) { + @supports (animation-timeline: scroll()) { + .b2 { animation: b2-line linear both; animation-timeline: scroll(root); animation-range: var(--b1h) calc(var(--b1h) + 1px); } + @keyframes b2-line { to { border-bottom-color: var(--line); } } + } +} +.b2 .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); height: var(--bar2); } +.logo { display: inline-flex; align-items: center; gap: var(--sp-3); flex: none; color: var(--text); } +.logo img, .logo svg { width: 28px; height: 28px; border-radius: 4px; } +.logo svg { fill: currentColor; border-radius: 0; } +.logo .r { fill: var(--accent); } +.wm { font: 650 var(--step-2)/1 var(--f-heddle); letter-spacing: -0.01em; font-stretch: 100%; } +.secs { display: flex; align-items: center; gap: var(--sp-5); min-width: 0; font: 400 var(--step--1)/1 var(--f-weft); white-space: nowrap; overflow-x: auto; scrollbar-width: none; } +.secs::-webkit-scrollbar { display: none; } +.secs a { display: inline-flex; align-items: center; height: 44px; position: relative; flex: none; } +@media (hover: hover) { .secs a:hover { color: var(--muted); } } +.secs [aria-current]::after { content: ""; position: absolute; left: 0; right: 0; bottom: var(--sp-2); height: 2px; background: var(--accent); } +@media (max-width: 719px) { + .b1 ul { flex-wrap: wrap; height: auto; column-gap: var(--sp-4); row-gap: 0; padding-block: var(--sp-1); overflow: visible; } + .b1 li { height: 44px; } + :root { --b1h: 97px; } + .logo { min-height: 44px; } + .secs { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - var(--sp-6)), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - var(--sp-6)), transparent); padding-right: var(--sp-6); } + .b2 .wrap { justify-content: flex-start; gap: var(--sp-4); } + .secs { gap: var(--sp-4); } +} + +/* Banner: one rule for the three houses. 3:1 at every width; on a phone the empty 6 % at each side is cut. */ +.banner { margin-top: var(--sp-5); } +.banner img { width: 100%; aspect-ratio: 1408 / 469; object-fit: cover; -webkit-mask-image: linear-gradient(transparent, #000 10%, #000 90%, transparent); mask-image: linear-gradient(transparent, #000 10%, #000 90%, transparent); } +@media (max-width: 719px) { .banner img { aspect-ratio: 1240 / 469; } } + +/* The house line: one size on all four sites. */ +.line { margin-top: var(--sp-6); max-width: 28em; font-weight: 400; font-size: var(--t-line); line-height: 1.25; text-wrap: pretty; hyphens: none; } +@media (min-width: 720px) { .line { text-wrap: balance; } } +.line.weft { font-family: var(--f-weft); } +.line.heddle { font-family: var(--f-heddle); font-weight: 400; letter-spacing: -0.01em; } +.line.warp { font-family: var(--f-warp); letter-spacing: -0.01em; } +.nb { white-space: nowrap; } +.warp { font-variant-numeric: oldstyle-nums proportional-nums; } +.warp .sc { font-variant-caps: all-small-caps; letter-spacing: 0.04em; } +.fit1 { white-space: nowrap; } +@media (max-width: 519px) { .heddle.fit1, .wm { font-stretch: 80%; } } + +/* A row of the page grid: label in columns 1-3, content in columns 4-12. */ +.row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); margin-top: var(--sp-7); padding-top: var(--sp-5); border-top: 1px solid var(--line); } +.row.tight { margin-top: var(--sp-6); } +.row > * { grid-column: 4 / 13; min-width: 0; } +.row > .lbl { grid-column: 1 / 4; } +.lbl { display: flex; align-items: center; align-self: start; gap: var(--sp-2); min-height: 20px; font: 400 var(--step--1)/1.4 var(--f-weft); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); } +.mk { flex: none; width: 11px; height: 11px; } +.mk .o { fill: var(--line); } +.mk .on { fill: var(--accent); } +@media (max-width: 859px) { + .row > *, .row > .lbl { grid-column: 1 / -1; } + .row > .lbl { margin-bottom: var(--sp-4); } +} + +/* Plates: image 3:1, no inner padding, caption 8 px below, facts 4 px below the caption. */ +.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-6) var(--gutter); } +.grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } +@media (max-width: 999px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } } +@media (min-width: 520px) { .grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } } +@media (max-width: 519px) { .grid, .grid.g2 { grid-template-columns: minmax(0, 1fr); gap: var(--sp-5); } } +.plate { display: grid; align-content: start; min-width: 0; } +.pic { display: block; border-radius: 2px; } +.pic img, .tile { width: 100%; aspect-ratio: 3 / 1; object-fit: cover; border-radius: 2px; outline: 1px solid var(--line); outline-offset: -1px; } +.ds { margin-top: var(--sp-2); font: 400 var(--step-0)/1.4 var(--f-sans); color: var(--muted); text-wrap: pretty; } +.facts { margin-top: var(--sp-1); font: 400 var(--step--1)/1.4 var(--f-weft); color: var(--muted); font-variant-numeric: tabular-nums; font-feature-settings: "ss01" 1; font-variation-settings: "FRAG" 0; } +.facts { overflow: hidden; } +.facts > span { display: inline-flex; flex-wrap: wrap; margin-left: calc(-1 * var(--sp-4)); } +.facts > span > span { white-space: nowrap; } +.facts > span > span::before { content: "\00b7"; display: inline-block; width: var(--sp-4); text-align: center; } +a.u, .ds a { color: var(--text); text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; text-decoration-thickness: from-font; } +.ds a { display: inline-block; padding-block: var(--sp-3); margin-block: calc(-1 * var(--sp-3)); } +@media (hover: hover) { + .plate:hover .pic img, .plate:hover .tile { filter: brightness(1.02); } + .plate:hover .facts { font-variation-settings: "FRAG" 40; } +} +.plate:focus-within .facts { font-variation-settings: "FRAG" 40; } +@media (prefers-reduced-motion: no-preference) { + .pic img, .tile { transition: filter 240ms var(--ease); } + .facts { transition: font-variation-settings 240ms var(--ease); } +} +@media (prefers-reduced-motion: reduce) { .plate:focus-within .facts { font-variation-settings: "FRAG" 0; } } +@media (hover: hover) and (prefers-reduced-motion: reduce) { .plate:hover .facts { font-variation-settings: "FRAG" 0; } } + +/* Latest: the three most recent releases. A row of cells on a wide screen, a list on a phone. */ +.latest { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4) var(--gutter); } +.latest.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } +.latest.n1 { grid-template-columns: minmax(0, 1fr); } +.latest.n2 { grid-template-columns: repeat(3, minmax(0, 1fr)); } +.latest.n1 li { grid-template-columns: auto auto; justify-content: start; align-items: baseline; gap: var(--sp-4); } +.latest li { display: grid; gap: var(--sp-1); min-width: 0; } +.latest a { justify-self: start; color: var(--text); text-decoration: underline 1px var(--accent); text-underline-offset: 0.2em; text-decoration-thickness: from-font; } +.latest .facts { margin-top: 0; } +@media (max-width: 859px) { .latest.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } } +@media (max-width: 519px) { + .latest, .latest.n1, .latest.n2, .latest.n4 { grid-template-columns: minmax(0, 1fr); gap: 0; border-top: 1px solid var(--line); } + .latest li, .latest.n1 li { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: var(--sp-4); padding-block: var(--sp-3); border-bottom: 1px solid var(--line); } + .latest a { padding-block: var(--sp-3); margin-block: calc(-1 * var(--sp-3)); } +} + +/* Footer: one line, the four names. */ +footer { margin-top: var(--sp-8); padding-bottom: max(var(--sp-6), env(safe-area-inset-bottom)); } +footer .fl { padding-top: var(--sp-4); border-top: 1px solid var(--line); overflow: hidden; } +footer ul { display: flex; flex-wrap: wrap; align-items: center; margin-left: calc(-1 * var(--sp-6)); font: 400 var(--step--1)/1 var(--f-weft); color: var(--muted); } +footer li { display: inline-flex; align-items: center; } +footer li::before { content: "\00b7"; width: var(--sp-6); text-align: center; } +footer a { display: inline-flex; align-items: center; min-height: 44px; } +@media (hover: hover) { footer a:hover { color: var(--text); } } + +/* Type site: tester, family tiles, release table. Same grid as everything else. */ +.tester { display: grid; gap: 0; } +.trow { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); padding-block: var(--sp-4); border-bottom: 1px solid var(--line); } +.trow:first-child { padding-top: 0; } +.tmeta { grid-column: 1 / 4; display: grid; align-content: start; gap: var(--sp-2); font: 400 var(--step--1)/1.4 var(--f-weft); color: var(--muted); } +.tmeta b { font-weight: 400; color: var(--text); } +.tline { grid-column: 4 / 13; min-width: 0; font-size: var(--t-display); line-height: 1.1; overflow-wrap: break-word; outline-offset: var(--sp-1); caret-color: var(--text); } +.tline.weft { font-family: var(--f-weft); } +.tline.sans { font-family: var(--f-sans); letter-spacing: -0.01em; } +.tline.heddle { font-family: var(--f-heddle); letter-spacing: -0.01em; } +.tline.warp { font-family: var(--f-warp); } +.full .tline.weft { font-family: "mm Weft Full", var(--f-weft); } +.full .tline.sans { font-family: "mm Sans Full", var(--f-sans); } +.full .tline.heddle { font-family: "mm Heddle Full", var(--f-heddle); } +.full .tline.warp { font-family: "mm Warp Full", var(--f-warp); } +.tin { display: none; width: 100%; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line); border-radius: 2px; background: var(--surface); color: var(--text); font: 400 var(--step-0)/1.5 var(--f-sans); } +.tin::placeholder { color: var(--muted); } +.js .tin { display: block; } +.tester { grid-column: 1 / 13; margin-top: var(--sp-5); } +.ctl { display: none; grid-template-columns: minmax(0, 1fr) 3.5em; align-items: center; gap: var(--sp-2); } +.js .ctl { display: grid; } +.ctl span { grid-column: 1 / -1; } +.ctl input { width: 100%; margin: 0; accent-color: var(--text); } +.ctl output { text-align: end; color: var(--text); } +@media (max-width: 859px) { + .tmeta, .tline { grid-column: 1 / -1; } + .tmeta { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); margin-bottom: var(--sp-3); } + .tmeta b { grid-column: 1 / -1; } +} +.tile { display: grid; align-items: center; justify-items: start; padding-inline: var(--sp-5); background: var(--surface); color: var(--text); overflow: hidden; white-space: nowrap; font-size: var(--step-4); line-height: 1; } +.tile.weft { font-family: var(--f-weft); font-feature-settings: "ss01" 1; } +.tile.sans { font-family: var(--f-sans); font-weight: 500; letter-spacing: -0.02em; } +.tile.heddle { font-family: var(--f-heddle); font-weight: 700; } +.tile.warp { font-family: var(--f-warp); } +@media (max-width: 389px) { .tile { font-size: var(--step-3); } .heddle.fit1 { font-stretch: 70%; } } +.table { border-top: 1px solid var(--line); } +.table li { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: var(--sp-4); padding-block: var(--sp-3); border-bottom: 1px solid var(--line); } +.table .k { font: 400 var(--step--1)/1.9 var(--f-weft); color: var(--muted); } +.table p { max-width: 66ch; } +.more { margin-top: var(--sp-5); } +@media (max-width: 519px) { .table li { grid-template-columns: minmax(0, 1fr); gap: 0; } } + +/* Not found: the same header, one line and a way back. */ +.nf { min-height: 50dvh; } +.nf p + p { margin-top: var(--sp-4); } diff --git a/site/build.py b/site/build.py index 0569c1c..44209fb 100644 --- a/site/build.py +++ b/site/build.py @@ -1,8 +1,10 @@ """Build the specimen and release site for machine-made/type. Usage: - python site/build.py # writes site/_site/ - python site/build.py --out DIR # writes DIR/ + python site/build.py # writes site/_site/; reads the GitHub facts through gh + python site/build.py --out DIR # writes DIR/ + python site/build.py --facts FILE # reads the facts from FILE instead of the GitHub API + python site/build.py --save-facts FILE # also writes the facts it read to FILE The script: @@ -16,11 +18,16 @@ 4. Reads proofs/weft/readability.json (written by weft/tools/readability.py). It stops with an error when the file is missing or has no FRAG rows. -5. Draws the "machine-made" wordmark and the favicon as SVG from the - Weft outlines. -6. Fills the page templates and writes the HTML. - -Needs Python 3.11+ and fontTools with brotli (for WOFF2). +5. Reads the live facts from the GitHub API (home.py): the newest + release of each family and of each house, the release files, the + licence and the workflows. It stops with an error when a call fails, + so a page with stale facts is never written. +6. Writes the home page and the 404 page in the design system of the + four sites (assets/system.css, home.py), and fills the family and + download pages into the same two bars and footer. + +Needs Python 3.11+, fontTools with brotli (for WOFF2), Pillow (for the +images) and gh with a token (GH_TOKEN) for the facts. """ from __future__ import annotations @@ -36,17 +43,15 @@ from pathlib import Path from urllib.parse import quote -from fontTools.pens.boundsPen import BoundsPen -from fontTools.pens.recordingPen import DecomposingRecordingPen -from fontTools.pens.svgPathPen import SVGPathPen -from fontTools.pens.transformPen import TransformPen from fontTools.ttLib import TTFont +import home +from home import BuildError + SITE = Path(__file__).resolve().parent ROOT = SITE.parent REPO_URL = "https://github.com/machine-made/type" -ORG_URL = "https://github.com/machine-made" RELEASE_VERSION = "0.2.0" RELEASES = {fam: f"{REPO_URL}/releases/tag/{fam}-v{RELEASE_VERSION}" for fam in ("weft", "sans", "heddle", "warp")} @@ -113,15 +118,6 @@ READABILITY = ROOT / "proofs" / "weft" / "readability.json" -# Weft metrics in font units (BRIEF.md): 1 design unit = 62.5 units. -WEFT_UNIT = 62.5 -WEFT_X_HEIGHT = 500 -WORDMARK_WGHT = 700 - - -class BuildError(Exception): - """A build step cannot continue.""" - # --------------------------------------------------------------------------- # Font selection @@ -234,141 +230,6 @@ def inspect(path: Path) -> dict: } -# --------------------------------------------------------------------------- -# Wordmark and favicon (SVG drawn from the Weft outlines) -# --------------------------------------------------------------------------- - -def weft_for_wordmark(chosen: dict) -> TTFont: - files = chosen["weft"]["files"] - if "bold" in files: - return TTFont(files["bold"]) - font = TTFont(files["vf"]) - axes = axes_of(font) - if axes: - from fontTools.varLib import instancer - pins = {tag: v[1] for tag, v in axes.items()} - if "wght" in axes: - pins["wght"] = max(axes["wght"][0], min(axes["wght"][2], WORDMARK_WGHT)) - if "FRAG" in axes: - pins["FRAG"] = 0 - font = instancer.instantiateVariableFont(font, pins) - return font - - -def contours(recording: list) -> list: - """Split a recorded pen value into one list per contour.""" - out, cur = [], [] - for op, args in recording: - cur.append((op, args)) - if op in ("closePath", "endPath"): - out.append(cur) - cur = [] - if cur: - out.append(cur) - return out - - -def replay(ops: list, pen) -> None: - for op, args in ops: - getattr(pen, op)(*args) - - -def contour_ymin(ops: list) -> float: - ys = [pt[1] for _, args in ops for pt in args] - return min(ys) if ys else 0 - - -def hyphen_ops(stroke_w: float) -> list: - """Draw a hyphen from the loom stroke table when the font has none. - - Stroke table: open line (1.5, 4.6) to (5.5, 4.6), square caps, box - offset 2.5. Phase 1 fonts have no hyphen glyph. - """ - half = stroke_w / 2 - x0 = (2.5 + 1.5) * WEFT_UNIT - half - x1 = (2.5 + 5.5) * WEFT_UNIT + half - y0, y1 = 4.6 * WEFT_UNIT - half, 4.6 * WEFT_UNIT + half - return [("moveTo", ((x0, y0),)), ("lineTo", ((x0, y1),)), ("lineTo", ((x1, y1),)), - ("lineTo", ((x1, y0),)), ("closePath", ())] - - -def stroke_width_units(font: TTFont) -> float: - """Return the stem width of the font, measured from the 'l' stem.""" - gs = font.getGlyphSet() - cmap = font.getBestCmap() - name = cmap.get(ord("i")) - if name is None: - return 84 - rec = DecomposingRecordingPen(gs) - gs[name].draw(rec) - dots = [c for c in contours(rec.value) if contour_ymin(c) > WEFT_X_HEIGHT] - if dots: - bp = BoundsPen(gs) - replay(dots[0], bp) - if bp.bounds: - return bp.bounds[2] - bp.bounds[0] - return 84 - - -def wordmark_svg(font: TTFont, text: str = "machine-made", label: str = "machine-made") -> str: - """Return an inline SVG of text in Weft. The dot of each i is red.""" - gs = font.getGlyphSet() - cmap = font.getBestCmap() - hmtx = font["hmtx"] - ink, dots = SVGPathPen(gs), SVGPathPen(gs) - bounds = BoundsPen(gs) - sw = stroke_width_units(font) - x = 0 - for ch in text: - name = cmap.get(ord(ch)) - if name is None and ch == "-": - ops, adv = hyphen_ops(sw), 750 - groups = [(ops, False)] - elif name is None: - raise BuildError(f"The Weft font has no glyph for {ch!r}; the wordmark needs it.") - else: - rec = DecomposingRecordingPen(gs) - gs[name].draw(rec) - adv = hmtx[name][0] - groups = [(c, ch == "i" and contour_ymin(c) > WEFT_X_HEIGHT) for c in contours(rec.value)] - for ops, is_dot in groups: - # Flip y for SVG: font y goes up, SVG y goes down. - target = dots if is_dot else ink - replay(ops, TransformPen(target, (1, 0, 0, -1, x, 0))) - replay(ops, TransformPen(bounds, (1, 0, 0, -1, x, 0))) - x += adv - x0, y0, x1, y1 = bounds.bounds - pad = 0 - vb = f"{x0 - pad:.0f} {y0 - pad:.0f} {x1 - x0 + 2 * pad:.0f} {y1 - y0 + 2 * pad:.0f}" - return ( - f'" - ) - - -def favicon_svg(font: TTFont) -> str: - """Return a favicon: the Weft i, white on black, with a red dot.""" - gs = font.getGlyphSet() - name = font.getBestCmap()[ord("i")] - rec = DecomposingRecordingPen(gs) - gs[name].draw(rec) - stem, dot = SVGPathPen(gs), SVGPathPen(gs) - # Centre the 750-unit advance in a 1000-unit square; baseline at 820. - tr = (1, 0, 0, -1, 125, 840) - for c in contours(rec.value): - replay(c, TransformPen(dot if contour_ymin(c) > WEFT_X_HEIGHT else stem, tr)) - return ( - '\n" - ) - - # --------------------------------------------------------------------------- # Readability report and commit list # --------------------------------------------------------------------------- @@ -451,8 +312,9 @@ def commits(limit: int = 10) -> list: # Templates # --------------------------------------------------------------------------- -PAGES = ["index.html", "weft/index.html", "sans/index.html", "heddle/index.html", - "warp/index.html", "download/index.html", "404.html"] +# The family and download pages, filled into templates/layout.html. The home page and the 404 page come from +# home.py. +PAGES = ["weft/index.html", "sans/index.html", "heddle/index.html", "warp/index.html", "download/index.html"] TOKEN = re.compile(r"\{\{\s*([A-Z0-9_]+)\s*\}\}") META = re.compile(r"\A\s*", re.S) @@ -596,15 +458,19 @@ def swirl_tag(features: dict) -> str: # Main # --------------------------------------------------------------------------- -def build(out: Path) -> None: +def build(out: Path, facts_file: Path | None = None, save_facts: Path | None = None) -> None: chosen = select_fonts() report = readability() + facts = home.load_facts(facts_file) if facts_file else home.fetch_facts() + if save_facts: + save_facts.write_text(json.dumps(facts, indent=1, sort_keys=True) + "\n", encoding="utf-8") if out.exists(): shutil.rmtree(out) (out / "data").mkdir(parents=True) # Copy the CSS, JS and images. The fonts go to fonts/ (below). - shutil.copytree(SITE / "assets", out / "assets", ignore=shutil.ignore_patterns("fonts")) + # system.css goes into each page through home.system_css(), not as a file. + shutil.copytree(SITE / "assets", out / "assets", ignore=shutil.ignore_patterns("fonts", "system.css")) # Fonts. for fam, sel in chosen.items(): @@ -638,10 +504,8 @@ def build(out: Path) -> None: (out / "data" / "readability.json").write_text(json.dumps(report, indent=1), encoding="utf-8") (out / "assets" / "fonts.css").write_text(font_face_css(chosen, info), encoding="utf-8") - mark_font = weft_for_wordmark(chosen) - wordmark = wordmark_svg(mark_font) - (out / "assets" / "favicon.svg").write_text(favicon_svg(mark_font), encoding="utf-8") (out / ".nojekyll").write_text("", encoding="utf-8") + home.build_images(out) weft_axes = info["weft"]["axes"] sans_axes = info["sans"]["axes"] @@ -650,7 +514,6 @@ def build(out: Path) -> None: planned_w = FAMILIES["weft"]["planned_axes"] values = { "REPO_URL": REPO_URL, - "ORG_URL": ORG_URL, "WEFT_RELEASE": RELEASES["weft"], "SANS_RELEASE": RELEASES["sans"], "HEDDLE_RELEASE": RELEASES["heddle"], @@ -673,7 +536,6 @@ def build(out: Path) -> None: "HEDDLE_WDTH_RANGE": fmt_range(heddle_axes.get("wdth") or planned_sh["wdth"]), "HEDDLE_WIDTH_ROWS": heddle_rows("wdth", heddle_widths, "Grotesk 1958", '"wght" 700'), "HEDDLE_WEIGHT_ROWS": heddle_rows("wght", HEDDLE_WEIGHTS, "Hamburgefonstiv", '"wdth" 100'), - "WORDMARK": wordmark, "WEFT_VERSION": html.escape(short_version(info["weft"])), "SANS_VERSION": html.escape(short_version(info["sans"])), "WEFT_CHAR_COUNT": info["weft"]["char_count"], @@ -689,20 +551,24 @@ def build(out: Path) -> None: "SANS_FORMS_NOTE": "The default forms of machine-made Sans: straight a j p q r y. No feature is on.", } + # The home page and the 404 page: the system pages, with font subsets and the tester. + axes = {fam: {"axes": [(t, int(v[0]), int(v[2])) for t, v in info[fam]["axes"].items()], + "statics": len(home.statics(facts["assets"][fam]))} for fam in chosen} + full = {fam: sel["files"]["vf"].name for fam, sel in chosen.items()} + pages = home.build_fonts(list(home.home_pages(facts, axes, full)), + {fam: sel["files"]["vf"] for fam, sel in chosen.items()}, out) + written = {"index.html": pages[0], "404.html": pages[1]} + layout = (SITE / "templates" / "layout.html").read_text(encoding="utf-8") + system = home.system_css() for rel in PAGES: src = (SITE / "pages" / rel).read_text(encoding="utf-8") meta, body = page_meta(src) - depth = rel.count("/") - root = "../" * depth if depth else "./" - nav = {f"NAV_{k}": ' aria-current="page"' if meta.get("nav") == k.lower() else "" - for k in ("HOME", "WEFT", "SANS", "HEDDLE", "WARP", "DOWNLOAD")} + root = "../" * rel.count("/") scripts = "".join(f'' for s in meta.get("scripts", "").split(",") if s.strip()) - # The 404 page can open at any depth, so it uses absolute paths. - if rel == "404.html": - root = "/type/" - page_values = dict(values, ROOT=root, **nav, + page_values = dict(values, ROOT=root, SYSTEM=system, TOKENS=home.tokens(), GROUND=home.THEME["ground"], + BAR1=home.bar1(), BAR2=home.bar2(root, rel.split("/")[0] + "/"), FOOTER=home.footer(), TITLE=meta.get("title", "machine-made fonts"), DESCRIPTION=meta.get("description", ""), BODY_CLASS=meta.get("class", ""), @@ -713,9 +579,12 @@ def build(out: Path) -> None: for fam in meta.get("preload", "sans").split(",") if fam.strip() in info ) page_values["BODY"] = render(body, page_values, rel) + written[rel] = render(layout, page_values, "layout.html") + home.check_pages(written) + for rel, text in written.items(): dest = out / rel dest.parent.mkdir(parents=True, exist_ok=True) - dest.write_text(render(layout, page_values, "layout.html"), encoding="utf-8") + dest.write_text(text, encoding="utf-8") print(f"Built the site in {out}.") for fam, sel in chosen.items(): @@ -728,9 +597,11 @@ def build(out: Path) -> None: def main(argv: list[str]) -> int: ap = argparse.ArgumentParser(description="Build the machine-made/type site.") ap.add_argument("--out", type=Path, default=SITE / "_site", help="output folder (default: site/_site)") + ap.add_argument("--facts", type=Path, help="read the GitHub facts from this file instead of the API") + ap.add_argument("--save-facts", type=Path, help="also write the GitHub facts to this file") args = ap.parse_args(argv) try: - build(args.out.resolve()) + build(args.out.resolve(), args.facts, args.save_facts) except BuildError as exc: print(f"Error: {exc}", file=sys.stderr) return 1 diff --git a/site/home.py b/site/home.py new file mode 100644 index 0000000..f17d063 --- /dev/null +++ b/site/home.py @@ -0,0 +1,574 @@ +"""The home page, the 404 page and the shared parts of the type site, in the design system of the four sites. + +The style is assets/system.css, copied unchanged from machine-made/machine-made.github.io (its first line names the +commit). Every page carries the same two bars and footer as the three house sites. The home page holds the type +line, Latest (the newest release of each family), the tester, the families, the release table built from the +release files, and the houses row (the newest release of each house). + +The facts come from the GitHub API through gh: fetch_facts() raises BuildError on any failure, so a page with stale +facts is never written. The build checks what it writes: contrast, one h1 and heading order, banned words, +homebrew-tap, Latest with no repeat, and font subsets that keep their axes and the features the style uses. +""" + +from __future__ import annotations + +import base64 +import datetime +import html +import io +import json +import re +import subprocess +from html.parser import HTMLParser +from pathlib import Path +from urllib.parse import quote + +SITE = Path(__file__).resolve().parent +ROOT = SITE.parent +TYPE_URL = "https://machine-made.github.io/type/" +REPO = "machine-made/type" +REPO_URL = f"https://github.com/{REPO}" +LINE = "Four typefaces, made by code." +TITLE = "machine-made type: Weft, Sans, Heddle and Warp" +# Bar 1 and the footer: the three houses, then type. +SITES = ( + ("machine-made", "https://machine-made.github.io/"), + ("openfluids", "https://openfluids.github.io/"), + ("BoringQuantSystems", "https://boringquantsystems.github.io/"), + ("type", TYPE_URL), +) +ORGS = {"machine-made": "machine-made", "openfluids": "openfluids", "BoringQuantSystems": "BoringQuantSystems"} +NEVER = {"homebrew-tap"} +# The type site uses the machine-made palette. +THEME = {"ground": "#0a0a0b", "surface": "#141416", "line": "#26262a", "text": "#ecebe6", "muted": "#8b8b90", "accent": "#e5251c"} +PAIRS = (("text", "ground", 7.0), ("muted", "ground", 4.5), ("text", "surface", 7.0), ("muted", "surface", 4.5), ("accent", "ground", 3.0)) +SECTIONS = (("Weft", "weft/"), ("Sans", "sans/"), ("Heddle", "heddle/"), ("Warp", "warp/"), ("Download", "download/")) +FAMILY_CSS = { + "weft": ('"mm Weft"', "font-weight:100 900"), + "sans": ('"mm Sans"', "font-weight:200 800"), + "heddle": ('"mm Heddle"', "font-weight:100 900;font-stretch:70% 140%"), + "warp": ('"mm Warp"', "font-weight:400"), +} +# family key, name, description, tile specimen +FAMILIES = ( + ("weft", "Weft", "a monospace on a grid, for code and tables", "Rg 0042"), + ("sans", "Sans", "a sans for long reading", "Rg Ka 0042"), + ("heddle", "Heddle", "a Swiss grotesk for posters and headlines", "Grotesk 1958"), + ("warp", "Warp", "a serif drawn by a pen, for papers and maths", "Warp αβγ ∂∫"), +) +# The tester: one slider per axis of each family (label, axis, min, max, start). +CONTROLS = { + "weft": (("Weight", "wght", 100, 900, 400), ("FRAG", "FRAG", 0, 100, 0)), + "sans": (("Weight", "wght", 200, 800, 400),), + "heddle": (("Weight", "wght", 100, 900, 400), ("Width", "wdth", 70, 140, 100)), + "warp": (), +} +KEEP = "0123456789 ·–" +USED_FEATURES = {"ss01", "tnum", "onum", "pnum", "smcp", "c2sc", "kern"} +MONTHS = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split() +BANNED = re.compile(r"\b(founder|brief|jac|card|session|codex)\b", re.I) +PLATE_SIZES = "(min-width: 1264px) 282px, (min-width: 1000px) 22vw, (min-width: 520px) 46vw, calc(100vw - 32px)" +HOUSE_BANNERS = {"machine-made": "machine-made", "openfluids": "openfluids", "BoringQuantSystems": "boringquantsystems"} +BANNER_SIZE = (1408, 469) +BANNER_WIDTHS = (704, 1408) +MARK_SVG = ( + '\n" +) +MK = ( + '" +) +RED_CELL = ' class="r"' +CURRENT = ' aria-current="page"' +LOGO = ( + '" +) + + +class BuildError(Exception): + """A build step cannot continue.""" + + +def esc(text: str) -> str: + return html.escape(text, quote=True) + + +# --------------------------------------------------------------------------- +# The facts +# --------------------------------------------------------------------------- + +def gh(*args: str) -> str: + try: + done = subprocess.run(["gh", *args], capture_output=True, text=True, check=False, timeout=60) + except (OSError, subprocess.SubprocessError) as exc: + raise BuildError(f"gh {' '.join(args[:2])} could not run ({exc.__class__.__name__}); set GH_TOKEN and install gh.") from exc + if done.returncode != 0: + raise BuildError(f"gh {' '.join(args[:2])} failed: {done.stderr.strip()[:200]}") + return done.stdout + + +def fetch_facts() -> dict: + """The live facts of the home page, from the GitHub API. Any failure stops the build.""" + org_parts = [ + f'o{i}: organization(login:"{login}"){{ description repositories(first:100, privacy:PUBLIC, isArchived:false)' + "{nodes{name releases(first:5, orderBy:{field:CREATED_AT, direction:DESC}){nodes{tagName publishedAt url isDraft isPrerelease}}}} }" + for i, login in enumerate(ORGS.values()) + ] + query = ( + "query{ typerepo: repository(owner:\"machine-made\", name:\"type\"){ releases(first:40, orderBy:{field:CREATED_AT, direction:DESC})" + "{nodes{tagName publishedAt url isDraft isPrerelease}} } " + " ".join(org_parts) + " }" + ) + try: + answer = json.loads(gh("api", "graphql", "-f", f"query={query}")) + except ValueError as exc: + raise BuildError("gh api graphql did not return JSON") from exc + if answer.get("errors") or not answer.get("data"): + raise BuildError("graphql errors: " + json.dumps(answer.get("errors"))[:200]) + data = answer["data"] + facts: dict = {"fetched": datetime.datetime.now(datetime.UTC).date().isoformat(), "families": {}, "houses": {}} + for r in data["typerepo"]["releases"]["nodes"]: + fam = r["tagName"].split("-v")[0] + if fam in CONTROLS and fam not in facts["families"] and not r["isDraft"] and not r["isPrerelease"]: + facts["families"][fam] = {k: r[k] for k in ("tagName", "publishedAt", "url")} + if set(facts["families"]) != set(CONTROLS): + raise BuildError(f"no release found for {sorted(set(CONTROLS) - set(facts['families']))}") + for i, name in enumerate(ORGS): + org = data[f"o{i}"] + newest = [] + for repo in org["repositories"]["nodes"]: + if repo["name"] in NEVER: + continue + rels = [r for r in repo["releases"]["nodes"] if not r["isDraft"] and not r["isPrerelease"] and r["publishedAt"]] + if rels: + r = max(rels, key=lambda x: x["publishedAt"]) + newest.append((r["publishedAt"], repo["name"], r["tagName"])) + newest.sort(reverse=True) + facts["houses"][name] = {"line": org["description"] or "", "newest": newest[0] if newest else None} + facts["assets"] = {fam: gh("api", f"repos/{REPO}/releases/tags/{rel['tagName']}", "--jq", ".assets[].name").split() + for fam, rel in facts["families"].items()} + facts["licence"] = gh("api", f"repos/{REPO}/license", "--jq", ".license.spdx_id").strip() + licensing = base64.b64decode(gh("api", f"repos/{REPO}/contents/LICENSING.md", "--jq", ".content")).decode() + facts["ofl"] = "SIL Open Font License 1.1" in licensing + # The workflows come from the checkout: the site workflow may read contents only, not actions. + facts["workflows"] = {} + for fam in CONTROLS: + path = ROOT / ".github" / "workflows" / f"{fam}.yml" + if path.is_file(): + body = path.read_text(encoding="utf-8") + facts["workflows"][fam] = {"build": "build" in body.lower(), "test": bool(re.search(r"pytest|\btests?\b", body))} + return facts + + +def load_facts(path: Path) -> dict: + try: + facts = json.loads(path.read_text(encoding="utf-8")) + datetime.date.fromisoformat(facts["fetched"]) + if set(facts["families"]) != set(CONTROLS) or set(facts["houses"]) != set(ORGS): + raise KeyError("families or houses") + except (OSError, ValueError, KeyError, TypeError) as exc: + raise BuildError(f"cannot read the facts file {path}: {exc}") from exc + return facts + + +# --------------------------------------------------------------------------- +# Parts +# --------------------------------------------------------------------------- + +def date_text(iso: str, fetched: str) -> str: + d = datetime.date.fromisoformat(iso[:10]) + return f"{d.day} {MONTHS[d.month - 1]}" + ("" if d.year == datetime.date.fromisoformat(fetched).year else f" {d.year}") + + +def time_html(iso: str, fetched: str) -> str: + return f'' + + +def facts_html(parts: list[str]) -> str: + return '
' + "".join(f"{p}" for p in parts) + "
" + + +def label(text: str, ident: str) -> str: + return f'
{esc(house["line"])}
{fx}{esc(LINE)}
{n}, {esc(d)}
{facts_html(fx)}{esc(v)}
This page does not exist.
' + '' + ) + missing = page(nf_body, "Not found \u2013 type", "/type/", "", "/*FACES*/", system, nf=True) + return home, missing + + +# --------------------------------------------------------------------------- +# Fonts and images +# --------------------------------------------------------------------------- + +class FaceText(HTMLParser): + VOID = {"img", "input", "br", "meta", "link", "source", "rect", "hr"} + + def __init__(self, face: str) -> None: + super().__init__(convert_charrefs=True) + self.face, self.stack, self.out = face, [], set() + + def handle_starttag(self, tag, attrs): + if tag not in self.VOID: + cls = (dict(attrs).get("class") or "").split() + self.stack.append(self.face in cls or (self.face == "heddle" and "wm" in cls)) + + def handle_endtag(self, tag): + if tag not in self.VOID and self.stack: + self.stack.pop() + + def handle_data(self, data): + if any(self.stack): + self.out |= set(data) + + +def strip_code(text: str) -> str: + return re.sub(r"<(script|style)[^>]*>.*?\1>", " ", text, flags=re.S) + + +def visible_text(text: str) -> str: + text = strip_code(text) + text = re.sub(r'(?:aria-label|alt|placeholder|title|content)="([^"]*)"', lambda m: " " + m.group(1) + " ", text) + return html.unescape(re.sub(r"<[^>]+>", " ", text)) + + +def face_text(text: str, face: str) -> set[str]: + p = FaceText(face) + p.feed(strip_code(text)) + return p.out + + +def build_fonts(pages: list[str], sources: dict[str, Path], out: Path) -> list[str]: + """Cut one subset of each family for the home page and the 404 page (fonts/home/rLba7Wyz@s6jX*5nWheoZY|JDiES3X
zI!>fim`-fk!{e%3{brg~OrYDB>4fuPZTCAD*8|e-*Q-8X>!H{KZ2A#T(@W&<<`b6&
zBvjiqEJN{S4&j<^yUgkp hW&cHW2xd-Q`L3c=H?j+&c~e?)9y}h)=+`k*-W=BfKp+Z(P;fpRo-ot%&W6Y
zk09X7eRLX)MS3IWiCQhp;ld$}#&QCU(w!IdOR>rt+;kwlcU)qU>{G}1L7;fcnMEx5
zAKE<2k->tQ5`xRaWm&9~o&V>7G0D2@-#VlaVZ6?rUhYr$`APL#{xNOOo#}o*Hb0!m
zc_XB%)<3l0oM#buvZx(DHMn{Hv?#zUO|C2{f~kpfiymcFfjca$c#?a|QLW5U%9dRtM#a=WDhL9hCjH1M%
z7HLRZ;lmF*%E^ARQRU=aHm0Wcq6TMb6&Y$A5v6dRYHqAuutbXAu}Mfx$bn>a8P-?oMyV?tHy&)>yRdtFw`^OZ*KK
zt6KF36a3Us+5#S}^IAj;Mjt*pA2wU8s4B}