@humanforest/tokens 0.3.4 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/glyphs.ts +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humanforest/tokens",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "Forest design tokens — the OKLCH colour engine (src/colourEngine.ts) plus the CSS + JSON it generates via scripts/{scales,type,motion,deck,dataviz,logo}.ts, and the logo SVGs. The generated files are framework-agnostic; do not edit them by hand, run `bun run build`.",
5
5
  "files": [
6
6
  "glyphs",
package/src/glyphs.ts CHANGED
@@ -14,7 +14,7 @@ import glyphAtlas from '../glyphs/glyphs.json';
14
14
  import { WORDMARK_PATHS, F } from './logo';
15
15
 
16
16
  type Glyph = { d?: string; advance: number; x1?: number; y1?: number; x2?: number; y2?: number };
17
- type Atlas = Record<string, { upm: number; glyphs: Record<string, Glyph> }>;
17
+ type Atlas = Record<FontKey, { upm: number; glyphs: Record<string, Glyph> }>;
18
18
  const ATLAS = glyphAtlas as unknown as Atlas;
19
19
 
20
20
  export type FontKey = 'gt' | 'mohr';
@@ -77,8 +77,8 @@ export function setWord(
77
77
  // lands WORDMARK_F_GAP away — calibrated on the f→o pair the wordmark itself defines.
78
78
  const gtF = ATLAS.gt.glyphs['f'];
79
79
  const gtO = ATLAS.gt.glyphs['o'];
80
- const fLsb = (gtF.x1 ?? 0) * (size / ATLAS.gt.upm);
81
- const fAdvance = fLsb + F.w + (WORDMARK_F_GAP - (gtO.x1 ?? 0) * (size / ATLAS.gt.upm));
80
+ const fLsb = (gtF?.x1 ?? 0) * (size / ATLAS.gt.upm);
81
+ const fAdvance = fLsb + F.w + (WORDMARK_F_GAP - (gtO?.x1 ?? 0) * (size / ATLAS.gt.upm));
82
82
 
83
83
  const out: PlacedGlyph[] = [];
84
84
  let pen = x;
@@ -91,7 +91,7 @@ export function setWord(
91
91
  for (const ch of text) {
92
92
  if (brandF && ch === 'f') {
93
93
  // the artwork, authored in wordmark units with its baseline at F.h — no scaling, it IS the size
94
- out.push({ d: WORDMARK_PATHS[0], transform: `translate(${round(pen + fLsb)} ${round(baseline - F.h)})`, cut: false });
94
+ out.push({ d: WORDMARK_PATHS[0]!, transform: `translate(${round(pen + fLsb)} ${round(baseline - F.h)})`, cut: false });
95
95
  extend(pen + fLsb, baseline - F.h, pen + fLsb + F.w, baseline);
96
96
  pen += fAdvance;
97
97
  continue;