web: add OpenTUI Mono typeface (#1404)

Replace Commit Mono with a project-owned Iosevka build so the site
typeface can evolve with OpenTUI's visual identity. Add a private font
lab to compare future builds before publishing them.
This commit is contained in:
Simon Klee
2026-08-22 11:11:30 +02:00
committed by GitHub
parent ea89dcd083
commit eaf1d41e92
27 changed files with 778 additions and 111 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ Remove an element when spacing, order, plain text, or standard HTML can do the s
- Use black text on a white background, or the dark-mode equivalent.
- Use the standard browser link color, but do not use the visited color.
- Use Commit Mono as the primary typeface. Use the OpenTUI wordmark as the main brand element.
- Use OpenTUI Mono as the primary typeface. Use the OpenTUI wordmark as the main brand element.
- Use whitespace and standard HTML elements to separate ideas.
- Do not add cards, panels, badges, decorative rules, gradients, shadows, rounded containers, or ornamental backgrounds.
- Do not add an element only to fill empty space.
+4 -1
View File
@@ -70,7 +70,10 @@ export default defineConfig({
integrations: [
mdx(),
sitemap({
filter: (page) => new URL(page).pathname !== "/404/",
filter: (page) => {
const path = new URL(page).pathname
return path !== "/404/" && !path.startsWith("/lab/")
},
}),
],
site: "https://opentui.com",
Binary file not shown.
Binary file not shown.
Binary file not shown.
-88
View File
@@ -1,88 +0,0 @@
Copyright (c) 2023 Eigil Nikolajsen (eigi0088@gmail.com)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The fonts,
including any derivative works, can be bundled, embedded, redistributed
and/or sold with any software provided that any reserved names are not used
by derivative works. The fonts and derivatives, however, cannot be released
under any other type of license. The requirement for fonts to remain under
this license does not apply to any document created using the fonts or their
derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may include
source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical writer or
other person who contributed to the Font Software.
PERMISSION AND CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining a copy
of the Font Software, to use, study, copy, merge, embed, modify, redistribute,
and sell modified and unmodified copies of the Font Software, subject to the
following conditions:
1) Neither the Font Software nor any of its individual components, in
Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy contains
the above copyright notice and this license. These can be included either as
stand-alone text files, human-readable headers or in the appropriate
machine-readable metadata fields within text or binary files as long as those
fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font Name(s)
unless explicit written permission is granted by the corresponding Copyright
Holder. This restriction only applies to the primary font name as presented
to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any Modified
Version, except to acknowledge the contribution(s) of the Copyright Holder(s)
and the Author(s) or with their explicit written permission.
5) The Font Software, modified or unmodified, in part or in whole, must be
distributed entirely under this license, and must not be distributed under
any other license. The requirement for fonts to remain under this license does
not apply to any document created using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL,
INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE
THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
+96
View File
@@ -0,0 +1,96 @@
These files are OpenTUI Mono. Iosevka v34.4.0 compiled them with the plan
in packages/web/src/font/private-build-plans.toml.
Copyright (c) 2015-2026, Belleve Invis (belleve@typeof.net).
Copyright (c) 2025, Ahmed Hatem (https://github.com/ahatem).
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this License and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,96 @@
These files are OpenTUI Mono. Iosevka v34.4.0 compiled them with the plan
in packages/web/src/font/private-build-plans.toml.
Copyright (c) 2015-2026, Belleve Invis (belleve@typeof.net).
Copyright (c) 2025, Ahmed Hatem (https://github.com/ahatem).
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this License and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
+1 -1
View File
@@ -159,7 +159,7 @@ Use this minimum ratio for a full-width composition:
cols / rows >= (boxWidth / boxHeight) * (lineToEm / chToEm)
```
For Commit Mono, `chToEm` is approximately `0.6` and `lineToEm` is approximately `1.1`.
For OpenTUI Mono, `chToEm` is approximately `0.6` and `lineToEm` is approximately `1.1`.
A media-area ratio from `1.2` to `1.3` usually needs a recording ratio from approximately `2.2` to `2.4`.
+1
View File
@@ -1,4 +1,5 @@
User-agent: *
Allow: /
Disallow: /lab/
Sitemap: https://opentui.com/sitemap-index.xml
+3 -3
View File
@@ -65,9 +65,9 @@ for (const heading of Astro.props.headings) {
margin-block-start: 0.25rem;
}
/* The outline is orientation, not navigation: it stays in the text color
* so the link color keeps marking real links. The section being read is
* bold; Commit Mono bold keeps the same advance width, so nothing
/* The outline is orientation, not navigation. It stays in the text color
* so the link color keeps marking real links. The current section is
* bold. OpenTUI Mono bold keeps the same advance width, so nothing
* shifts as the marker moves. (a:visited keeps the global rule from
* recoloring visited anchors.) */
a,
+37
View File
@@ -0,0 +1,37 @@
# OpenTUI Mono
OpenTUI Mono is the typeface for the site. Iosevka compiles
`private-build-plans.toml` into static WOFF2 files. Iosevka does not write
an OpenType variable font.
The live files are Regular, Bold, Italic, and Bold Italic in
`public/fonts/`. `/lab/font` compares those files with the next compile in
`public/fonts/candidate/`.
## Plan
The plan sets glyphs, metrics, weights (100 to 900), and widths (Normal +
SemiCondensed). Ligatures are off. The plan makes one web-subset family.
Change keys in the plan. Do not start from a blank UFO or FontForge file.
Identity glyphs: `a g l I 1 0 8 6 9 @ { } ( ) _ *`.
These keys change the look first: `sb`, width `shape`, `xHeight`,
`archDepth`, and the identity keys in `variants.design`.
## Compile
You need Node 18+ and a clone of [Iosevka](https://github.com/be5invis/Iosevka)
at `v34.4.0`. You do not need `ttfautohint` for `webfont-unhinted`.
```
git clone --depth 1 --branch v34.4.0 https://github.com/be5invis/Iosevka.git
cp packages/web/src/font/private-build-plans.toml Iosevka/
cd Iosevka && npm install
npm run build -- --jCmd=4 webfont-unhinted::OpenTUIMono
```
Copy the next compile into `packages/web/public/fonts/candidate/` as
`OpenTUIMono-{Regular,Bold,Italic,BoldItalic}.woff2`. Compare it with
the live files at `/lab/font`. When you accept the next compile, copy those
four files to `packages/web/public/fonts/`.
@@ -0,0 +1,256 @@
# OpenTUI Mono. Iosevka build plan.
#
# Iosevka v34.4.0. Static instances. Not an OpenType variable font.
# Ligatures are off. One web-subset family.
#
# cp this file to Iosevka/private-build-plans.toml
# npm install
# npm run build -- --jCmd=4 webfont-unhinted::OpenTUIMono
# copy dist/OpenTUIMono/WOFF2-Unhinted/OpenTUIMono-{Regular,Bold,Italic,BoldItalic}.woff2
# to packages/web/public/fonts/candidate/
[buildPlans.OpenTUIMono]
family = "OpenTUI Mono"
spacing = "normal"
serifs = "sans"
noCvSs = true
noLigation = true
exportGlyphNames = false
webfontFormats = ["WOFF2"]
[buildPlans.OpenTUIMono.variants.design]
one = "no-base"
two = "straight-neck-serifless"
three = "flat-top-serifless"
four = "semi-open-serifless"
five = "oblique-flat-serifless"
six = "open-contour"
seven = "straight-serifless"
eight = "two-circles"
nine = "open-contour"
zero = "dotted"
capital-a = "straight-serifless"
capital-b = "standard-serifless"
capital-c = "bilateral-inward-serifed"
capital-d = "standard-serifless"
capital-e = "serifless"
capital-f = "serifless"
capital-g = "toothless-corner-inward-serifed-hooked"
capital-h = "serifless"
capital-i = "serifed"
capital-j = "serifless"
capital-k = "symmetric-touching-serifless"
capital-l = "serifless"
capital-m = "hanging-serifless"
capital-n = "standard-serifless"
capital-p = "closed-serifless"
capital-q = "crossing"
capital-r = "standing-serifless"
capital-s = "serifless"
capital-t = "serifless"
capital-u = "toothless-rounded-serifless"
capital-v = "straight-serifless"
capital-w = "straight-flat-top-serifless"
capital-x = "straight-serifless"
capital-y = "straight-serifless"
capital-z = "straight-serifless"
a = "double-storey-serifless"
b = "toothed-serifless"
c = "bilateral-inward-serifed"
d = "toothed-serifless"
e = "flat-crossbar"
f = "flat-hook-serifless-crossbar-at-x-height"
g = "single-storey-serifless"
h = "straight-serifless"
i = "serifed"
j = "flat-hook-serifed"
k = "symmetric-touching-serifless"
l = "serifed"
m = "serifless"
n = "straight-serifless"
p = "eared-serifless"
q = "straight-serifless"
r = "hookless-serifless"
s = "serifless"
t = "flat-hook-short-neck2"
u = "toothed-serifless"
v = "straight-serifless"
w = "straight-flat-top-serifless"
x = "straight-serifless"
y = "straight-serifless"
z = "straight-serifless"
lower-theta = "oval"
tittle = "square"
diacritic-dot = "square"
punctuation-dot = "square"
braille-dot = "square"
tilde = "low"
asterisk = "penta-mid"
underscore = "high"
caret = "medium"
ascii-grave = "straight"
ascii-single-quote = "straight"
paren = "flat-arc"
brace = "curly-flat-boundary"
guillemet = "straight"
number-sign = "slanted"
ampersand = "closed"
at = "fourfold"
dollar = "through"
cent = "through-cap"
percent = "rings-continuous-slash"
bar = "natural-slope"
question = "corner"
pilcrow = "high"
micro-sign = "toothed-serifless"
decorative-angle-brackets = "middle"
lig-ltgteq = "slanted"
lig-neq = "slightly-slanted"
lig-equal-chain = "without-notch"
lig-hyphen-chain = "without-notch"
lig-plus-chain = "without-notch"
lig-double-arrow-bar = "without-notch"
lig-single-arrow-bar = "without-notch"
[buildPlans.OpenTUIMono.weights.Thin]
shape = 100
menu = 100
css = 100
[buildPlans.OpenTUIMono.weights.ExtraLight]
shape = 200
menu = 200
css = 200
[buildPlans.OpenTUIMono.weights.Light]
shape = 300
menu = 300
css = 300
[buildPlans.OpenTUIMono.weights.SemiLight]
shape = 350
menu = 350
css = 350
[buildPlans.OpenTUIMono.weights.Regular]
shape = 400
menu = 400
css = 400
[buildPlans.OpenTUIMono.weights.Medium]
shape = 500
menu = 500
css = 500
[buildPlans.OpenTUIMono.weights.SemiBold]
shape = 600
menu = 600
css = 600
[buildPlans.OpenTUIMono.weights.Bold]
shape = 700
menu = 700
css = 700
[buildPlans.OpenTUIMono.weights.ExtraBold]
shape = 800
menu = 800
css = 800
[buildPlans.OpenTUIMono.weights.Black]
shape = 900
menu = 900
css = 900
[buildPlans.OpenTUIMono.widths.SemiCondensed]
shape = 540
menu = 4
css = "semi-condensed"
[buildPlans.OpenTUIMono.widths.Normal]
shape = 600
menu = 5
css = "normal"
[buildPlans.OpenTUIMono.slopes.Upright]
angle = 0
shape = "upright"
menu = "upright"
css = "normal"
[buildPlans.OpenTUIMono.slopes.Italic]
angle = 11.8
shape = "italic"
menu = "italic"
css = "italic"
[buildPlans.OpenTUIMono.subset.include]
ranges = [
[
32,
126,
],
[
160,
255,
],
[
256,
383,
],
[
768,
879,
],
[
8192,
8303,
],
[
8352,
8383,
],
[
8592,
8703,
],
[
8704,
8959,
],
[
9472,
9599,
],
[
9600,
9631,
],
[
9632,
9727,
],
]
[buildPlans.OpenTUIMono.metricOverride]
xHeight = 520
cap = 690
ascender = 740
sb = 85
accentWidth = 182
accentClearance = 76
accentHeight = 162
accentStackOffset = 208
leading = 1250
parenSize = 860
dotSize = 'blend(weight, [100, 110], [400, 125], [900, 150])'
periodSize = 140
essRatio = 1.03
essRatioUpper = 1.03
essRatioLower = 1.03
essRatioQuestion = 1.03
archDepth = 152
smallArchDepth = 157
+10 -10
View File
@@ -26,7 +26,7 @@ const { title, description, wide = false, robots } = Astro.props
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#ffffff" />
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#000000" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="preload" href="/CommitMono-Regular.woff2" as="font" type="font/woff2" crossorigin />
<link rel="preload" href="/fonts/OpenTUIMono-Regular.woff2" as="font" type="font/woff2" crossorigin />
<script is:inline>
const theme = localStorage.getItem("theme")
if (theme === "light" || theme === "blue" || theme === "dark") {
@@ -46,32 +46,32 @@ const { title, description, wide = false, robots } = Astro.props
<style is:global>
@font-face {
font-family: "Commit Mono";
src: url("/CommitMono-Regular.woff2") format("woff2");
font-family: "OpenTUI Mono";
src: url("/fonts/OpenTUIMono-Regular.woff2") format("woff2");
font-weight: 400;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "Commit Mono";
src: url("/CommitMono-Bold.woff2") format("woff2");
font-family: "OpenTUI Mono";
src: url("/fonts/OpenTUIMono-Bold.woff2") format("woff2");
font-weight: 700;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "Commit Mono";
src: url("/CommitMono-Italic.woff2") format("woff2");
font-family: "OpenTUI Mono";
src: url("/fonts/OpenTUIMono-Italic.woff2") format("woff2");
font-weight: 400;
font-style: italic;
font-display: swap;
}
@font-face {
font-family: "Commit Mono";
src: url("/CommitMono-Bold-Italic.woff2") format("woff2");
font-family: "OpenTUI Mono";
src: url("/fonts/OpenTUIMono-BoldItalic.woff2") format("woff2");
font-weight: 700;
font-style: italic;
font-display: swap;
@@ -121,7 +121,7 @@ const { title, description, wide = false, robots } = Astro.props
padding: 4rem var(--page-gutter);
background: var(--page-background);
color: var(--page-color);
font-family: "Commit Mono", monospace;
font-family: "OpenTUI Mono", monospace;
font-size: var(--text-body);
line-height: 1.5;
}
+3 -2
View File
@@ -14,12 +14,13 @@ interface Props {
reading?: boolean
footerLinks?: boolean
footerAnimation?: ComponentProps<typeof SiteFooter>["animation"]
robots?: string
}
const { title, description, wide = false, reading = false, footerLinks = false, footerAnimation } = Astro.props
const { title, description, wide = false, reading = false, footerLinks = false, footerAnimation, robots } = Astro.props
---
<Minimal {title} {description} wide>
<Minimal {title} {description} wide {robots}>
<SiteNav slot="nav" />
<main class:list={[{ wide, reading }]}><slot /></main>
<SiteFooter links={footerLinks} animation={footerAnimation} />
+265
View File
@@ -0,0 +1,265 @@
---
import SitePage from "../../layouts/SitePage.astro"
const title = "Font lab | OpenTUI"
const description = "Compare the live OpenTUI Mono files with the next compile."
const weight = {
regular: "Regular. The outline names the current section.",
bold: "Bold. Navigation and the current outline item.",
italic: "Italic. Comments in code samples.",
}
const prose = [
"OpenTUI is a library to build terminal user interfaces in TypeScript, React, or Solid, on a native Zig renderer.",
"You write TypeScript directly or through React and Solid. You arrange boxes and text with flexbox. You add selects, inputs, and scroll boxes with keyboard and mouse controls.",
"A renderable is a node in the tree. The renderer walks that tree, sets the layout, and writes cells. <code>box</code>, <code>text</code>, and <code>input</code> are renderables. The page typeface sets the article and the code in it.",
"Documentation uses 14px. Landing pages, scrollback, and package notes use 16px. Bold marks the current section. Italic marks comments. One family must work for all of this. It must not look like a UI sans on a grid.",
]
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\nabcdefghijklmnopqrstuvwxyz\n0123456789"
const identity = "Il1| O0Q a g 8 69 @ {}[]() _*#&"
const operators = "=> === !== <= >= || && ?? ... /* */ <!-- -->"
const code = `renderer.root.add(
box({ flexDirection: "column" }, [
text({ content: "rate = tokens / (t1 - t0)" }),
input({ placeholder: "filter 1lI O0 {}" }),
]),
)`
const boxDrawing = `┌──────────────┬────────┐
│ renderable │ state │
├──────────────┼────────┤
│ box │ ready │
│ text │ dirty │
│ input │ focus │
└──────────────┴────────┘`
---
<SitePage {title} {description} wide robots="noindex">
<article class="lab">
<h1>Font lab</h1>
<p>
Live is the typeface on the site in <code>public/fonts/</code>. Next is the next
compile in <code>public/fonts/candidate/</code>. The plan is
<code>src/font/private-build-plans.toml</code>.
</p>
<h2>Identity</h2>
<div class="pair">
<figure>
<figcaption>Live</figcaption>
<pre>{identity}</pre>
</figure>
<figure class="next">
<figcaption>Next</figcaption>
<pre>{identity}</pre>
</figure>
</div>
<h2>Alphabet</h2>
<div class="pair">
<figure>
<figcaption>Live</figcaption>
<pre>{alphabet}</pre>
</figure>
<figure class="next">
<figcaption>Next</figcaption>
<pre>{alphabet}</pre>
</figure>
</div>
<h2>Code</h2>
<div class="pair">
<figure>
<figcaption>Live</figcaption>
<pre>{code}</pre>
</figure>
<figure class="next">
<figcaption>Next</figcaption>
<pre>{code}</pre>
</figure>
</div>
<h2>Operators</h2>
<div class="pair">
<figure>
<figcaption>Live</figcaption>
<pre>{operators}</pre>
</figure>
<figure class="next">
<figcaption>Next</figcaption>
<pre>{operators}</pre>
</figure>
</div>
<h2>Box drawing</h2>
<div class="pair">
<figure>
<figcaption>Live</figcaption>
<pre class="diagram">{boxDrawing}</pre>
</figure>
<figure class="next">
<figcaption>Next</figcaption>
<pre class="diagram">{boxDrawing}</pre>
</figure>
</div>
<h2>Weight</h2>
<div class="pair">
<figure>
<figcaption>Live</figcaption>
<p>{weight.regular}</p>
<p class="bold">{weight.bold}</p>
<p class="italic">{weight.italic}</p>
</figure>
<figure class="next">
<figcaption>Next</figcaption>
<p>{weight.regular}</p>
<p class="bold">{weight.bold}</p>
<p class="italic">{weight.italic}</p>
</figure>
</div>
<h2>Prose</h2>
<div class="pair">
<figure>
<figcaption>Live</figcaption>
{prose.map((paragraph) => <p set:html={paragraph} />)}
</figure>
<figure class="next">
<figcaption>Next</figcaption>
{prose.map((paragraph) => <p set:html={paragraph} />)}
</figure>
</div>
<h2>Reading</h2>
<div class="pair reading">
<figure>
<figcaption>Live</figcaption>
{prose.map((paragraph) => <p set:html={paragraph} />)}
</figure>
<figure class="next">
<figcaption>Next</figcaption>
{prose.map((paragraph) => <p set:html={paragraph} />)}
</figure>
</div>
</article>
</SitePage>
<style>
@font-face {
font-family: "OpenTUI Mono Next";
src: url("/fonts/candidate/OpenTUIMono-Regular.woff2") format("woff2");
font-weight: 400;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "OpenTUI Mono Next";
src: url("/fonts/candidate/OpenTUIMono-Bold.woff2") format("woff2");
font-weight: 700;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "OpenTUI Mono Next";
src: url("/fonts/candidate/OpenTUIMono-Italic.woff2") format("woff2");
font-weight: 400;
font-style: italic;
font-display: swap;
}
@font-face {
font-family: "OpenTUI Mono Next";
src: url("/fonts/candidate/OpenTUIMono-BoldItalic.woff2") format("woff2");
font-weight: 700;
font-style: italic;
font-display: swap;
}
.lab {
max-width: var(--frame-width);
}
.lab h1 {
margin-block: 0 3rem;
}
.lab h2 {
font-size: 1.25rem;
line-height: 1.5rem;
margin-block: 3rem 0.75rem;
}
.lab p {
max-width: var(--content-width);
margin-block: 0 1.5rem;
}
.lab :not(pre) > code {
background: color-mix(in srgb, currentColor 8%, transparent);
padding: 0.0625rem 0.4ch;
}
.pair {
display: grid;
gap: 1.5rem;
margin-block: 0 1.5rem;
}
.pair figure {
margin: 0;
min-width: 0;
}
.pair figcaption {
color: var(--muted-color);
margin-block-end: 0.75rem;
}
.pair pre,
.pair p {
margin: 0;
max-width: none;
}
.pair pre + pre,
.pair p + p {
margin-block-start: 0.75rem;
}
.pair pre {
font-family: inherit;
font-size: var(--text-small);
white-space: pre-wrap;
overflow-wrap: anywhere;
}
.pair .diagram {
font-size: inherit;
line-height: 1.2;
font-variant-ligatures: none;
white-space: pre;
overflow-x: auto;
overflow-wrap: normal;
}
.next {
font-family: "OpenTUI Mono Next", monospace;
}
.bold {
font-weight: 700;
}
.italic {
font-style: italic;
}
@media (min-width: 48rem) {
.pair {
grid-template-columns: 1fr 1fr;
column-gap: 3rem;
}
}
</style>
@@ -684,10 +684,10 @@
}
function loadAndMount(illustration, config) {
// `fitScreenToBox` sizes the screen from a measured glyph width. Measuring
// against the fallback monospace font while Commit Mono is still
// loading leaves the rendered screen narrower or wider than the box, so
// wait for fonts before mounting.
// `fitScreenToBox` sizes the screen from a measured glyph width. If you
// measure before OpenTUI Mono loads, the fallback monospace font sets
// the width. Then the screen is narrower or wider than the box. Wait
// for fonts before you mount.
var fontsReady = document.fonts && document.fonts.ready ? document.fonts.ready : Promise.resolve()
Promise.all(
config.stories
@@ -34,7 +34,7 @@
.terminal-illustration__screen {
color: inherit;
flex: none;
font-family: "Commit Mono", ui-monospace, monospace;
font-family: "OpenTUI Mono", ui-monospace, monospace;
font-variant-ligatures: none;
white-space: pre;
}