Files
stain.otf/index.html

189 lines
4.7 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Stain Font Preview</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
:root {
color-scheme: light;
--bg: #f7f7f8;
--fg: #111827;
--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: 1.5rem;
font-family: var(--font-ui);
background: var(--bg);
color: var(--fg);
}
h1 {
margin: 0 0 1rem;
font-size: 1.8rem;
font-weight: 600;
letter-spacing: 0.03em;
}
p {
margin: 0 0 0.75rem;
color: var(--muted);
font-size: 0.95rem;
}
.grid {
display: grid;
grid-template-columns: minmax(0, 1fr);
gap: 1.25rem;
margin-top: 1.5rem;
}
@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: 0.5rem;
}
.label {
font-size: 0.8rem;
text-transform: uppercase;
letter-spacing: 0.16em;
color: var(--muted);
}
.sample {
min-height: 80px;
font-size: 40px;
letter-spacing: 0.03em;
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0.4ch;
}
.controls {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
align-items: center;
margin-top: 1rem;
font-size: 0.8rem;
color: var(--muted);
}
.controls input[type="range"] {
flex: 1;
}
.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.otf") format("opentype");
font-weight: 400;
font-style: normal;
font-display: swap;
}
.stain { font-family: "Stain", system-ui, sans-serif; }
.sys {
font-family:
"Candara",
system-ui,
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
sans-serif;
}
</style>
</head>
<body>
<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>
<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>
<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="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 sysSample = document.getElementById("sysSample");
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";
});
};
text.addEventListener("input", update);
size.addEventListener("input", update);
track.addEventListener("input", update);
update();
</script>
</body>
</html>