mirror of
https://github.com/hanzoai/font.git
synced 2026-11-02 23:42:52 +00:00
The presets carried what they were fitted against — a licensed text face, a licensed display one, and the residuals of each search. That is our own working metadata, not the licence, and it is not what a preset IS: book is the reading weight, medium the step up before display, wide is widened and weighted to hold the widening. Each now says that and nothing else, and the numbers a search produced stay out of the shipped data, the stylesheet comments, the types and the crate. A preset also stopped naming another brand's surface. One typeface serves several brands, and a page for one of them should read as though the others do not exist — so the five are described by what the setting does, and the page says which of them that brand uses. The prose was still the upstream project's: it credited another company's design team, pointed downloads at their releases, told you to `npm install zen`, and listed seven other foundries' typefaces under Inspiration. Every import path in font.d.ts declared module "zen/font", which is not this package's name, so the types matched nothing a consumer could write. LICENSE.txt is untouched. The copyright notice travels with each copy, and that is where a licence belongs.
49 lines
1.2 KiB
JavaScript
49 lines
1.2 KiB
JavaScript
// Generated by scripts/presets.mjs. Do not edit.
|
|
export const PRESETS = {
|
|
"air": {
|
|
"wght": 220,
|
|
"scaleX": 1,
|
|
"track": -0.03,
|
|
"note": "Thin display. Set large, tracked in."
|
|
},
|
|
"book": {
|
|
"wght": 497,
|
|
"scaleX": 1,
|
|
"track": 0,
|
|
"note": "Text. The reading weight."
|
|
},
|
|
"medium": {
|
|
"wght": 606,
|
|
"scaleX": 1,
|
|
"track": 0,
|
|
"note": "UI emphasis. A step up from book without becoming display."
|
|
},
|
|
"wide": {
|
|
"wght": 650,
|
|
"scaleX": 1.4861,
|
|
"track": -0.095,
|
|
"note": "Monumental caps. Widened, and weighted to hold the widening."
|
|
},
|
|
"round": {
|
|
"wght": 900,
|
|
"scaleX": 1,
|
|
"track": -0.018,
|
|
"note": "Heavy and friendly at large sizes."
|
|
}
|
|
}
|
|
export const XHEIGHT_FACTOR = 0.9321
|
|
|
|
/** Style object for a preset — for a surface that styles in code, not CSS. */
|
|
export function preset(name) {
|
|
const p = PRESETS[name]
|
|
if (!p) throw new Error(`no Zen preset "${name}" — have ${Object.keys(PRESETS).join(', ')}`)
|
|
return {
|
|
fontFamily: 'Zen',
|
|
fontVariationSettings: `'wght' ${p.wght}`,
|
|
...(p.track ? { letterSpacing: `${p.track}em` } : {}),
|
|
...(p.scaleX !== 1
|
|
? { transform: `scaleX(${p.scaleX})`, transformOrigin: 'left center', display: 'inline-block' }
|
|
: {}),
|
|
}
|
|
}
|