mirror of
https://github.com/multipleof4/stain.otf.git
synced 2026-01-13 16:17:55 +00:00
Feat: Add Stain vs system font preview page
This commit is contained in:
419
index.html
419
index.html
@@ -1,341 +1,188 @@
|
||||
<!doctype html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Stain vs Candara Preview</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta charset="UTF-8" />
|
||||
<title>Stain Font Preview</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<style>
|
||||
:root {
|
||||
--bg: #f7f8fb;
|
||||
color-scheme: light;
|
||||
--bg: #f7f7f8;
|
||||
--fg: #111827;
|
||||
--accent: #2563eb;
|
||||
--grid: #e5e7eb;
|
||||
--border: #d1d5db;
|
||||
--radius: 10px;
|
||||
--font-ui: system-ui, -apple-system, BlinkMacSystemFont, -system-ui,
|
||||
-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
|
||||
--muted: #6b7280;
|
||||
--accent: #111827;
|
||||
--border: #e5e7eb;
|
||||
--font-ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 24px;
|
||||
padding: 1.5rem;
|
||||
font-family: var(--font-ui);
|
||||
background: var(--bg);
|
||||
color: var(--fg);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
h1 {
|
||||
margin: 0 0 8px;
|
||||
margin: 0 0 1rem;
|
||||
font-size: 1.8rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
h2 {
|
||||
margin: 24px 0 8px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.16em;
|
||||
color: #6b7280;
|
||||
letter-spacing: 0.03em;
|
||||
}
|
||||
p {
|
||||
margin: 4px 0 16px;
|
||||
color: #4b5563;
|
||||
max-width: 720px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.card {
|
||||
flex: 1 1 260px;
|
||||
background: #ffffff;
|
||||
border-radius: var(--radius);
|
||||
border: 1px solid var(--border);
|
||||
padding: 14px 14px 12px;
|
||||
box-shadow: 0 8px 18px rgba(15,23,42,0.04);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.card-label {
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.14em;
|
||||
color: #9ca3af;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.pill {
|
||||
padding: 2px 8px 3px;
|
||||
border-radius: 999px;
|
||||
font-size: 9px;
|
||||
font-weight: 600;
|
||||
border: 1px solid #d1d5db;
|
||||
color: #6b7280;
|
||||
background: #f9fafb;
|
||||
}
|
||||
.sample {
|
||||
font-size: 60px;
|
||||
line-height: 1.1;
|
||||
margin: 2px 0 6px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px 16px;
|
||||
}
|
||||
.sample span {
|
||||
display: inline-block;
|
||||
}
|
||||
.caption {
|
||||
font-size: 10px;
|
||||
color: #9ca3af;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
.slider-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 10px;
|
||||
color: #6b7280;
|
||||
}
|
||||
input[type=range] {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 120px;
|
||||
height: 4px;
|
||||
border-radius: 999px;
|
||||
background: var(--grid);
|
||||
outline: none;
|
||||
}
|
||||
input[type=range]::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
border-radius: 50%;
|
||||
background: var(--accent);
|
||||
cursor: pointer;
|
||||
box-shadow: 0 1px 3px rgba(15,23,42,0.25);
|
||||
}
|
||||
input[type=range]::-moz-range-thumb {
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
border-radius: 50%;
|
||||
background: var(--accent);
|
||||
cursor: pointer;
|
||||
box-shadow: 0 1px 3px rgba(15,23,42,0.25);
|
||||
margin: 0 0 0.75rem;
|
||||
color: var(--muted);
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
.grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(to bottom, rgba(229,231,235,0.6) 1px, transparent 1px),
|
||||
linear-gradient(to right, rgba(229,231,235,0.25) 1px, transparent 1px);
|
||||
background-size: 22px 22px, 24px 24px;
|
||||
opacity: 0.18;
|
||||
pointer-events: none;
|
||||
mix-blend-mode: multiply;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 1.25rem;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
.grid-labels {
|
||||
position: absolute;
|
||||
left: 6px;
|
||||
top: 8px;
|
||||
font-size: 7px;
|
||||
color: rgba(148,163,253,0.7);
|
||||
@media (min-width: 768px) {
|
||||
.grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
.panel {
|
||||
padding: 1rem 1.1rem;
|
||||
border-radius: 0.85rem;
|
||||
border: 1px solid var(--border);
|
||||
background: #ffffff;
|
||||
box-shadow: 0 10px 25px rgba(15,23,42,0.03);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
pointer-events: none;
|
||||
text-shadow: 0 1px 1px rgba(255,255,255,0.9);
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.grid-labels span {
|
||||
padding: 1px 4px;
|
||||
border-radius: 999px;
|
||||
background: rgba(255,255,255,0.9);
|
||||
border: 1px solid rgba(199,210,254,0.8);
|
||||
.label {
|
||||
font-size: 0.8rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.16em;
|
||||
color: var(--muted);
|
||||
}
|
||||
.code {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
font-size: 9px;
|
||||
padding: 3px 6px;
|
||||
border-radius: 6px;
|
||||
background: #f9fafb;
|
||||
border: 1px solid #e5e7eb;
|
||||
color: #6b7280;
|
||||
}
|
||||
.flex-between {
|
||||
.sample {
|
||||
min-height: 80px;
|
||||
font-size: 40px;
|
||||
letter-spacing: 0.03em;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.4ch;
|
||||
}
|
||||
.small-link {
|
||||
font-size: 9px;
|
||||
color: var(--accent);
|
||||
text-decoration: none;
|
||||
.controls {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
margin-top: 1rem;
|
||||
font-size: 0.8rem;
|
||||
color: var(--muted);
|
||||
}
|
||||
.small-link:hover {
|
||||
text-decoration: underline;
|
||||
.controls input[type="range"] {
|
||||
flex: 1;
|
||||
}
|
||||
@media (max-width: 640px) {
|
||||
body {
|
||||
padding: 16px;
|
||||
}
|
||||
.sample {
|
||||
font-size: 42px;
|
||||
}
|
||||
.input-wrap {
|
||||
margin-top: 0.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
font-size: 0.8rem;
|
||||
color: var(--muted);
|
||||
}
|
||||
.input-wrap input {
|
||||
flex: 1;
|
||||
padding: 0.35rem 0.5rem;
|
||||
border-radius: 0.4rem;
|
||||
border: 1px solid var(--border);
|
||||
font-family: var(--font-ui);
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
.tag {
|
||||
padding: 0.15rem 0.5rem;
|
||||
border-radius: 999px;
|
||||
border: 1px solid var(--border);
|
||||
font-size: 0.7rem;
|
||||
color: var(--muted);
|
||||
}
|
||||
@font-face {
|
||||
font-family: "Stain";
|
||||
src: url("./dist/Stain-Regular.ttf") format("truetype");
|
||||
src: url("./dist/Stain.otf") format("opentype");
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
.stain {
|
||||
font-family: "Stain", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
font-feature-settings: "liga" 1, "kern" 1;
|
||||
}
|
||||
.candara {
|
||||
font-family: Candara, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
.stain { font-family: "Stain", system-ui, sans-serif; }
|
||||
.sys {
|
||||
font-family:
|
||||
"Candara",
|
||||
system-ui,
|
||||
-apple-system,
|
||||
BlinkMacSystemFont,
|
||||
"Segoe UI",
|
||||
sans-serif;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>Stain Typeface Preview</h1>
|
||||
<p>
|
||||
Stain is a Candara-inspired humanist sans experiment.
|
||||
This page compares Stain (left) with Candara (right) for A, B, C / a, b, c.
|
||||
Make sure Candara is installed locally to see it accurately.
|
||||
</p>
|
||||
</header>
|
||||
<h1>Stain Font Preview</h1>
|
||||
<p>
|
||||
Compare the in-progress "Stain" typeface against your system text (ideally Candara) in light mode.
|
||||
Only A, B, C / a, b, c are currently implemented.
|
||||
</p>
|
||||
|
||||
<h2>Core glyphs: A B C / a b c</h2>
|
||||
<div class="row">
|
||||
<section class="card">
|
||||
<div class="grid" aria-hidden="true"></div>
|
||||
<div class="grid-labels" aria-hidden="true">
|
||||
<span>Ascender</span>
|
||||
<span>x-height</span>
|
||||
<span>Baseline</span>
|
||||
</div>
|
||||
<div class="card-label">
|
||||
<span class="pill">Stain</span>
|
||||
<span>Prototype outlines</span>
|
||||
</div>
|
||||
<div class="sample stain" id="stainSample">
|
||||
<span>A</span><span>B</span><span>C</span>
|
||||
<span>a</span><span>b</span><span>c</span>
|
||||
</div>
|
||||
<div class="caption">
|
||||
<div class="slider-wrap">
|
||||
Size
|
||||
<input id="stainSize" type="range" min="28" max="96" value="60">
|
||||
</div>
|
||||
<code class="code">font-family: "Stain"</code>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<div class="card-label">
|
||||
<span class="pill">Candara</span>
|
||||
<span>Reference glyphs</span>
|
||||
</div>
|
||||
<div class="sample candara" id="candaraSample">
|
||||
<span>A</span><span>B</span><span>C</span>
|
||||
<span>a</span><span>b</span><span>c</span>
|
||||
</div>
|
||||
<div class="caption flex-between">
|
||||
<div class="slider-wrap">
|
||||
Size
|
||||
<input id="candaraSize" type="range" min="28" max="96" value="60">
|
||||
</div>
|
||||
<div>
|
||||
<span class="code">font-family: Candara</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<div class="controls">
|
||||
<span class="tag">A B C a b c</span>
|
||||
<span>Size</span>
|
||||
<input id="size" type="range" min="18" max="96" value="40" />
|
||||
<span id="sizeVal">40px</span>
|
||||
<span>Letter spacing</span>
|
||||
<input id="track" type="range" min="-10" max="40" value="3" />
|
||||
<span id="trackVal">0.03em</span>
|
||||
</div>
|
||||
|
||||
<h2>Side-by-side comparison</h2>
|
||||
<div class="row">
|
||||
<section class="card">
|
||||
<div class="card-label">
|
||||
<span class="pill">Pair</span>
|
||||
Overlay scan-lines
|
||||
</div>
|
||||
<div class="sample">
|
||||
<span class="stain" id="pairStain">ABC abc</span>
|
||||
<span class="candara" id="pairCandara">ABC abc</span>
|
||||
</div>
|
||||
<div class="caption flex-between">
|
||||
<div class="slider-wrap">
|
||||
Shared size
|
||||
<input id="pairSize" type="range" min="28" max="96" value="54">
|
||||
</div>
|
||||
<span class="code">Compare curves / modulation / width</span>
|
||||
</div>
|
||||
<div class="input-wrap">
|
||||
<span>Sample text:</span>
|
||||
<input id="text" value="ABC abc" />
|
||||
</div>
|
||||
|
||||
<div class="grid">
|
||||
<section class="panel">
|
||||
<div class="label">Stain</div>
|
||||
<div id="stainSample" class="sample stain">ABC abc</div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<div class="card-label">
|
||||
<span class="pill">Playground</span>
|
||||
Custom text
|
||||
</div>
|
||||
<div class="sample" style="flex-direction: column; gap: 6px;">
|
||||
<div class="stain" id="playStain">Stain ABC abc</div>
|
||||
<div class="candara" id="playCandara">Stain ABC abc</div>
|
||||
</div>
|
||||
<div class="caption flex-between">
|
||||
<input
|
||||
id="playInput"
|
||||
type="text"
|
||||
value="Stain ABC abc"
|
||||
style="flex:1;border:1px solid var(--border);border-radius:7px;padding:4px 6px;font-size:10px;font-family:var(--font-ui);color:#374151;background:#f9fafb;"
|
||||
>
|
||||
<a class="small-link" href="./dist/Stain-Regular.ttf" download>Download Stain-Regular.ttf</a>
|
||||
</div>
|
||||
<section class="panel">
|
||||
<div class="label">System (Candara / fallback)</div>
|
||||
<div id="sysSample" class="sample sys">ABC abc</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const text = document.getElementById("text");
|
||||
const size = document.getElementById("size");
|
||||
const sizeVal = document.getElementById("sizeVal");
|
||||
const track = document.getElementById("track");
|
||||
const trackVal = document.getElementById("trackVal");
|
||||
const stainSample = document.getElementById("stainSample");
|
||||
const candaraSample = document.getElementById("candaraSample");
|
||||
const pairStain = document.getElementById("pairStain");
|
||||
const pairCandara = document.getElementById("pairCandara");
|
||||
const playStain = document.getElementById("playStain");
|
||||
const playCandara = document.getElementById("playCandara");
|
||||
const sysSample = document.getElementById("sysSample");
|
||||
|
||||
const stainSize = document.getElementById("stainSize");
|
||||
const candaraSize = document.getElementById("candaraSize");
|
||||
const pairSize = document.getElementById("pairSize");
|
||||
const playInput = document.getElementById("playInput");
|
||||
|
||||
const sync = (input, els) => {
|
||||
const apply = () => {
|
||||
const v = input.value;
|
||||
els.forEach(e => e.style.fontSize = v + "px");
|
||||
};
|
||||
input.addEventListener("input", apply);
|
||||
apply();
|
||||
const update = () => {
|
||||
const v = text.value || "ABC abc";
|
||||
const fs = size.valueAsNumber || 40;
|
||||
const ls = (track.valueAsNumber || 0) / 100;
|
||||
sizeVal.textContent = fs + "px";
|
||||
trackVal.textContent = ls.toFixed(2) + "em";
|
||||
[stainSample, sysSample].forEach(el => {
|
||||
el.textContent = v;
|
||||
el.style.fontSize = fs + "px";
|
||||
el.style.letterSpacing = ls + "em";
|
||||
});
|
||||
};
|
||||
|
||||
sync(stainSize, [stainSample]);
|
||||
sync(candaraSize, [candaraSample]);
|
||||
sync(pairSize, [pairStain, pairCandara, playStain, playCandara]);
|
||||
|
||||
playInput.addEventListener("input", () => {
|
||||
const v = playInput.value || "Stain ABC abc";
|
||||
playStain.textContent = v;
|
||||
playCandara.textContent = v;
|
||||
});
|
||||
text.addEventListener("input", update);
|
||||
size.addEventListener("input", update);
|
||||
track.addEventListener("input", update);
|
||||
update();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user