diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-01 10:31:40 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-01 10:31:40 +0300 |
| commit | 64ea6091374753ec5424b5883aa0a189fa54831e (patch) | |
| tree | 1fc9e9d960608291156ee18decba42006e3cfb94 | |
| parent | f4090989293ee11735d8ca20edd4e3308d87e24f (diff) | |
Add self-hosted VT323 matrix font for task 0b
| -rw-r--r-- | README.md | 10 | ||||
| -rw-r--r-- | integrationtests/integration_test.go | 21 | ||||
| -rw-r--r-- | internal/generator/templates/themes/matrix/FONT_LICENSE.txt | 34 | ||||
| -rw-r--r-- | internal/generator/templates/themes/matrix/VT323-Regular.woff2 | bin | 0 -> 26820 bytes | |||
| -rw-r--r-- | internal/generator/templates/themes/matrix/theme.css | 14 |
5 files changed, 74 insertions, 5 deletions
@@ -114,9 +114,9 @@ See [LICENSE](LICENSE). ### Third-party assets -snonux self-hosts every third-party asset it ships — there are no -runtime requests to Google Fonts, gstatic, int10h, or any other CDN. -Each font file lives next to its theme stylesheet under +The bundled web fonts listed below are self-hosted. Their theme +stylesheets make no runtime requests to Google Fonts, gstatic, int10h, +or any font CDN. Each bundled font file lives next to its theme stylesheet under `internal/generator/templates/themes/<name>/`, is committed to git, and is shipped to `dist/themes/<name>/` together with a `FONT_LICENSE.txt` containing the source URL, version/date, and full @@ -132,6 +132,10 @@ Bundled web fonts: Tyler Finck, from [Google Fonts](https://fonts.google.com/specimen/Oxanium), [SIL OFL 1.1](https://openfontlicense.org/open-font-license-official-text/). See [internal/generator/templates/themes/biomech/FONT_LICENSE.txt](internal/generator/templates/themes/biomech/FONT_LICENSE.txt). +- **matrix** — *VT323* Regular (.woff2, latin+latin-ext) by Peter Hull, + from [Google Fonts](https://fonts.google.com/specimen/VT323), + [SIL OFL 1.1](https://openfontlicense.org/open-font-license-official-text/). + See [internal/generator/templates/themes/matrix/FONT_LICENSE.txt](internal/generator/templates/themes/matrix/FONT_LICENSE.txt). When adding a new bundled font: diff --git a/integrationtests/integration_test.go b/integrationtests/integration_test.go index 44913c5..93b3b4e 100644 --- a/integrationtests/integration_test.go +++ b/integrationtests/integration_test.go @@ -457,6 +457,27 @@ func TestThemeSelection(t *testing.T) { t.Fatalf("theme asset %s is empty", path) } } + if theme == "matrix" { + matrixDir := filepath.Join(outputDir, "themes", "matrix") + for _, fname := range []string{"VT323-Regular.woff2", "FONT_LICENSE.txt"} { + path := filepath.Join(matrixDir, fname) + info, err := os.Stat(path) + if err != nil { + t.Fatalf("matrix extra asset missing %s: %v", path, err) + } + if info.Size() == 0 { + t.Fatalf("matrix extra asset %s is empty", path) + } + } + + matrixCSS := readFile(t, filepath.Join(matrixDir, "theme.css")) + assertContains(t, matrixCSS, "url('VT323-Regular.woff2')", "matrix local font URL") + for _, forbidden := range []string{"googleapis", "gstatic", "fonts.cdn", "@import url(http"} { + if strings.Contains(matrixCSS, forbidden) { + t.Fatalf("matrix theme.css contains runtime third-party font reference %q", forbidden) + } + } + } // sounds.json must include ambient data. soundsPath := filepath.Join(outputDir, "themes", theme, "sounds.json") diff --git a/internal/generator/templates/themes/matrix/FONT_LICENSE.txt b/internal/generator/templates/themes/matrix/FONT_LICENSE.txt new file mode 100644 index 0000000..d523252 --- /dev/null +++ b/internal/generator/templates/themes/matrix/FONT_LICENSE.txt @@ -0,0 +1,34 @@ +VT323 +===== + +This directory bundles the web font: + + VT323-Regular.woff2 (weight 400) + +Subsets: latin, latin-ext. + +Source / version +---------------- +- Family page : https://fonts.google.com/specimen/VT323 +- Designer : Peter Hull +- Webfont set : vt323-v18 (latin + latin-ext, woff2) +- Fetched via : https://gwfh.mranftl.com/fonts/vt323 (Webfonts Helper) +- Fetched on : 2026-05-01 + +License +------- +SIL Open Font License, Version 1.1. + + - Summary : https://scripts.sil.org/cms/scripts/page.php?item_id=OFL_web + - Full text : https://openfontlicense.org/open-font-license-official-text/ + - Project : https://github.com/phoikoi/VT323 + +The OFL allows free use, modification, and redistribution of the font, +including embedding in commercial products. Any standalone modified +version of the font itself must be released under the same license and +must not use the Reserved Font Name "VT323". + +Required attribution +-------------------- +Font: "VT323" by Peter Hull - https://github.com/phoikoi/VT323 + Licensed under the SIL Open Font License 1.1. diff --git a/internal/generator/templates/themes/matrix/VT323-Regular.woff2 b/internal/generator/templates/themes/matrix/VT323-Regular.woff2 Binary files differnew file mode 100644 index 0000000..6b2153f --- /dev/null +++ b/internal/generator/templates/themes/matrix/VT323-Regular.woff2 diff --git a/internal/generator/templates/themes/matrix/theme.css b/internal/generator/templates/themes/matrix/theme.css index ca68acd..a305daf 100644 --- a/internal/generator/templates/themes/matrix/theme.css +++ b/internal/generator/templates/themes/matrix/theme.css @@ -1,6 +1,16 @@ + /* Self-hosted web font: VT323 by Peter Hull (SIL OFL 1.1). + Source: https://fonts.google.com/specimen/VT323 + See FONT_LICENSE.txt in this directory. */ + @font-face { + font-family: 'VT323'; + src: url('VT323-Regular.woff2') format('woff2'); + font-weight: 400; + font-style: normal; + font-display: swap; + } :root { --g:#00ff41; --g2:#008f11; --g3:#003b00; --bg:#000; } * { margin:0; padding:0; box-sizing:border-box; } - body { font-family:'Courier New',Courier,monospace; background:var(--bg); color:var(--g); + body { font-family:'VT323','Courier New',Courier,monospace; background:var(--bg); color:var(--g); overflow:hidden; height:100vh; height:100dvh; } /* scanline overlay sits above WebGL */ body::before { content:''; position:fixed; inset:0; z-index:999; pointer-events:none; @@ -59,7 +69,7 @@ .modal-close { float:right; background:none; border:none; color:var(--g2); font-family:monospace; font-size:0.9rem; cursor:pointer; letter-spacing:2px; } @media(max-width:640px) { .nav-hints{display:none;} header{padding:10px 16px;} .content{padding:10px 16px;} .modal-inner{padding:20px 14px} .transmit-btn{padding-top:11px;padding-bottom:11px;min-height:44px} .modal-close{padding:10px 14px;min-width:44px;min-height:44px;text-align:center} } - [data-sno-theme="matrix"] .splash-overlay { background: #000; font-family:'Courier New',monospace; } + [data-sno-theme="matrix"] .splash-overlay { background: #000; font-family:'VT323','Courier New',monospace; } [data-sno-theme="matrix"] .splash-rain { position:absolute; inset:0; overflow:hidden; pointer-events:none; opacity:0.35; z-index:1; font-size:11px; line-height:14px; color:var(--g2); text-align:left; padding:8px; |
