@logomarks/brand-kit 0.4.1 → 0.5.1

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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,27 @@ All notable changes to `@logomarks/brand-kit` are documented here.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.5.1] — 2026-11-07
9
+
10
+ 0.5.0 was tagged but never published; install 0.5.1.
11
+
12
+ ### Fixed
13
+
14
+ - The brand's `tagline`, which the sheet, the deck, the seal and social images set in the brand's face, drops characters the face can't draw, as the lockups do: "Tokyo · 東京" in a Latin face is "Tokyo", not a dangling dot or empty boxes. `withoutChars()` is exported.
15
+
16
+ ## [0.5.0] — 2026-11-07
17
+
18
+ ### Added
19
+
20
+ - **Tracking and capitals for the name.** `typeset(text, font, { tracking, caps })`: `tracking` in em/1000 (100 = 0.1 em), added between glyphs on top of kerning; `caps: true` sets the line in capitals (`false` overrides a face's `case`). `resolveBrand` takes them as `tracking` and `caps`, and the brand records them as `nameType`.
21
+ - **A tagline in the lockups.** `lockupTagline: true | { font, tracking, caps }` puts the tagline under the name in every lockup, in its own face, weight, tracking and case (default the brand's face, tracking 80). Its cap height is 0.4 of the name's (`LOCKUP.tagline`), 0.55 of the name's cap height below the name's baseline (further under a descender). Stacked, it's centred under the name; horizontal, the two lines start together and are centred on the mark as a block. `lockup()` takes `tagline` and `taglineColor` (default the text colour); `brand.lockup(layout, { tagline: false })` leaves it out. The clear space, the brand sheet, the deck and the social images use it, the social images don't repeat it underneath, the typography slide lists it, and `brand.json` records `logo.name` and `logo.tagline`. `taglineType()` and `TAGLINE_TYPE` are exported.
22
+ - **Missing glyphs are left out.** A character the face has no glyph for is no longer drawn as the face's empty box: `typeset` leaves it out, trims a separator left dangling at either end, and lists it in `missing`, so a host can say so (a Japanese tagline in a Latin face draws nothing). `hasGlyph()` and `missingGlyphs()` are exported.
23
+ - `TypeSet` gains `text` (as set) and `tracking` (em/1000).
24
+
25
+ ### Unchanged
26
+
27
+ - Without `tracking`, `caps` or `lockupTagline`, every lockup and slide is byte-identical to 0.4.1 (checked on the six test brands).
28
+
8
29
  ## [0.4.1] — 2026-11-06
9
30
 
10
31
  ### Fixed
package/README.md CHANGED
@@ -32,7 +32,7 @@ for (const [file, data] of files) {
32
32
 
33
33
  ## What's in it
34
34
 
35
- - [API](https://github.com/Logomarks/brand-kit/blob/main/docs/api.md): the mark on light, dark and colour, favicons and a real `.ico`, outlined lockups, a 50–950 OKLCH palette with WCAG pairings, CSS and design tokens, `brand.json`, the brand sheet, and every part on its own
35
+ - [API](https://github.com/Logomarks/brand-kit/blob/main/docs/api.md): the mark on light, dark and colour, favicons and a real `.ico`, outlined lockups (tracking, capitals and an optional tagline line), a 50–950 OKLCH palette with WCAG pairings, CSS and design tokens, `brand.json`, the brand sheet, and every part on its own
36
36
  - [Platforms](https://github.com/Logomarks/brand-kit/blob/main/docs/platforms.md): the social pack's sizes and safe zones, with sources
37
37
  - [Seal, textures, finishes, swatches and the deck](https://github.com/Logomarks/brand-kit/blob/main/docs/identity.md): the round seal lockup, texture-collaged marks, letterpress, riso and stamp finishes, named swatch cards and the nine-slide guidelines deck with its PDF
38
38
  - [Styles and motion](https://github.com/Logomarks/brand-kit/blob/main/docs/styles.md): `minimal`, `bold`, `pattern` and `gradient`, and the animated SVGs
package/docs/api.md CHANGED
@@ -14,6 +14,9 @@ Everything is exported from `@logomarks/brand-kit`. A function that takes a bran
14
14
  | `font` | Inter 600 | A family covers already has (`'Inter'`), or `{ name, data \| src, weight, tracking, case, url, license }`: covers' `FontSource` plus `tracking` (em, default -0.02), `case` (`'none'`, `'uppercase'`, `'lowercase'`), and the `url` and `license` that `brand.json` and the sheet show. |
15
15
  | `source` | | Where the mark came from, `{ name, url, license }`: written to `brand.json` as `mark`. |
16
16
  | `tagline`, `url`, `handle` | | Shown on social images, the sheet, the email signature and the OG card. `handle` defaults to `@` plus the slug. |
17
+ | `tracking` | the font's | The name's letter-spacing in em/1000 (100 = 0.1 em), added between glyphs on top of kerning. |
18
+ | `caps` | the font's `case` | `true` sets the name in capitals. |
19
+ | `lockupTagline` | off | Puts the tagline under the name in every lockup: `true`, or `{ font, tracking, caps }` (default the brand's face, tracking 80, as typed). See [Type in the lockups](#type-in-the-lockups). |
17
20
 
18
21
  ## `brandKit(options)`
19
22
 
@@ -74,15 +77,16 @@ One of the styles on a canvas of your own (a business card, a poster, a sleeve,
74
77
 
75
78
  | Export | |
76
79
  |---|---|
77
- | `resolveBrand(input)` | The brand resolved: mark, palette, font, the name as outlines, `grounds`, `lockup(layout, colors)`. |
80
+ | `resolveBrand(input)` | The brand resolved: mark, palette, font, the name as outlines (`nameSet`, `nameType`), the lockups' tagline (`taglineSet`, `taglineType`, or null), `grounds`, `lockup(layout, colors)`. |
78
81
  | `faviconSet(brand, { small, rasterize })` | The favicon files, for a site's root. |
79
82
  | `markFiles`, `lockupFiles` | The mark's and lockups' files. |
80
83
  | `brandSheet(brand)` | `{ svg, png }`. |
81
84
  | `brandJson(brand, files)` | `brand.json`'s contents. |
82
85
  | `palette(hex)` | `{ primary, onPrimary, ink, paper, step, scale, text, mark, pairings, steps }`. The mark keeps the brand colour, or moves one scale step at most, where it clears 3:1 (4.5:1 when a step allows); otherwise it's ink or paper. Text clears 4.5:1. |
83
86
  | `paletteCss`, `paletteTailwind`, `paletteTokens` | The palette as files. |
84
- | `lockup({ mark, name, layout, markColor, textColor, ground, clear })` | `{ svg, body, width, height, mark }`. The name's cap height is 0.42 of the mark's height beside it and 0.3 under it, with a quarter of the mark's height clear all round. |
85
- | `typeset(text, font)` | The text as outlines at 100 px: `{ paths, box, cap }`. |
87
+ | `lockup({ mark, name, tagline, layout, markColor, textColor, taglineColor, ground, clear })` | `{ svg, body, width, height, mark }`. The name's cap height is 0.42 of the mark's height beside it and 0.3 under it, with a quarter of the mark's height clear all round; a tagline's is 0.4 of the name's. |
88
+ | `typeset(text, font, { tracking, caps })` | The text as outlines at 100 px: `{ paths, box, cap, text, tracking, missing }`. |
89
+ | `hasGlyph(ch, font)`, `missingGlyphs(text, font)` | Whether a face draws a character; the characters of a line it doesn't. |
86
90
  | `loadMark(svg)`, `markSvg`, `markAutoSvg`, `markTile`, `markBody`, `padForCircle` | The mark: fitted, painted, tiled, kept inside a circle. |
87
91
  | `ico(images)`, `readIco(bytes)` | Write and read a PNG-in-ICO file. |
88
92
  | `socialCover(brand, id, style, { animated })` | The covers cover options for one image, to inspect or tweak. |
@@ -99,6 +103,33 @@ One of the styles on a canvas of your own (a business card, a poster, a sleeve,
99
103
  | `toPng(svg, { width, height, rasterize })`, `pngSize(png)` | SVG to PNG; a PNG's size. |
100
104
  | `pngsToPdf(pngs, { width, height, title })`, `decodePng(png)` | PNGs as one PDF, a page each; a PNG's RGB pixels. |
101
105
 
106
+ ## Type in the lockups
107
+
108
+ The name is set by `typeset(text, font, { tracking, caps })`:
109
+
110
+ - **Tracking** is in em/1000, as design tools show it: `-40` tight, `0` as drawn, `400` wide. covers adds it between glyph clusters after kerning, so kerned pairs stay kerned and nothing trails the last letter. Without it, the face's `tracking` (em, default -0.02) is used.
111
+ - **Capitals:** `caps: true` uppercases the line before it's set (`caps: false` overrides a face's `case: 'uppercase'`).
112
+ - **Missing glyphs:** a character the face has no glyph for (Japanese in a Latin face, say) is left out rather than drawn as the face's empty box, and listed in `missing` so a host can say so. A separator left dangling at either end is trimmed ("Tokyo · 東京" sets "Tokyo"). A line with nothing left draws nothing. The brand's `tagline` (the sheet, the deck, the seal, social images) is cleaned the same way for the brand's face. covers' own symbols (★ ♥ ✦ …) still draw. The test is `hasGlyph(ch, font)`: the character's outline against the face's missing-glyph outline, cached per face.
113
+
114
+ With `lockupTagline`, every lockup gets a second line under the name:
115
+
116
+ ```js
117
+ const brand = await resolveBrand({
118
+ svg, name: 'Orvane', tagline: 'Tokyo', color: '#111111',
119
+ font: { name: 'Jost', data: jostLight, weight: 300 },
120
+ caps: true, tracking: 400, // M I S O N O
121
+ lockupTagline: { tracking: 300, caps: true }, // its own face, tracking and case; default the brand's face
122
+ });
123
+ brand.lockup('stacked', { markColor: '#111', textColor: '#111', taglineColor: '#666' });
124
+ ```
125
+
126
+ - **Proportions** (`LOCKUP.tagline`): the tagline's cap height is 0.4 of the name's, and the space from the name's baseline to the tagline's capitals is 0.55 of the name's cap height. A descender in the name pushes the tagline down so the space still shows under it.
127
+ - **Stacked:** the tagline is centred under the name; the lockup is as wide as the widest of the three.
128
+ - **Horizontal:** the two lines start together, and the block (the name's capitals to the tagline's baseline) is centred on the mark.
129
+ - **Colour:** `taglineColor`, default the text colour. `brand.lockup(layout, { tagline: false })` leaves it out of one lockup.
130
+ - **Everywhere else:** the clear space, the brand sheet, the guidelines deck (the typography slide lists the name's tracking and case and the tagline's type) and the social images use the same lockups; a social image whose lockup carries the tagline doesn't repeat it underneath. `brand.json` records `logo.name` and `logo.tagline`.
131
+ - Without `lockupTagline` (the default), lockups are byte-identical to 0.4.
132
+
102
133
  ## Rendering
103
134
 
104
135
  PNGs come from a host's `rasterize(svg, { width, height })` when one is given (the `logomarks` CLI passes resvg-wasm). Otherwise they come from sharp in Node, or a canvas in a browser through `@logomarks/image-effects/raster`. SVGs need neither.
@@ -19,7 +19,8 @@ Tests:
19
19
  - `finish.test.js` checks the finishes' files, seeding, that the stamp breaks up more ink than letterpress, and the gradient style's contrast band for 43 colours.
20
20
  - `seal.test.js` checks the circle maths, that nothing is drawn between the mark and the inner ring (in pixels), and determinism.
21
21
  - `swatches.test.js` checks unique names and 4.5:1 text on every swatch for 43 brand colours.
22
+ - `type.test.js` checks that tracking adds exactly the spacing between glyphs (kerning kept), capitals, missing glyphs left out and listed, the tagline's proportions and centring, colour, that lockups without one are unchanged, `brand.json` and no doubled social tagline.
22
23
  - `deck.test.js` checks nine 1920 × 1080 slides, determinism, the PDF's structure and xref, and PNG decoding.
23
24
  - `snapshots.test.js` compares PNGs of four Logomarks marks, as thumbnails with a small tolerance, since libvips versions anti-alias differently.
24
25
 
25
- The fixtures are six CC0 Logomarks marks and three OFL faces (`tests/fixtures/fonts/OFL.txt`).
26
+ The fixtures are six CC0 Logomarks marks and four OFL faces, Jost Light as a latin WOFF among them (`tests/fixtures/fonts/OFL.txt`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logomarks/brand-kit",
3
- "version": "0.4.1",
3
+ "version": "0.5.1",
4
4
  "description": "A complete brand kit from a logomark, a name, a colour and a typeface: the mark on light, dark and colour, favicons and a real .ico, outlined lockups and a round seal, a 50-950 OKLCH palette with WCAG pairings and named swatch cards, CSS and design tokens, brand.json, a brand sheet and a guidelines deck (PNG, SVG and PDF). Plus texture-collaged and letterpress, riso or stamp-printed marks, and a social pack at every platform's current sizes in four styles, with animated SVGs and seal avatars.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -15,8 +15,14 @@ export interface BrandInput {
15
15
  color?: string;
16
16
  /** The typeface: a family covers has (`'Inter'`, the default) or a font with its bytes or path. */
17
17
  font?: string | BrandFont;
18
- /** A line under the name on social images and the sheet. */
18
+ /** A line under the name on social images and the sheet (and in the lockups, with `lockupTagline`). */
19
19
  tagline?: string;
20
+ /** The name's letter-spacing in em/1000 (100 = 0.1 em). Default the font's `tracking`. */
21
+ tracking?: number;
22
+ /** Set the name in capitals. Default the font's `case`. */
23
+ caps?: boolean;
24
+ /** Put the tagline under the name in every lockup (and so the sheet, deck and social images): `true`, or its type. Default off. */
25
+ lockupTagline?: boolean | TaglineType;
20
26
  /** The website, for the email signature and the sheet. */
21
27
  url?: string;
22
28
  /** The social handle. Default `@` and the slug without hyphens. */
@@ -25,6 +31,23 @@ export interface BrandInput {
25
31
  source?: MarkSource;
26
32
  }
27
33
 
34
+ /** How the tagline is set in the lockups. */
35
+ export interface TaglineType {
36
+ /** Its face (default the brand's): a family covers has, or a font with its bytes, weight and so on. */
37
+ font?: string | BrandFont;
38
+ /** Letter-spacing in em/1000. Default 80. */
39
+ tracking?: number;
40
+ /** Set it in capitals. Default false. */
41
+ caps?: boolean;
42
+ }
43
+
44
+ /** The tagline's type, filled in. */
45
+ export interface ResolvedTaglineType {
46
+ font: ResolvedFont;
47
+ tracking: number;
48
+ caps: boolean;
49
+ }
50
+
28
51
  /** Where a brand's mark came from. */
29
52
  export interface MarkSource {
30
53
  /** The mark's name. */
@@ -49,6 +72,7 @@ export type Grounds = Record<'on-light' | 'on-dark' | 'on-color', Ground>;
49
72
  export interface Brand {
50
73
  name: string;
51
74
  slug: string;
75
+ /** The tagline, without any characters the brand's face can't draw. */
52
76
  tagline: string;
53
77
  url: string;
54
78
  handle: string;
@@ -57,16 +81,26 @@ export interface Brand {
57
81
  mark: Mark;
58
82
  palette: Palette;
59
83
  font: ResolvedFont;
60
- /** The name as outlines. */
84
+ /** The name as outlines (`missing` lists characters the face lacks). */
61
85
  nameSet: TypeSet;
86
+ /** How the name is set: tracking (em/1000) and capitals. */
87
+ nameType: { tracking: number; caps: boolean };
88
+ /** The lockups' tagline type, when `lockupTagline` and a tagline were given. */
89
+ taglineType: ResolvedTaglineType | null;
90
+ /** The lockups' tagline as outlines, when there is one (`missing` lists characters its face lacks; nothing drawn when it lacks them all). */
91
+ taglineSet: TypeSet | null;
62
92
  grounds: Grounds;
63
- /** A lockup in a layout and colours. */
64
- lockup(layout: LockupLayout, colors: Pick<LockupInput, 'markColor' | 'textColor' | 'ground' | 'clear'>): Lockup;
93
+ /** A lockup in a layout and colours; `tagline: false` leaves the tagline out. */
94
+ lockup(layout: LockupLayout, colors: Pick<LockupInput, 'markColor' | 'textColor' | 'taglineColor' | 'ground' | 'clear'> & { tagline?: boolean }): Lockup;
65
95
  }
66
96
 
67
97
  /** Logomarks' yellow. */
68
98
  export const DEFAULT_COLOR: '#d4ff3a';
69
99
  /** The three grounds and the logo's colours on each. */
70
100
  export function grounds(palette: Palette): Grounds;
101
+ /** The lockup tagline's defaults: tracking 80 (em/1000), as typed. */
102
+ export const TAGLINE_TYPE: Readonly<{ tracking: 80; caps: false }>;
103
+ /** The tagline's type, filled in (`true` for the defaults in the brand's face). */
104
+ export function taglineType(o: true | TaglineType, face: ResolvedFont): ResolvedTaglineType;
71
105
  /** A brand from its inputs (a resolved brand passes through). */
72
106
  export function resolveBrand(input: BrandInput | Brand): Promise<Brand>;
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { loadMark } from './mark.js';
10
10
  import { resolveFont } from './font.js';
11
- import { typeset } from './type.js';
11
+ import { typeset, missingGlyphs, withoutChars } from './type.js';
12
12
  import { palette as makePalette } from '../color/palette.js';
13
13
  import { lockup as makeLockup } from '../lockup/lockup.js';
14
14
  import { slugify } from '../util/files.js';
@@ -28,6 +28,21 @@ export const grounds = (p) => ({
28
28
  'on-color': { ground: p.primary, mark: p.onPrimary, text: p.onPrimary },
29
29
  });
30
30
 
31
+ /** How the tagline is set in the lockups when nothing says otherwise: the brand's face, tracked a little. */
32
+ export const TAGLINE_TYPE = Object.freeze({ tracking: 80, caps: false });
33
+
34
+ /**
35
+ * The tagline's type, filled in.
36
+ *
37
+ * @param {true | import('./brand.js').TaglineType} o - `true` for the defaults, or the face, tracking and case.
38
+ * @param {import('./font.js').ResolvedFont} face - The brand's face (the default).
39
+ * @returns {{ font: import('./font.js').ResolvedFont, tracking: number, caps: boolean }} The face, tracking (em/1000) and case.
40
+ */
41
+ export function taglineType(o, face) {
42
+ const t = o === true ? {} : o;
43
+ return { font: t.font ? resolveFont(t.font) : face, tracking: t.tracking ?? TAGLINE_TYPE.tracking, caps: t.caps ?? TAGLINE_TYPE.caps };
44
+ }
45
+
31
46
  /**
32
47
  * A brand, resolved.
33
48
  *
@@ -37,18 +52,24 @@ export const grounds = (p) => ({
37
52
  */
38
53
  export async function resolveBrand(input) {
39
54
  if (isBrand(input)) return input;
40
- const { svg, name, color = DEFAULT_COLOR, font, tagline = '', url = '', handle, source } = input;
55
+ const { svg, name, color = DEFAULT_COLOR, font, tagline = '', url = '', handle, source, tracking, caps, lockupTagline } = input;
41
56
  if (!svg) throw new TypeError('brand-kit: `svg` (the mark) is required');
42
57
  if (!name?.trim()) throw new TypeError('brand-kit: `name` is required');
43
58
  const face = resolveFont(font);
44
- const set = await typeset(name.trim(), face);
59
+ const set = await typeset(name.trim(), face, { tracking, caps });
60
+ // The tagline is set in the brand's face on the sheet, deck, seal and social images: drop what the face can't draw.
61
+ const lacks = tagline.trim() ? await missingGlyphs(tagline.trim(), face) : [];
62
+ const line = lacks.length ? withoutChars(tagline.trim(), lacks) : tagline;
63
+ const tt = lockupTagline && tagline.trim() ? taglineType(lockupTagline, face) : null;
64
+ const tagSet = tt ? await typeset(tagline.trim(), tt.font, { tracking: tt.tracking, caps: tt.caps }) : null;
45
65
  const mark = loadMark(svg);
46
66
  const palette = makePalette(color);
47
67
  const slug = slugify(name);
48
68
  return {
49
- name: name.trim(), slug, tagline, url, handle: handle ?? `@${slug.replace(/-/g, '')}`, ...(source && { source }),
69
+ name: name.trim(), slug, tagline: line, url, handle: handle ?? `@${slug.replace(/-/g, '')}`, ...(source && { source }),
50
70
  mark, palette, font: face, nameSet: set, grounds: grounds(palette),
51
- lockup: (layout, colors) => makeLockup({ mark, name: set, layout, ...colors }),
71
+ nameType: { tracking: set.tracking, caps: caps ?? face.case === 'uppercase' }, taglineType: tt, taglineSet: tagSet,
72
+ lockup: (layout, { tagline: withTagline = true, ...colors }) => makeLockup({ mark, name: set, tagline: withTagline ? tagSet : null, layout, ...colors }),
52
73
  };
53
74
  }
54
75
 
@@ -13,14 +13,34 @@ export interface Box {
13
13
  export interface TypeSet {
14
14
  /** Glyph paths with no fill (set one on a parent). */
15
15
  paths: string;
16
- /** The ink box, relative to the pen's start on the baseline. */
16
+ /** The ink box, relative to the pen's start on the baseline (all zero width when nothing was drawn). */
17
17
  box: Box;
18
18
  /** The face's cap height at {@link SIZE}. */
19
19
  cap: number;
20
+ /** The text as set: in its case, without the characters the face lacks. */
21
+ text: string;
22
+ /** The tracking it was set with, em/1000. */
23
+ tracking: number;
24
+ /** Characters the face has no glyph for, each once, in order. They're left out (never drawn as boxes). */
25
+ missing: string[];
26
+ }
27
+
28
+ /** How a line is set. */
29
+ export interface TypesetOptions {
30
+ /** Letter-spacing in em/1000 (100 = 0.1 em), added between glyphs on top of kerning. Default the face's `tracking`. */
31
+ tracking?: number;
32
+ /** `true` sets the line in capitals, `false` as typed. Default the face's `case`. */
33
+ caps?: boolean;
20
34
  }
21
35
 
22
36
  /** The size lines are set at: 100. */
23
37
  export const SIZE: 100;
24
38
 
25
- /** A line of text as outlines (covers shapes it). */
26
- export function typeset(text: string, font: ResolvedFont): Promise<TypeSet>;
39
+ /** A line of text as outlines (covers shapes it, kerned and tracked); characters the face lacks are left out and listed. */
40
+ export function typeset(text: string, font: ResolvedFont, options?: TypesetOptions): Promise<TypeSet>;
41
+ /** A line without some characters: spaces collapsed, a separator left dangling at either end trimmed. */
42
+ export function withoutChars(text: string, chars: string[]): string;
43
+ /** Whether a face draws a character (white space always counts). Cached per face. */
44
+ export function hasGlyph(ch: string, font: ResolvedFont): Promise<boolean>;
45
+ /** The characters of a line a face has no glyph for, each once, in order. */
46
+ export function missingGlyphs(text: string, font: ResolvedFont): Promise<string[]>;
package/src/brand/type.js CHANGED
@@ -1,7 +1,10 @@
1
1
  /**
2
2
  * A line of text as outlines, so no file the kit writes needs a font.
3
- * covers shapes it (HarfBuzz, kerning and all) on a scratch canvas; the
4
- * glyph paths are taken from its SVG and measured with marks-kit.
3
+ * covers shapes it (kerning and all) on a scratch canvas; the glyph paths
4
+ * are taken from its SVG and measured with marks-kit. Tracking is added
5
+ * between glyphs on top of the kerning; capitals are applied before the
6
+ * line is set; characters the face has no glyph for are left out (and
7
+ * listed), so a line never shows a font's empty-box glyph.
5
8
  *
6
9
  * @module brand/type
7
10
  */
@@ -15,43 +18,134 @@ export const SIZE = 100;
15
18
  /** Where the baseline sits on the scratch canvas. */
16
19
  const BASELINE = SIZE * 2;
17
20
 
21
+ /** A private-use character no face draws: how a missing glyph looks in a face. */
22
+ const NOTDEF = '';
23
+
18
24
  /** Cap heights by face, measured once. @type {Map<string, Promise<number>>} */
19
25
  const caps = new Map();
20
26
 
27
+ /** Each face's drawing of characters, by face, then character (joined path data). @type {Map<string, Map<string, Promise<string>>>} */
28
+ const glyphs = new Map();
29
+
30
+ /**
31
+ * A face's cache key.
32
+ *
33
+ * @param {import('./font.js').ResolvedFont} font - The face.
34
+ * @returns {string} Its name and weight.
35
+ */
36
+ const faceKey = (font) => `${font.name}/${font.weight}`;
37
+
21
38
  /**
22
39
  * Text drawn by covers, as path data in scratch-canvas coordinates.
23
40
  *
24
- * @param {string} text - The line.
41
+ * @param {string} text - The line, already in its case.
25
42
  * @param {import('./font.js').ResolvedFont} font - The face.
26
- * @param {string} [transform] - `'uppercase'` or `'lowercase'`.
43
+ * @param {number} [tracking=0] - Letter-spacing, em.
27
44
  * @returns {Promise<string[]>} Each glyph run's path data.
28
45
  */
29
- async function draw(text, font, transform) {
46
+ async function draw(text, font, tracking = 0) {
47
+ const chars = Array.from(text).length;
30
48
  const svg = await renderSvg({
31
- width: Math.ceil(SIZE * (text.length + 4)),
49
+ width: Math.ceil(SIZE * (chars * (1.4 + Math.max(0, tracking)) + 4)),
32
50
  height: SIZE * 4,
33
51
  fonts: font.sources,
34
52
  palette: ['#ffffff', '#000000'],
35
- layers: [{ type: 'text', content: text, font: font.name, weight: font.weight, size: SIZE, x: 0, y: BASELINE, letterSpacing: font.tracking, color: '#000000', ...(transform && { transform }) }],
53
+ layers: [{ type: 'text', content: text, font: font.name, weight: font.weight, size: SIZE, x: 0, y: BASELINE, letterSpacing: tracking, color: '#000000' }],
36
54
  });
37
55
  return [...svg.matchAll(/<path\b[^>]*\sd="([^"]+)"/g)].map((m) => m[1]);
38
56
  }
39
57
 
58
+ /**
59
+ * One character as the face draws it alone, cached.
60
+ *
61
+ * @param {string} ch - A character.
62
+ * @param {import('./font.js').ResolvedFont} font - The face.
63
+ * @returns {Promise<string>} Its path data, joined.
64
+ */
65
+ function glyphOf(ch, font) {
66
+ const key = faceKey(font);
67
+ if (!glyphs.has(key)) glyphs.set(key, new Map());
68
+ const seen = /** @type {Map<string, Promise<string>>} */ (glyphs.get(key));
69
+ if (!seen.has(ch)) seen.set(ch, draw(ch, font).then((d) => d.join(' ')));
70
+ return /** @type {Promise<string>} */ (seen.get(ch));
71
+ }
72
+
73
+ /**
74
+ * Whether a face draws a character: its outline differs from the face's
75
+ * missing-glyph box. White space always counts as drawn.
76
+ *
77
+ * @param {string} ch - One character (a code point).
78
+ * @param {import('./font.js').ResolvedFont} font - The face.
79
+ * @returns {Promise<boolean>} True when the face has it.
80
+ */
81
+ export async function hasGlyph(ch, font) {
82
+ if (/\s/u.test(ch)) return true;
83
+ const [d, box] = await Promise.all([glyphOf(ch, font), glyphOf(NOTDEF, font)]);
84
+ return d !== box;
85
+ }
86
+
87
+ /**
88
+ * The characters of a line a face has no glyph for, each once, in order.
89
+ *
90
+ * @param {string} text - The line.
91
+ * @param {import('./font.js').ResolvedFont} font - The face.
92
+ * @returns {Promise<string[]>} The missing characters (empty when the face covers the line).
93
+ */
94
+ export async function missingGlyphs(text, font) {
95
+ const chars = [...new Set(Array.from(text))];
96
+ const has = await Promise.all(chars.map((c) => hasGlyph(c, font)));
97
+ return chars.filter((_, i) => !has[i]);
98
+ }
99
+
100
+ /**
101
+ * A line in its case: capitals when asked, else the face's case.
102
+ *
103
+ * @param {string} text - The line.
104
+ * @param {boolean | undefined} upper - True for capitals, false for as typed, undefined for the face's case.
105
+ * @param {import('./font.js').ResolvedFont['case']} kase - The face's case.
106
+ * @returns {string} The line.
107
+ */
108
+ const inCase = (text, upper, kase) => {
109
+ const k = upper === true ? 'uppercase' : upper === false ? 'none' : kase;
110
+ return k === 'uppercase' ? text.toUpperCase() : k === 'lowercase' ? text.toLowerCase() : text;
111
+ };
112
+
113
+ /** Separators that mean nothing once what they separated is gone: a line's ends are trimmed of them. */
114
+ const LOOSE = /^[\s·•|/,;:–—-]+|[\s·•|/,;:–—-]+$/gu;
115
+
116
+ /**
117
+ * A line without the characters a face lacks: spaces collapsed, and no
118
+ * separator left dangling at either end ("Tokyo · 東京" → "Tokyo").
119
+ *
120
+ * @param {string} text - The line.
121
+ * @param {string[]} missing - The characters to leave out.
122
+ * @returns {string} What's left to draw.
123
+ */
124
+ export const withoutChars = (text, missing) => Array.from(text).filter((c) => !missing.includes(c)).join('').replace(/\s+/g, ' ').replace(LOOSE, '');
125
+
40
126
  /**
41
127
  * A line of text as outlines at {@link SIZE}, its baseline on y = 0.
42
128
  *
43
129
  * @param {string} text - The line.
44
130
  * @param {import('./font.js').ResolvedFont} font - The face.
45
- * @returns {Promise<import('./type.js').TypeSet>} The paths (no fill), the ink box and the face's cap height.
131
+ * @param {import('./type.js').TypesetOptions} [o] - Tracking (em/1000; default the face's) and capitals (default the face's case).
132
+ * @returns {Promise<import('./type.js').TypeSet>} The paths (no fill), the ink box, the face's cap height, what was set and any characters left out.
46
133
  */
47
- export async function typeset(text, font) {
48
- const key = `${font.name}/${font.weight}`;
134
+ export async function typeset(text, font, { tracking, caps: upper } = {}) {
135
+ const key = faceKey(font);
49
136
  if (!caps.has(key)) caps.set(key, draw('H', font).then((d) => bounds(d.flatMap((p) => shapes(`<path d="${p}"/>`))).h || SIZE * 0.7));
50
- const ds = await draw(text, font, font.case === 'none' ? undefined : font.case);
137
+ const cased = inCase(text, upper, font.case);
138
+ const missing = await missingGlyphs(cased, font);
139
+ const drawn = missing.length ? withoutChars(cased, missing) : cased;
140
+ const em = tracking === undefined ? font.tracking : tracking / 1000;
141
+ const ds = drawn ? await draw(drawn, font, em) : [];
51
142
  const box = ds.length ? bounds(ds.flatMap((p) => shapes(`<path d="${p}"/>`))) : { x: 0, y: BASELINE, w: 0, h: 0 };
52
143
  return {
53
144
  paths: `<g transform="translate(0 -${BASELINE})">${ds.map((d) => `<path d="${d}"/>`).join('')}</g>`,
54
145
  box: { x: box.x, y: box.y - BASELINE, w: box.w, h: box.h },
55
146
  cap: await /** @type {Promise<number>} */ (caps.get(key)),
147
+ text: drawn,
148
+ tracking: Math.round(em * 1000),
149
+ missing,
56
150
  };
57
151
  }
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Typography: the face's name, a line set in it, the name huge, and the
3
- * alphabet, with how the brand sets it.
3
+ * alphabet, with how the brand sets the name (tracking, case) and the
4
+ * lockup's tagline.
4
5
  *
5
6
  * @module deck/slides/type
6
7
  */
@@ -17,14 +18,18 @@ export const type = {
17
18
  const line1 = brand.tagline || `${brand.name}, set in ${f.name}.`;
18
19
  page.text(M, 230, `${f.name} · ${f.weight}`, { size: 22 });
19
20
  page.text(M, 300, line1, display(brand, 54, p.ink, { maxWidth: 1180 }));
20
- page.text(M - 8, 640, brand.name, display(brand, 250, p.ink, { letterSpacing: f.tracking - 0.01, maxWidth: W - 2 * M, maxLines: 1, minSize: 120 }));
21
+ const nt = brand.nameType, tt = brand.taglineType;
22
+ page.text(M - 8, 640, brand.nameSet.text || brand.name, display(brand, 250, p.ink, { letterSpacing: nt.tracking / 1000 - 0.01, maxWidth: W - 2 * M, maxLines: 1, minSize: 120 }));
21
23
  page.rect(M, 740, W - 2 * M, 1, line);
22
24
  const set = { ...display(brand, 32, p.ink), letterSpacing: 0.02 };
23
25
  page.text(M, 812, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', set);
24
26
  page.text(M, 862, 'abcdefghijklmnopqrstuvwxyz', set);
25
27
  page.text(M, 912, '0123456789 &@?!%€£$', set);
26
28
  const sx = 1260;
27
- for (const [i, [k, v]] of [['Weight', String(f.weight)], ['Tracking', `${Math.round(f.tracking * 1000)} (em/1000)`], ['Case', f.case === 'none' ? 'As written' : f.case], ['Licence', f.license], ['Labels', 'Inter, tracked capitals']].entries()) {
29
+ const rows = [['Weight', String(f.weight)], ['Tracking', `${nt.tracking} (em/1000)`], ['Case', nt.caps ? 'Capitals' : f.case === 'none' ? 'As written' : f.case], ['Licence', f.license]];
30
+ if (tt && brand.taglineSet?.box.w) rows.push(['Tagline', `${tt.font.name} ${tt.font.weight}, tracking ${tt.tracking}${tt.caps ? ', capitals' : ''}`]);
31
+ rows.push(['Labels', 'Inter, tracked capitals']);
32
+ for (const [i, [k, v]] of rows.entries()) {
28
33
  page.label(sx, 790 + i * 34, k, quiet);
29
34
  page.text(sx + 160, 790 + i * 34, v, { size: 17, color: p.ink });
30
35
  }
package/src/index.d.ts CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  export { brandKit } from './kit/index.js';
4
4
  export { socialPack, ANIMATED_KINDS } from './social/index.js';
5
- export { resolveBrand, grounds, DEFAULT_COLOR } from './brand/brand.js';
5
+ export { resolveBrand, grounds, taglineType, DEFAULT_COLOR, TAGLINE_TYPE } from './brand/brand.js';
6
6
  export { loadMark, markBody, markSvg, markAutoSvg, markTile, tileSvg, padForCircle } from './brand/mark.js';
7
7
  export { resolveFont, DEFAULT_FONT } from './brand/font.js';
8
- export { typeset } from './brand/type.js';
8
+ export { typeset, hasGlyph, missingGlyphs, withoutChars } from './brand/type.js';
9
9
  export { lockup, LOCKUP, LAYOUTS } from './lockup/lockup.js';
10
10
  export { sealLockup, sealOn, sealGeometry, SEAL, SEAL_DETAIL, SEAL_PRINT, SEPARATORS } from './lockup/seal.js';
11
11
  export { palette, pairing } from './color/palette.js';
@@ -38,10 +38,10 @@ export { VERSION } from './version.js';
38
38
 
39
39
  export type { BrandKitOptions, BrandKit } from './kit/index.js';
40
40
  export type { SocialOptions, SocialPack } from './social/index.js';
41
- export type { BrandInput, Brand, Ground, Grounds, MarkSource } from './brand/brand.js';
41
+ export type { BrandInput, Brand, Ground, Grounds, MarkSource, TaglineType, ResolvedTaglineType } from './brand/brand.js';
42
42
  export type { Mark, TileOptions } from './brand/mark.js';
43
43
  export type { BrandFont, ResolvedFont } from './brand/font.js';
44
- export type { TypeSet, Box } from './brand/type.js';
44
+ export type { TypeSet, TypesetOptions, Box } from './brand/type.js';
45
45
  export type { Lockup, LockupInput, LockupLayout } from './lockup/lockup.js';
46
46
  export type { Seal, SealOptions, SealGeometry } from './lockup/seal.js';
47
47
  export type { Palette, Pairing } from './color/palette.js';
package/src/index.js CHANGED
@@ -7,10 +7,10 @@
7
7
 
8
8
  export { brandKit } from './kit/index.js';
9
9
  export { socialPack, ANIMATED_KINDS } from './social/index.js';
10
- export { resolveBrand, grounds, DEFAULT_COLOR } from './brand/brand.js';
10
+ export { resolveBrand, grounds, taglineType, DEFAULT_COLOR, TAGLINE_TYPE } from './brand/brand.js';
11
11
  export { loadMark, markBody, markSvg, markAutoSvg, markTile, tileSvg, padForCircle } from './brand/mark.js';
12
12
  export { resolveFont, DEFAULT_FONT } from './brand/font.js';
13
- export { typeset } from './brand/type.js';
13
+ export { typeset, hasGlyph, missingGlyphs, withoutChars } from './brand/type.js';
14
14
  export { lockup, LOCKUP, LAYOUTS } from './lockup/lockup.js';
15
15
  export { sealLockup, sealOn, sealGeometry, SEAL, SEAL_DETAIL, SEAL_PRINT, SEPARATORS } from './lockup/seal.js';
16
16
  export { palette, pairing } from './color/palette.js';
@@ -16,7 +16,15 @@ export interface BrandJson {
16
16
  /** The palette, and its named swatches light to dark. */
17
17
  colors: Pick<Palette, 'primary' | 'onPrimary' | 'ink' | 'paper' | 'step' | 'scale' | 'text' | 'mark' | 'pairings'> & { swatches: Pick<Swatch, 'role' | 'name' | 'hex'>[] };
18
18
  font: Omit<ResolvedFont, 'sources'>;
19
- logo: { layouts: string[]; clearSpace: string; minimum: { screen: string; print: string; withName: string } };
19
+ logo: {
20
+ layouts: string[];
21
+ clearSpace: string;
22
+ minimum: { screen: string; print: string; withName: string };
23
+ /** How the name is set: tracking (em/1000) and capitals. */
24
+ name: { tracking: number; caps: boolean };
25
+ /** The tagline in the lockups, when there is one: the text as set, and its type. */
26
+ tagline?: { text: string; font: string; weight: number; tracking: number; caps: boolean };
27
+ };
20
28
  /** The `<head>` tags for the favicons. */
21
29
  head: string;
22
30
  /** Every file in the kit, `brand.json` included. */
@@ -33,6 +33,8 @@ export function brandJson(brand, files) {
33
33
  layouts: ['horizontal', 'stacked', 'mark', 'seal'],
34
34
  clearSpace: `${LOCKUP.clear} × the mark's height on every side`,
35
35
  minimum: { screen: '16px', print: '8mm', withName: '24px' },
36
+ name: { tracking: brand.nameType.tracking, caps: brand.nameType.caps },
37
+ ...(brand.taglineType && brand.taglineSet?.box.w && { tagline: { text: brand.taglineSet.text, font: brand.taglineType.font.name, weight: brand.taglineType.font.weight, tracking: brand.taglineType.tracking, caps: brand.taglineType.caps } }),
36
38
  },
37
39
  head: HEAD_HTML,
38
40
  files,
@@ -10,11 +10,15 @@ export interface LockupInput {
10
10
  mark: Mark;
11
11
  /** The name as outlines (from `typeset`); none for the mark alone. */
12
12
  name?: TypeSet | null;
13
+ /** A smaller second line under the name (from `typeset`), its cap height {@link LOCKUP}`.tagline.cap` of the name's. */
14
+ tagline?: TypeSet | null;
13
15
  /** Default `'horizontal'`. */
14
16
  layout?: LockupLayout;
15
17
  markColor: string;
16
18
  /** Default the mark's colour. */
17
19
  textColor?: string;
20
+ /** Default the text colour. */
21
+ taglineColor?: string;
18
22
  /** A ground under it (none: transparent). */
19
23
  ground?: string;
20
24
  /** Clear space all round, as a share of the mark's height. Default 0.25. */
@@ -34,8 +38,18 @@ export interface Lockup {
34
38
  }
35
39
 
36
40
  /** Proportions, as shares of the mark's drawn height (200 units). */
37
- export const LOCKUP: Readonly<{ mark: 200; wide: 1.5; cap: Readonly<{ horizontal: number; stacked: number }>; gap: Readonly<{ horizontal: number; stacked: number }>; clear: number }>;
41
+ export const LOCKUP: Readonly<{
42
+ mark: 200;
43
+ wide: 1.5;
44
+ /** The name's cap height, beside the mark and under it. */
45
+ cap: Readonly<{ horizontal: number; stacked: number }>;
46
+ /** The space between mark and name. */
47
+ gap: Readonly<{ horizontal: number; stacked: number }>;
48
+ /** The tagline's cap height, and the space from the name's baseline to its capitals, as shares of the name's cap height. */
49
+ tagline: Readonly<{ cap: number; gap: number }>;
50
+ clear: number;
51
+ }>;
38
52
  /** The layouts. */
39
53
  export const LAYOUTS: readonly ['horizontal', 'stacked', 'mark'];
40
- /** A lockup: the name's cap height a set share of the mark's, clear space a quarter of it. */
54
+ /** A lockup: the name's cap height a set share of the mark's (a tagline under it, smaller), clear space a quarter of it. */
41
55
  export function lockup(input: LockupInput): Lockup;
@@ -1,9 +1,11 @@
1
1
  /**
2
2
  * The mark and the name together: side by side (`horizontal`), the name
3
- * under the mark (`stacked`), or the mark alone (`mark`). Laid out on the
4
- * ink, not the canvas, so every mark sits the same way: the name's cap
5
- * height a set share of the mark's height and centred on it, a quarter of
6
- * the mark's height clear all round. The name is outlines.
3
+ * under the mark (`stacked`), or the mark alone (`mark`), with an optional
4
+ * tagline as a smaller second line under the name. Laid out on the ink,
5
+ * not the canvas, so every mark sits the same way: the name's cap height a
6
+ * set share of the mark's height and centred on it (with a tagline, the
7
+ * two lines centred as one block), a quarter of the mark's height clear
8
+ * all round. The words are outlines.
7
9
  *
8
10
  * @module lockup/lockup
9
11
  */
@@ -11,7 +13,7 @@
11
13
  import { num } from '@logomarks/image-effects/svg';
12
14
  import { markBody } from '../brand/mark.js';
13
15
 
14
- /** Proportions, as shares of the mark's drawn height. */
16
+ /** Proportions, as shares of the mark's drawn height (the tagline's, of the name's cap height). */
15
17
  export const LOCKUP = Object.freeze({
16
18
  /** The mark's drawn height, in the lockup's units. */
17
19
  mark: 200,
@@ -21,6 +23,8 @@ export const LOCKUP = Object.freeze({
21
23
  cap: Object.freeze({ horizontal: 0.42, stacked: 0.3 }),
22
24
  /** The space between mark and name: beside, under. */
23
25
  gap: Object.freeze({ horizontal: 0.3, stacked: 0.24 }),
26
+ /** The tagline: its cap height, and the space from the name's baseline to its capitals' tops, as shares of the name's cap height. */
27
+ tagline: Object.freeze({ cap: 0.4, gap: 0.55 }),
24
28
  /** Clear space all round. */
25
29
  clear: 0.25,
26
30
  });
@@ -28,42 +32,76 @@ export const LOCKUP = Object.freeze({
28
32
  /** The layouts. */
29
33
  export const LAYOUTS = Object.freeze(/** @type {const} */ (['horizontal', 'stacked', 'mark']));
30
34
 
35
+ /**
36
+ * Whether a set line has any ink.
37
+ *
38
+ * @param {import('../brand/type.js').TypeSet | null | undefined} t - A set line.
39
+ * @returns {t is import('../brand/type.js').TypeSet} True when there's something to draw.
40
+ */
41
+ const inked = (t) => Boolean(t && t.box.w > 0);
42
+
43
+ /**
44
+ * The words' block: the name and, when there is one, the tagline under it,
45
+ * at their sizes, with the tagline's baseline relative to the name's.
46
+ *
47
+ * @param {import('../brand/type.js').TypeSet} name - The name.
48
+ * @param {import('../brand/type.js').TypeSet | null} tagline - The tagline, or none.
49
+ * @param {number} cap - The name's cap height in the lockup's units.
50
+ * @returns {{ s: number, ts: number, below: number, top: number, bottom: number, depth: number }} The scales, the tagline baseline's drop from the name's, the block's ink above the name's baseline and below it, and the cap-top-to-last-baseline depth the block is centred by.
51
+ */
52
+ function wordBlock(name, tagline, cap) {
53
+ const s = cap / name.cap;
54
+ const nameTop = -name.box.y * s, nameBottom = (name.box.y + name.box.h) * s;
55
+ if (!tagline) return { s, ts: 0, below: 0, top: nameTop, bottom: nameBottom, depth: cap };
56
+ const tcap = LOCKUP.tagline.cap * cap, ts = tcap / tagline.cap, gap = LOCKUP.tagline.gap * cap;
57
+ // The gap runs from the name's baseline; a descender pushes the tagline down so the gap still shows under it.
58
+ const clearOf = Math.max(gap, nameBottom + gap * 0.45);
59
+ const below = clearOf + tcap;
60
+ const tagBottom = below + (tagline.box.y + tagline.box.h) * ts, tagTop = below + tagline.box.y * ts;
61
+ return { s, ts, below, top: Math.max(nameTop, -tagTop), bottom: Math.max(nameBottom, tagBottom), depth: cap + below };
62
+ }
63
+
31
64
  /**
32
65
  * A lockup.
33
66
  *
34
- * @param {import('./lockup.js').LockupInput} o - The mark, the name set as outlines, the layout and colours.
67
+ * @param {import('./lockup.js').LockupInput} o - The mark, the name (and tagline) set as outlines, the layout and colours.
35
68
  * @returns {import('./lockup.js').Lockup} The SVG, its inner markup, its size and where the mark sits.
36
69
  */
37
- export function lockup({ mark, name, layout = 'horizontal', markColor, textColor = markColor, ground, clear = LOCKUP.clear }) {
70
+ export function lockup({ mark, name, tagline, layout = 'horizontal', markColor, textColor = markColor, taglineColor = textColor, ground, clear = LOCKUP.clear }) {
38
71
  const ink = mark.box;
39
72
  const H = LOCKUP.mark;
40
73
  const k = H / Math.max(ink.h, ink.w / LOCKUP.wide);
41
74
  const mw = ink.w * k, mh = ink.h * k;
42
75
  /** @param {number} x @param {number} y */
43
76
  const placeMark = (x, y) => `<g transform="translate(${num(x - ink.x * k, 3)} ${num(y - ink.y * k, 3)}) scale(${num(k, 5)})">${markBody(mark, markColor)}</g>`;
77
+ /** @param {import('../brand/type.js').TypeSet} t @param {number} sc @param {string} fill @param {number} x @param {number} y - The pen's start on the baseline. */
78
+ const placeLine = (t, sc, fill, x, y) => `<g transform="translate(${num(x, 3)} ${num(y, 3)}) scale(${num(sc, 5)})" fill="${fill}">${t.paths}</g>`;
44
79
  let parts, box, markAt;
45
- if (layout === 'mark' || !name || !name.box.w) {
80
+ if (layout === 'mark' || !inked(name)) {
46
81
  parts = placeMark(0, 0);
47
82
  box = { x: 0, y: 0, w: mw, h: mh };
48
83
  markAt = { x: 0, y: 0, w: mw, h: mh };
49
84
  } else {
50
85
  const L = layout === 'stacked' ? 'stacked' : 'horizontal';
51
- const s = (LOCKUP.cap[L] * H) / name.cap;
52
- const tw = name.box.w * s, th = name.box.h * s;
53
- /** @param {number} x @param {number} y - The pen's start on the baseline. */
54
- const placeName = (x, y) => `<g transform="translate(${num(x, 3)} ${num(y, 3)}) scale(${num(s, 5)})" fill="${textColor}">${name.paths}</g>`;
86
+ const tag = inked(tagline) ? tagline : null;
87
+ const cap = LOCKUP.cap[L] * H;
88
+ const b = wordBlock(name, tag, cap);
89
+ const tw = name.box.w * b.s, gw = tag ? tag.box.w * b.ts : 0;
55
90
  if (L === 'horizontal') {
56
- const baseline = mh / 2 + (name.cap * s) / 2;
57
- const x = mw + LOCKUP.gap.horizontal * H - name.box.x * s;
58
- parts = placeMark(0, 0) + placeName(x, baseline);
59
- const top = Math.min(0, baseline + name.box.y * s), bottom = Math.max(mh, baseline + name.box.y * s + th);
60
- box = { x: 0, y: top, w: mw + LOCKUP.gap.horizontal * H + tw, h: bottom - top };
91
+ // The block (the name's cap top to the last baseline) centred on the mark; the lines start together.
92
+ const baseline = mh / 2 - b.depth / 2 + cap;
93
+ const x = mw + LOCKUP.gap.horizontal * H;
94
+ parts = placeMark(0, 0) + placeLine(name, b.s, textColor, x - name.box.x * b.s, baseline);
95
+ if (tag) parts += placeLine(tag, b.ts, taglineColor, x - tag.box.x * b.ts, baseline + b.below);
96
+ const top = Math.min(0, baseline - b.top), bottom = Math.max(mh, baseline + b.bottom);
97
+ box = { x: 0, y: top, w: x + Math.max(tw, gw), h: bottom - top };
61
98
  markAt = { x: 0, y: 0, w: mw, h: mh };
62
99
  } else {
63
- const w = Math.max(mw, tw);
64
- const baseline = mh + LOCKUP.gap.stacked * H + name.cap * s;
65
- parts = placeMark((w - mw) / 2, 0) + placeName((w - tw) / 2 - name.box.x * s, baseline);
66
- box = { x: 0, y: 0, w, h: baseline + name.box.y * s + th };
100
+ const w = Math.max(mw, tw, gw);
101
+ const baseline = mh + LOCKUP.gap.stacked * H + cap;
102
+ parts = placeMark((w - mw) / 2, 0) + placeLine(name, b.s, textColor, (w - tw) / 2 - name.box.x * b.s, baseline);
103
+ if (tag) parts += placeLine(tag, b.ts, taglineColor, (w - gw) / 2 - tag.box.x * b.ts, baseline + b.below);
104
+ box = { x: 0, y: 0, w, h: baseline + b.bottom };
67
105
  markAt = { x: (w - mw) / 2, y: 0, w: mw, h: mh };
68
106
  }
69
107
  }
@@ -78,7 +78,7 @@ export const logoLayer = (logo, extra = {}) => ({
78
78
  * The words with a logo, as a covers `text` layer: on a thumbnail, the
79
79
  * headline (the tagline, else the name) large in the safe zone's bottom
80
80
  * left; elsewhere the tagline under the logo in the brand's face,
81
- * capitals, tracked out.
81
+ * capitals, tracked out (unless the lockup carries it).
82
82
  *
83
83
  * @param {import('../brand/brand.js').Brand} brand - The brand.
84
84
  * @param {import('./platforms.js').PlatformSpec} spec - The image.
@@ -96,7 +96,8 @@ export function taglineLayer(brand, spec, logo, color) {
96
96
  area: { x: safe.x / spec.width, y: safe.y / spec.height, width: safe.w / spec.width, height: (safe.h * 0.98) / spec.height },
97
97
  };
98
98
  }
99
- if (!brand.tagline || MARK_ONLY.has(spec.kind)) return null;
99
+ // A tagline already in the lockup isn't repeated under it.
100
+ if (!brand.tagline || MARK_ONLY.has(spec.kind) || brand.taglineSet?.box.w) return null;
100
101
  const size = Math.max(14, Math.round(Math.min(safe.h * 0.08, logo.box.h * (logo.layout === 'stacked' ? 0.085 : 0.2))));
101
102
  const y = logo.box.y + logo.box.h + size * 2.6;
102
103
  if (y > safe.y + safe.h) return null;
package/src/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /** This library's version, written into `brand.json`. */
2
- export const VERSION = '0.4.1';
2
+ export const VERSION = '0.5.1';