Files
stain.otf/index.html

342 lines
9.3 KiB
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">
<style>
:root {
--bg: #f7f8fb;
--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;
}
* { box-sizing: border-box; }
body {
margin: 0;
padding: 24px;
font-family: var(--font-ui);
background: var(--bg);
color: var(--fg);
-webkit-font-smoothing: antialiased;
}
h1 {
margin: 0 0 8px;
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;
}
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);
}
.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;
}
.grid-labels {
position: absolute;
left: 6px;
top: 8px;
font-size: 7px;
color: rgba(148,163,253,0.7);
display: flex;
flex-direction: column;
gap: 4px;
pointer-events: none;
text-shadow: 0 1px 1px rgba(255,255,255,0.9);
}
.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);
}
.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 {
display: flex;
justify-content: space-between;
align-items: center;
gap: 8px;
}
.small-link {
font-size: 9px;
color: var(--accent);
text-decoration: none;
}
.small-link:hover {
text-decoration: underline;
}
@media (max-width: 640px) {
body {
padding: 16px;
}
.sample {
font-size: 42px;
}
}
@font-face {
font-family: "Stain";
src: url("./dist/Stain-Regular.ttf") format("truetype");
font-weight: 400;
font-style: normal;
}
.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;
}
</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>
<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>
<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>
</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>
</div>
<script>
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 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();
};
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;
});
</script>
</body>
</html>