@logomarks/generate 0.5.0 → 0.6.0

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
@@ -1,6 +1,48 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+
5
+ ## 0.6.0 (2026-11-28)
6
+
7
+ Contrast monograms, after the owner's idea of initials treated unlike on purpose (one boxed, one open; each in a ring;
8
+ a sans beside a serif; a letter turned and locked into the other). Five recipes (65 in all), a page maker, and bans.
9
+
10
+ - **`duo`** (Duo): two (or three) initials in unlike treatments: `boxed` (a letter knocked out of a box beside an open
11
+ one), `rings` (each in a circle, apart or overlapping; round letters take rounded squares, two O's in rings being a
12
+ pair of eyes), `cells` (one container split by the gap, a cell filled with its letter knocked out, the next open) and
13
+ `turned` (one or both letters turned a quarter or half turn or mirrored, drawn extended, and nested by a raster search
14
+ so their strokes lock together a gap apart, after the owner's turned F and P). Each side has a build (`sans`, `serif`,
15
+ `blackletter` from core, or the Letter recipe's stencil, route, cut, wedge, blocks, rails, tiles) and a treatment
16
+ (`solid`, `knockout`, `outline`); a knocked-out letter is always a heavy build. The container control is `box` (the
17
+ finish already has a `container`).
18
+ - **`crossover`** (Crossover): A solid running into B's block, ink outside it and cut out inside; the block's edge
19
+ moves until 68% of A's ink is outside, so no stroke is lost to the gap.
20
+ - **`tucked`** (Tucked): a big letter with one or two small ones boxed at its corner.
21
+ - **`clash`** (Type Clash): the letters side by side in unlike builds, apart or interlocked (eased back until the later
22
+ letter keeps 90% of its ink; a T or an I never interlocks).
23
+ - **`splitchar`** (Split Letter): one character cut upright, level or diagonally, the second half cut out of its box or
24
+ drawn in another build (an H never in a disc, a P never in a square). A letter of slanted strokes (A, V, W, Y, K, X,
25
+ M, N, 4) is never split upright: the half body and the slanted stroke running out of it read as a pistol.
26
+ - **`monograms(initials, { count, seed })`**: a page of them from typed initials (upper-cased, A–Z and 0–9 kept, at most
27
+ three): every way of contrasting tried a few times (`monogramPlans()`), failed draws and near-twins dropped, ranked by
28
+ `qualityOf`, no way allowed to crowd the page, the order alternating them. `initialsOf()` cleans the input.
29
+ Three initials keep only marks scoring 0.6 or more (the pair layouts squeezed to three look cramped), so their page
30
+ is shorter and mostly Tucked, which is tried more often for them.
31
+ - **Bans:** `BLOCKED`/`blocked()`: other companies' monogram logos (LV, CC, GG, DG, YSL, VW, HP, GE, MK, CK, HM, DC, NY,
32
+ LA, IBM, BMW, KFC) and hate codes (SS, HH, KKK, 88) draw nothing. `BECOMES`/`safeTurn()`: a turn that makes a letter
33
+ another letter (M↔W, N↔Z, 6↔9, L↔7; A, V, Y on their side are arrowheads, a J upside down a padlock's shackle)
34
+ moves on to one that doesn't. A turned pair keeps no detached crumb (under 6% of the ink), and one left with a small
35
+ piece (under 30% of the mark across) isn't drawn: a small square in an M's crotch over a J's bowl is a face. A J on its side is a C or a U, so it stays upright. Two T's, two L's or an X never turn and nest.
36
+ - **Reads after a turn:** each turned letter is read as what it now looks like (`LOOKS`, `readsOf()`: a P or a D on its
37
+ side a U, a C a U, an N a Z, an M upside down a W, an E on its side an M or a W…, and still itself: nested, an F on
38
+ its side with a P's stem makes an F again), and a pair that reads, in either
39
+ order, as blocked initials or a rude read isn't drawn (`readsBlocked()`): F (upright or turned) with a P on its side is FU. `RUDE` (FU,
40
+ FK, FCK, FUK, FFS, WTF, STFU, GTFO, KYS, FML, BS, SOB, ASS, slurs, XXX, 1488…) is blocked as typed initials too, like
41
+ `BLOCKED`. The owner's F/P reference stays: the P upside down (its half turn is allowed) with its bowl against the F's
42
+ bars, the preset 'Turned pair'.
43
+ - Tuning, main controls, no turns, mix weights and five presets (60 in all) for the new recipes. `letter.js` exports its
44
+ `skeleton()` and `CHARS`; `raster.js` its `morph()`.
45
+
4
46
  ## 0.5.0 (2026-11-28)
5
47
 
6
48
  - **Five recipes after the commonest tech-brand marks** (the owner's audit of 623 tech-brand icons): `cloud`, `layers`,
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # @logomarks/generate
2
2
 
3
- Abstract logomarks from rules and controls, no AI. Each recipe is one construction (60 of them: bars, bands, twin,
3
+ Abstract logomarks from rules and controls, no AI. Each recipe is one construction (65 of them: bars, bands, twin,
4
4
  stack, shear, turns, burst, tiles, route, arcs, rings, stripes, chevrons, waves, cut, split, spiral, bloom, links,
5
5
  horizon, steps, hex, iso and letter; fourteen after live house families: arcstep, halfsq, invert, leaves, lobes, loops,
6
6
  trine, strips, bite, blades, wavecut, capsules, flare, seam; and seven that combine unlike shapes: merge, overlap,
7
7
  counter, pair, corners, offset, quarters; ten after the owner's reference logos: mosaic, weave, notch, nodes, xband,
8
- mirror, ribbon, field, zigzag, halfstripe; and five after the commonest tech-brand marks: cloud, layers, bubble, check,
9
- peak) that lists its controls
8
+ mirror, ribbon, field, zigzag, halfstripe; five after the commonest tech-brand marks: cloud, layers, bubble, check,
9
+ peak; and five contrast monograms from initials: duo, crossover, tucked, clash, splitchar) that lists its controls
10
10
  and draws a mark from them, fitted to the Logomarks standard: a 512 canvas, the longest side 448, centred,
11
11
  `currentColor`, the house gap. Every recipe also takes the finish controls (turn, mirror, round corners, outline, an
12
12
  accent dot, a container: a circle, square, rounded square, hexagon or speech bubble, as a badge, a clip or a frame). Each mark comes with its `pieces`, and `svgOf()` draws them in two colours. A
@@ -146,3 +146,43 @@ peak 0.632).
146
146
 
147
147
  The finish's `container` takes `'bubble'`: the mark knocked out of, clipped to or framed by a speech bubble, set a
148
148
  little above the middle to sit in the bubble's body.
149
+
150
+ ## Contrast monograms (0.6.0)
151
+
152
+ Initials treated unlike on purpose, after the owner's contrast monograms: one boxed and one open, each in a ring (one
153
+ solid, one outlined), a sans beside a serif, a letter turned and locked into the other. Each side of a pair has a build
154
+ (`sans`, `serif` and `blackletter` from core's letters, or the Letter recipe's stencil, route, cut, wedge, blocks,
155
+ rails, tiles) and, in Duo, a treatment (`solid`, `knockout`, `outline`; a knocked-out letter is always a heavy build).
156
+
157
+ - `duo`: two (or three, `charC`) initials laid out `boxed` (side by side, each with its treatment), `rings` (each in a
158
+ circle, apart or overlapping, the later ring cleared behind the earlier; a round letter takes a rounded square, two
159
+ O's in rings being a pair of eyes), `cells` (one container split by the gap, a cell filled with its letter cut out, the
160
+ next open) or `turned` (one or both letters turned a quarter or half turn or mirrored, drawn extended at a light
161
+ weight, and nested by a raster search so their strokes lock a gap apart: after the owner's F and P, the P upside down
162
+ with its bowl against the F's bars). The container control is `box`: the finish already has `container`.
163
+ - `crossover`: A solid, running into B's block, ink outside it and cut out inside; the block's edge moves until 68% of
164
+ A's ink is outside (an M whose last stem falls in the gap is an I).
165
+ - `tucked`: a big letter with one or two small ones knocked out of small boxes at its lower or upper corner.
166
+ - `clash`: the letters side by side in unlike builds at one cap height, apart or interlocked (the later letter laid
167
+ over by up to 22% of its width, eased back until it keeps 90% of its ink; a T or an I never interlocks).
168
+ - `splitchar`: one character cut upright, level or on the diagonal, the second half cut out of its half of a box or
169
+ drawn in another build. An H never in a disc (a helipad), a P never in a square (a car park); a letter of slanted
170
+ strokes (A, V, W, Y, K, X, M, N, 4) is never split upright (a pistol's grip and barrel).
171
+
172
+ `monograms(initials, { count = 24, seed = 1 })` makes a page of them from typed initials: upper-cased, A–Z and 0–9 kept,
173
+ at most three (`initialsOf()`). One letter gets the split letter cut each way; two get boxed, rings, cells, turned,
174
+ crossover, tucked and clash; three get boxed, rings and cells with a third, tucked with two small boxes, and clash.
175
+ Each way of contrasting is tried a few times with seeded settings (`monogramPlans()`), failed draws and near-twins (a
176
+ coarse outline over 90% alike) dropped, ranked by `qualityOf()`, no way allowed more than its share, and the page
177
+ alternates them, best first. Each result is a mark with its `group` and `quality`. Three initials keep only marks
178
+ scoring 0.6 or more, so their page is shorter and mostly Tucked. A turned pair keeps no detached crumb (a face).
179
+
180
+ Bans, by construction: `BLOCKED` / `blocked()` initials (other companies' monogram logos: LV, CC, GG, DG, YSL, VW, HP,
181
+ GE, MK, CK, HM, DC, NY, LA, IBM, BMW, KFC; hate codes: SS, HH, KKK, 88) draw nothing in any of the five, and `monograms()`
182
+ returns none. A turn that makes a letter another letter (`BECOMES`: an M upside down is a W, an N on its side a Z,
183
+ 6 and 9, L and 7; an A, V or Y on its side an arrowhead; a J upside down a padlock's shackle) moves on
184
+ (the P upside down stays: it is the owner's F/P reference)
185
+ to one that doesn't (`safeTurn()`); two T's, two L's or an X never turn and nest (a cross, a swastika-like hook). No
186
+ faces: two round letters never sit in rings, and no recipe draws paired holes on purpose. None of the five turns or
187
+ mirrors in a shuffle (`TURNS`). A turned pair is also read as it now looks (`LOOKS`, `readsOf()`: a P on its side is a
188
+ U) and is not drawn when that read is blocked or rude (`RUDE`: FU, FK, WTF, slurs…; also blocked as typed initials).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logomarks/generate",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Abstract logomarks from rules and controls, no AI: 34 recipes (bars, bands, twin, stack, shear, turns, burst, tiles, route, arcs, rings, stripes, dots, pixel, chevrons, waves, cut, split, venn, blobs, dashes, fan, fold, spiral, orbit, bloom, links, horizon, steps, hex, tri, iso, line, letter) that each list their controls and draw a mark from them and a seed, fitted to the Logomarks standard (512 canvas, 448 fit, the house gap), a shared finish (rounding, outline, an accent dot, a container), two-colour pieces, seeded variations and presets. Runs in the browser and in Node.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/generate.js CHANGED
@@ -9,6 +9,7 @@ import { rng, seedOf } from './random.js';
9
9
  import { problems } from './guard.js';
10
10
  import { TURNS, TURN_SHARE, HOLD } from './tuning.js';
11
11
  import { fill, thinShareBits } from './raster.js';
12
+ import { blocked, readsBlocked, safeTurn } from './recipes/duo.js';
12
13
 
13
14
  robust();
14
15
 
@@ -267,7 +268,7 @@ export function similar(id, params, { count = 12, seed = 1, amount = 0.15, locke
267
268
  * How often each recipe comes up in `mix()`, relative to 1: the ones whose shuffles most often give a mark worth
268
269
  * keeping lead; the textured ones (iso, hex, tiles) come up less.
269
270
  */
270
- export const MIX_WEIGHT = { twin: 1.6, cut: 1.6, split: 1.4, chevrons: 1.3, spiral: 1.2, links: 1.2, arcs: 1.2, bands: 1.2, stripes: 1.2, rings: 0.8, turns: 1.1, bloom: 1, burst: 1, bars: 1, waves: 0.9, stack: 0.8, steps: 0.8, letter: 0.8, shear: 0.6, route: 0.5, horizon: 0.5, tiles: 0.6, hex: 0.5, iso: 0.5, arcstep: 1.4, leaves: 1.3, seam: 1.3, trine: 1.1, blades: 1.1, invert: 1, wavecut: 1, capsules: 1, bite: 0.9, loops: 0.8, strips: 0.7, flare: 0.8, lobes: 0.9, halfsq: 0.8, pixelarc: 0.4 , merge: 1.3, overlap: 1.3, counter: 1.2, pair: 1.3, corners: 1.2, offset: 1.1, quarters: 1.1 , mosaic: 0.8, weave: 0.8, notch: 1, nodes: 0.9, xband: 0.9, mirror: 0.8, ribbon: 1, field: 0.7, zigzag: 0.9, halfstripe: 0.9, cloud: 0.9, layers: 0.9, bubble: 0.8, check: 0.7, peak: 0.8 };
271
+ export const MIX_WEIGHT = { twin: 1.6, cut: 1.6, split: 1.4, chevrons: 1.3, spiral: 1.2, links: 1.2, arcs: 1.2, bands: 1.2, stripes: 1.2, rings: 0.8, turns: 1.1, bloom: 1, burst: 1, bars: 1, waves: 0.9, stack: 0.8, steps: 0.8, letter: 0.8, shear: 0.6, route: 0.5, horizon: 0.5, tiles: 0.6, hex: 0.5, iso: 0.5, arcstep: 1.4, leaves: 1.3, seam: 1.3, trine: 1.1, blades: 1.1, invert: 1, wavecut: 1, capsules: 1, bite: 0.9, loops: 0.8, strips: 0.7, flare: 0.8, lobes: 0.9, halfsq: 0.8, pixelarc: 0.4 , merge: 1.3, overlap: 1.3, counter: 1.2, pair: 1.3, corners: 1.2, offset: 1.1, quarters: 1.1 , mosaic: 0.8, weave: 0.8, notch: 1, nodes: 0.9, xband: 0.9, mirror: 0.8, ribbon: 1, field: 0.7, zigzag: 0.9, halfstripe: 0.9, cloud: 0.9, layers: 0.9, bubble: 0.8, check: 0.7, peak: 0.8, duo: 0.9, crossover: 0.7, tucked: 0.7, clash: 0.7, splitchar: 0.6 };
271
272
 
272
273
  /**
273
274
  * `count` marks from ANY recipe: each slot picks a recipe by its seed (from `ids`, every recipe by default, weighted by
@@ -290,3 +291,99 @@ export function mix({ count = 48, seed = 1, ids = Object.keys(RECIPES), tries =
290
291
  }
291
292
  return out;
292
293
  }
294
+
295
+ /** Initials as monograms take them: upper case, letters and numerals only, at most three. */
296
+ export const initialsOf = (text) => [...String(text ?? '').toUpperCase()].filter((c) => /[A-Z0-9]/.test(c)).slice(0, 3);
297
+
298
+ /** A shape's coarse outline signature: its fitted ink on a small bitmap, for telling near-twins apart. */
299
+ function signatureOf(shape) {
300
+ const polys = !shape || !shape.length ? [] : typeof shape[0][0][0] === 'number' ? [shape] : shape;
301
+ if (!polys.length) return null;
302
+ let x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
303
+ for (const poly of polys) for (const [x, y] of poly[0]) { x0 = Math.min(x0, x); y0 = Math.min(y0, y); x1 = Math.max(x1, x); y1 = Math.max(y1, y); }
304
+ const k = 448 / Math.max(x1 - x0, y1 - y0, 1e-9), mx = (x0 + x1) / 2, my = (y0 + y1) / 2;
305
+ return fill(polys.map((poly) => mapPts(poly, ([x, y]) => [256 + (x - mx) * k, 256 + (y - my) * k])), 28);
306
+ }
307
+ /** How alike two signatures are (shared ink over all ink). */
308
+ function alikeness(a, b) {
309
+ let both = 0, any = 0;
310
+ for (let i = 0; i < a.length; i++) { both += a[i] & b[i]; any += a[i] | b[i]; }
311
+ return any ? both / any : 1;
312
+ }
313
+
314
+ /**
315
+ * The plans `monograms()` draws from, in groups (one group a way of contrasting the letters), each plan a recipe and its
316
+ * params, varied by the seed. One letter: the split letter, cut each way, its second half cut out or in another build.
317
+ * Two: boxed, rings (apart and overlapping), cells, turned, crossover, tucked and clash. Three: boxed, rings and cells
318
+ * with a third cell, tucked with two small boxes, and clash.
319
+ */
320
+ export function monogramPlans(initials, { seed = 1, each = 4 } = {}) {
321
+ const chars = initialsOf(initials);
322
+ if (!chars.length || blocked(chars)) return [];
323
+ const rand = rng(`monograms:${chars.join('')}:${seed}`), pick = (a) => a[Math.floor(rand() * a.length)];
324
+ const [a, b, c] = chars, heavy = ['sans', 'cut', 'wedge', 'blocks', 'route'], contrast = ['serif', 'serif', 'blackletter', 'sans', 'stencil'];
325
+ const boxes = ['rounded', 'square', 'circle'], groups = [];
326
+ const group = (name, recipe, make, n = each) => groups.push({ name, plans: [...Array(n)].map(() => ({ recipe, params: make(), group: name })) });
327
+ const w = () => 0.18 + rand() * 0.05, pair = { charA: a, charB: b, charC: c || '-' };
328
+ if (chars.length === 1) {
329
+ for (const axis of ['upright', 'level', 'diagonal']) {
330
+ group(`split-${axis}`, 'splitchar', () => ({ charA: a, axis, treatB: 'knockout', buildA: pick(['sans', 'cut', 'wedge']), box: pick(boxes), weight: w() }));
331
+ group(`split-${axis}-type`, 'splitchar', () => ({ charA: a, axis, treatB: 'build', buildA: pick(['sans', 'cut', 'wedge']), buildB: pick(['serif', 'serif', 'stencil']), weight: w() }));
332
+ }
333
+ } else {
334
+ group('boxed', 'duo', () => ({ ...pair, layout: 'boxed', treatA: pick(['knockout', 'knockout', 'outline']), treatB: pick(['solid', 'solid', 'outline']), buildA: pick(heavy), buildB: pick(contrast), box: pick(boxes), weight: w() }));
335
+ group('rings', 'duo', () => ({ ...pair, layout: 'rings', treatA: 'knockout', treatB: pick(['outline', 'solid']), join: pick(['apart', 'overlap']), buildA: pick(heavy), buildB: pick(contrast), weight: w() }));
336
+ group('cells', 'duo', () => ({ ...pair, layout: 'cells', buildA: pick(heavy), buildB: pick(contrast), box: pick(['rounded', 'square']), weight: w() }));
337
+ group('tucked', 'tucked', () => ({ ...pair, buildA: pick(['sans', 'serif', 'serif', 'cut']), buildB: pick(['sans', 'sans', 'cut']), treatB: 'knockout', box: pick(boxes), corner: 'JSGCOUQ'.includes(a) ? 'top' : pick(['bottom', 'bottom', 'top']), size: 0.4 + rand() * 0.1, weight: w() }), chars.length === 3 ? each * 3 : each);
338
+ group('clash', 'clash', () => ({ ...pair, buildA: pick(['sans', 'cut', 'wedge']), buildB: pick(['serif', 'serif', 'blackletter']), join: pick(['apart', 'interlock']), weight: w() }));
339
+ if (chars.length === 2) {
340
+ group('turned', 'duo', () => {
341
+ // turns whose pair reads as blocked or rude (F with a P on its side is FU) are drawn again, a few times
342
+ let turnA = '0', turnB = '180';
343
+ for (let k = 0; k < 8; k++) {
344
+ turnA = pick(['0', '0', '270', '90']); turnB = pick(['180', '180', '90', '270', 'mirror']);
345
+ if (!readsBlocked(a, safeTurn(a, turnA), b, safeTurn(b, turnB))) break;
346
+ }
347
+ return { ...pair, layout: 'turned', buildA: pick(['sans', 'sans', 'cut', 'serif']), turnA, turnB, stretch: 1.2 + rand() * 0.3, weight: w() };
348
+ });
349
+ // a letter whose last stroke is a stem or an arm (H, M, T…) loses it to the block's edge: no crossover for it
350
+ if (!'HIMNTWXY'.includes(a)) group('crossover', 'crossover', () => ({ ...pair, buildA: pick(['sans', 'cut', 'wedge']), buildB: pick(['sans', 'cut', 'wedge']), box: pick(['rounded', 'square']), overlap: 0.16 + rand() * 0.1, weight: w() }));
351
+ }
352
+ }
353
+ // the groups in a seeded order, each plan's settings drawn above
354
+ for (let i = groups.length - 1; i > 0; i--) { const j = Math.floor(rand() * (i + 1)); [groups[i], groups[j]] = [groups[j], groups[i]]; }
355
+ return groups;
356
+ }
357
+
358
+ /**
359
+ * A page of contrast monograms for typed initials (one to three letters and numerals; anything else is ignored, and a
360
+ * blocked run of initials gives none): every way of contrasting the letters tried a few times (`monogramPlans()`),
361
+ * failed draws and near-twins dropped, ranked by `qualityOf`, and no way of contrasting allowed to crowd the page. Each
362
+ * result is a mark (`generate()`'s) with its `group` and `quality`, in an order that alternates the groups, best first.
363
+ */
364
+ export function monograms(initials, { count = 24, seed = 1, each } = {}) {
365
+ const groups = monogramPlans(initials, { seed, each: each ?? Math.max(3, Math.ceil((count * 1.6) / 7)) });
366
+ if (!groups.length) return [];
367
+ const found = [], sigs = [];
368
+ for (const gr of groups) for (const plan of gr.plans) {
369
+ try {
370
+ const { shape, g } = draw(plan.recipe, plan.params);
371
+ if (g.problems.length || !g.svg) continue;
372
+ const sig = signatureOf(shape);
373
+ if (sigs.some((s) => alikeness(s, sig) > 0.9)) continue;
374
+ sigs.push(sig);
375
+ found.push({ ...g, group: plan.group, quality: qualityOf(shape).score });
376
+ } catch { /* the next plan */ }
377
+ }
378
+ // three initials crowd the pair layouts (rings, cells, boxed): below 0.6 they look cramped, so a three-letter page
379
+ // shows fewer, better ones (tucked, one big and two small, scores well)
380
+ if (initialsOf(initials).length === 3) for (let i = found.length - 1; i >= 0; i--) if (found[i].quality < 0.6) found.splice(i, 1);
381
+ const live = new Set(found.map((m) => m.group)).size || 1, cap = Math.max(2, Math.ceil(count / live) + 1), byGroup = new Map();
382
+ for (const m of found.sort((x, y) => y.quality - x.quality)) {
383
+ const list = byGroup.get(m.group) || [];
384
+ if (list.length < cap) { list.push(m); byGroup.set(m.group, list); }
385
+ }
386
+ const lanes = [...byGroup.values()], out = [];
387
+ while (out.length < count && lanes.some((l) => l.length)) for (const l of lanes) if (l.length && out.length < count) out.push(l.shift());
388
+ return out;
389
+ }
package/src/index.d.ts CHANGED
@@ -133,3 +133,34 @@ export function unlikePair(rand: () => number, pool?: string[], recipe?: string)
133
133
  export function unlikeTriple(rand: () => number, pool?: string[], recipe?: string): [string, string, string];
134
134
  /** Per recipe, the pairings it never draws: [a, b, the read avoided]. */
135
135
  export const BANNED: Record<string, [string, string, string][]>;
136
+
137
+ /** A contrast monogram on a `monograms()` page: the mark, which way it contrasts the letters (`group`), and its quality. */
138
+ export type Monogram = Generated & { group: string; quality: number };
139
+ /**
140
+ * A page of contrast monograms for typed initials (one to three letters and numerals; anything else ignored; blocked
141
+ * initials give none): every way of contrasting tried a few times, failed draws and near-twins dropped, ranked by
142
+ * `qualityOf`, no way allowed to crowd the page, the order alternating them. Seeded.
143
+ */
144
+ export function monograms(initials: string, o?: { count?: number; seed?: number | string; each?: number }): Monogram[];
145
+ /** The plans `monograms()` draws from, grouped by way of contrasting the letters. */
146
+ export function monogramPlans(initials: string, o?: { seed?: number | string; each?: number }): { name: string; plans: { recipe: string; params: Params; group: string }[] }[];
147
+ /** Initials as monograms take them: upper case, A–Z and 0–9 only, at most three. */
148
+ export function initialsOf(text: string): string[];
149
+ /** Initials never drawn: other companies' monogram logos and hate codes. */
150
+ export const BLOCKED: string[];
151
+ /** Whether a run of characters is one of the blocked initials. */
152
+ export function blocked(chars: string | string[]): boolean;
153
+ /** The letter builds a monogram side can take. */
154
+ export const BUILDS: string[];
155
+ /** Turns that make a letter another letter (an M upside down is a W). */
156
+ export const BECOMES: Record<string, Record<string, string>>;
157
+ /** The turn a letter takes for an asked one: the asked turn, or the next that keeps it itself. */
158
+ export function safeTurn(ch: string, turn: string): string;
159
+ /** Rude or offensive reads, typed or made by a turn (profanity initials, slurs); blocked like `BLOCKED`. */
160
+ export const RUDE: string[];
161
+ /** What a letter looks like once turned, where that passes for another letter. */
162
+ export const LOOKS: Record<string, Record<string, string>>;
163
+ /** The letters a character may be read as, turned `turn` ('?' for none). */
164
+ export function readsOf(ch: string, turn: string): string;
165
+ /** Whether two turned letters read, in either order, as blocked initials or a rude read. */
166
+ export function readsBlocked(a: string, ta: string, b: string, tb: string): boolean;
package/src/index.js CHANGED
@@ -2,7 +2,8 @@
2
2
  * @logomarks/generate: abstract logomarks from rules and controls, no AI.
3
3
  */
4
4
  export { RECIPES } from './recipes/index.js';
5
- export { recipe, generate, randomParams, variations, nearby, similar, mix, shuffled, qualityOf, MIX_WEIGHT, piecesOf, svgOf, PATTERNS } from './generate.js';
5
+ export { recipe, generate, randomParams, variations, nearby, similar, mix, shuffled, qualityOf, MIX_WEIGHT, piecesOf, svgOf, PATTERNS, monograms, monogramPlans, initialsOf } from './generate.js';
6
+ export { BLOCKED, RUDE, blocked, BUILDS, BECOMES, safeTurn, LOOKS, readsOf, readsBlocked } from './recipes/duo.js';
6
7
  export { defaults, resolve, clampTo, randomValue } from './controls.js';
7
8
  export { rng, seedOf } from './random.js';
8
9
  export { GUARD, problems } from './guard.js';
package/src/presets.js CHANGED
@@ -62,4 +62,9 @@ export const PRESETS = [
62
62
  { id: 'striped-bubble', name: 'Striped bubble', recipe: 'bubble', params: { move: 'bands', body: 'disc', bands: 3 }, note: 'A round speech bubble cut into three bands.' },
63
63
  { id: 'parted-tick', name: 'Parted tick', recipe: 'check', params: { move: 'heel', weight: 0.21 }, note: 'A heavy tick, its two legs parted at the heel.' },
64
64
  { id: 'seated-a', name: 'Seated A', recipe: 'peak', params: { move: 'seat', apex: 'flat', weight: 0.22 }, note: 'An A as a peak, a small triangle seated for its crossbar.' },
65
+ { id: 'boxed-pair', name: 'Boxed pair', recipe: 'duo', params: { charA: 'J', charB: 'M', layout: 'boxed', treatA: 'knockout', treatB: 'solid', buildA: 'sans', buildB: 'serif', box: 'rounded' }, note: 'One initial cut from a box, the other a serif beside it.' },
66
+ { id: 'two-rings', name: 'Two rings', recipe: 'duo', params: { charA: 'A', charB: 'S', layout: 'rings', treatA: 'knockout', treatB: 'outline', buildA: 'cut', buildB: 'serif', join: 'overlap' }, note: 'Each initial in a ring, one solid, one outlined.' },
67
+ { id: 'turned-pair', name: 'Turned pair', recipe: 'duo', params: { charA: 'F', charB: 'P', layout: 'turned', buildA: 'sans', turnA: '0', turnB: '180', stretch: 1.45 }, note: 'Two letters turned and locked together.' },
68
+ { id: 'type-clash', name: 'Type clash', recipe: 'clash', params: { charA: 'J', charB: 'M', buildA: 'sans', buildB: 'blackletter', join: 'interlock' }, note: 'A heavy sans beside a blackletter.' },
69
+ { id: 'split-letter', name: 'Split letter', recipe: 'splitchar', params: { charA: 'D', axis: 'upright', treatB: 'build', buildA: 'sans', buildB: 'serif' }, note: 'Half a sans D, half a serif one.' },
65
70
  ];
package/src/raster.js CHANGED
@@ -29,7 +29,7 @@ function disc(r) {
29
29
  }
30
30
 
31
31
  /** One pass of erosion (`all` true: kept where the whole disc is set) or dilation (set where any of it is). */
32
- function morph(bits, N, r, all) {
32
+ export function morph(bits, N, r, all) {
33
33
  const out = new Uint8Array(N * N), d = disc(r);
34
34
  for (let y = 0; y < N; y++) for (let x = 0; x < N; x++) {
35
35
  let v = all ? 1 : 0;
@@ -0,0 +1,13 @@
1
+ /** Clash: initials side by side in unlike builds, a heavy sans beside a Didone serif or a blackletter (./duo.js). */
2
+ import { SHARED, clash } from './duo.js';
3
+
4
+ /** @type {import('../index.js').Control[]} */
5
+ export const controls = [
6
+ SHARED.charA, SHARED.charB, SHARED.buildA, SHARED.buildB,
7
+ { key: 'join', label: 'Letters', type: 'choice', options: ['apart', 'interlock'], value: 'interlock' },
8
+ SHARED.charC, SHARED.weight, SHARED.gap,
9
+ ];
10
+
11
+ /** The mark for resolved params. */
12
+ export const build = clash;
13
+ export const guard = { maxPieces: 30, maxThinShare: 0.08, minInkShare: 0.08 };
@@ -0,0 +1,14 @@
1
+ /** Crossover: one initial as a solid letter running into the other's block, ink outside it and cut out inside (./duo.js). */
2
+ import { SHARED, crossover } from './duo.js';
3
+
4
+ /** @type {import('../index.js').Control[]} */
5
+ export const controls = [
6
+ SHARED.charA, SHARED.charB, SHARED.buildA, SHARED.buildB,
7
+ { ...SHARED.box, options: ['rounded', 'square'] },
8
+ { key: 'overlap', label: 'Crossing', type: 'range', min: 0.2, max: 0.45, step: 0.01, value: 0.32 },
9
+ SHARED.weight, SHARED.gap,
10
+ ];
11
+
12
+ /** The mark for resolved params. */
13
+ export const build = crossover;
14
+ export const guard = { maxPieces: 30, maxThinShare: 0.08, minInkShare: 0.12 };
@@ -0,0 +1,395 @@
1
+ /**
2
+ * Contrast monograms: two or three initials (or the two halves of one) drawn on purpose in UNLIKE ways. One letter
3
+ * knocked out of a box beside one left open; each in its own ring, one solid and one outlined; a split badge with one
4
+ * cell filled; a heavy sans beside a Didone serif or a blackletter. The shared engine for the five monogram recipes
5
+ * (duo, crossover, tucked, clash, splitchar) and `monograms()`, which makes a page of them from typed initials.
6
+ *
7
+ * Each side is a letter in one of the letter builds (core's geometric sans skeleton solid, core's Didone serif and
8
+ * blackletter, or the Letter recipe's stencil, route, cut, wedge, blocks, rails and tiles) and one treatment: solid
9
+ * (the ink letter), knockout (the letter cut from a filled container) or outline (an ink letter in a container rim).
10
+ * A knocked-out letter is always a heavy build: a serif's hairlines cut from a block close up at 32 px.
11
+ */
12
+ import { U, D, I, rect, rr, circle, poly, mapPts, bbox, grown, skelSolid, robust, area } from '@logomarks/core/geometry';
13
+ import { drawn, SERIF_GLYPHS, BLACKLETTERS, blackLetter } from '@logomarks/core/letters';
14
+ import { build as letterBuild, skeleton, CHARS } from './letter.js';
15
+ import { GAP, clear, tidy } from '../draw.js';
16
+ import { fill, morph } from '../raster.js';
17
+
18
+ robust();
19
+
20
+ /** The cell a side is drawn in, before fitting (the whole mark is fitted to the 448 box afterwards). */
21
+ export const S = 200;
22
+ /** Every character a side can be. */
23
+ export const PAIR_CHARS = CHARS;
24
+ /** A third initial's control: none, or a character. */
25
+ export const THIRD = ['-', ...CHARS];
26
+ /** The letter builds a side can take. */
27
+ export const BUILDS = ['sans', 'serif', 'blackletter', 'stencil', 'route', 'cut', 'wedge', 'blocks', 'rails', 'tiles'];
28
+ /** The heavy builds: the ones a knockout uses (and a split's first half). */
29
+ export const HEAVY = ['sans', 'cut', 'wedge', 'blocks', 'route', 'stencil', 'tiles'];
30
+ /** The contrast builds: what a shuffle sets against a heavy one. */
31
+ export const CONTRAST = ['serif', 'blackletter', 'rails', 'serif', 'stencil'];
32
+
33
+ /**
34
+ * Initials never drawn: other companies' monogram logos (LV, CC, GG, DG, YSL, VW, HP, GE, MK, CK, HM, DC, NY, LA, IBM,
35
+ * BMW, KFC) and hate codes (SS, HH, KKK, 88). Matched on the characters as typed, in order.
36
+ */
37
+ export const BLOCKED = ['LV', 'CC', 'GG', 'DG', 'YSL', 'VW', 'HP', 'GE', 'MK', 'CK', 'HM', 'DC', 'NY', 'LA', 'IBM', 'BMW', 'KFC', 'SS', 'HH', 'KKK', '88'];
38
+
39
+ /** Rude or offensive reads, typed or made by a turn: profanity initials and slurs. Blocked like `BLOCKED`. */
40
+ export const RUDE = ['FU', 'FK', 'FCK', 'FUK', 'FFS', 'WTF', 'STFU', 'GTFO', 'KYS', 'FML', 'BS', 'SOB', 'ASS', 'FAG', 'NIG', 'NGR', 'DIK', 'CUM', 'SEX', 'XXX', 'POO', 'PEE', 'NAZ', '1488', '14'];
41
+
42
+ /** Whether a run of characters is one of the blocked initials or a rude read. */
43
+ export const blocked = (chars) => { const t = (Array.isArray(chars) ? chars : [...String(chars)]).join('').toUpperCase(); return BLOCKED.includes(t) || RUDE.includes(t); };
44
+
45
+ /** The characters a monogram's params name, the third left out when it is '-'. */
46
+ export const charsOf = (p) => [p.charA, p.charB, p.charC].filter((c) => c && c !== '-').map(String);
47
+
48
+ /** A shape as a list of polygons. */
49
+ const asShape = (s) => (!s || !s.length ? [] : typeof s[0][0][0] === 'number' ? [s] : s);
50
+
51
+ /** A letter's glyph in a build, at any size and place (it is placed afterwards). Builds a letter lacks fall back to the sans. */
52
+ export function glyph(ch, build, weight = 0.2) {
53
+ const c = String(ch);
54
+ if (build === 'serif' && SERIF_GLYPHS[c]) return asShape(drawn(c)(380, { S: Math.round(380 * (0.16 + weight * 0.42)), h: 52 }).s);
55
+ if (build === 'blackletter' && BLACKLETTERS[c]) return asShape(blackLetter(c, GAP));
56
+ if (build === 'sans' || build === 'serif' || build === 'blackletter') return asShape(skelSolid(null, 400, weight * 448, skeleton(c, 400)));
57
+ return asShape(letterBuild({ char: c, build, weight, slant: 0, spacing: 1.2, soft: 1 }));
58
+ }
59
+
60
+ /** A shape scaled to fit `w` × `h` (keeping its proportions) and centred on (cx, cy). */
61
+ export function place(shape, cx, cy, h, w) {
62
+ const s = asShape(shape);
63
+ if (!s.length) return [];
64
+ const [x0, y0, x1, y1] = bbox(s), k = Math.min(h / Math.max(y1 - y0, 1e-6), w / Math.max(x1 - x0, 1e-6));
65
+ return mapPts(s, ([x, y]) => [cx + (x - (x0 + x1) / 2) * k, cy + (y - (y0 + y1) / 2) * k]);
66
+ }
67
+
68
+ /** A container: a square, a rounded square or a circle (an ellipse-ended pill when it isn't square). */
69
+ export function container(kind, cx, cy, w, h) {
70
+ if (kind === 'circle') return Math.abs(w - h) < 1e-6 ? circle(cx, cy, w / 2, 160) : rr(cx - w / 2, cy - h / 2, w, h, Math.min(w, h) / 2);
71
+ if (kind === 'rounded') return rr(cx - w / 2, cy - h / 2, w, h, Math.min(w, h) * 0.24);
72
+ return rect(cx - w / 2, cy - h / 2, w, h);
73
+ }
74
+
75
+ /** A letter's build for a treatment: a knockout always heavy. */
76
+ const buildFor = (build, treat) => (treat === 'knockout' && !HEAVY.includes(build) ? 'sans' : build);
77
+
78
+ /**
79
+ * One side: `ch` in `build`, treated `treat` ('solid', 'knockout' or 'outline') in a `kind` container `w` × `h` at
80
+ * (cx, cy). Returns the side's ink and its container (for clearing the next side from it).
81
+ */
82
+ export function side(ch, build, treat, kind, cx, cy, w, h, p) {
83
+ const box = container(kind, cx, cy, w, h), round = kind === 'circle';
84
+ if (treat === 'solid') return { ink: place(glyph(ch, build, p.weight), cx, cy, h * 0.92, w * 0.92), box };
85
+ if (treat === 'knockout') {
86
+ const L = place(glyph(ch, buildFor(build, treat), p.weight), cx, cy, h * (round ? 0.5 : 0.58), w * (round ? 0.56 : 0.66));
87
+ return { ink: D(box, L), box };
88
+ }
89
+ const t = Math.max(GAP, p.rim * S), inner = container(kind, cx, cy, w - 2 * t, h - 2 * t), ring = D(box, inner);
90
+ const L = place(glyph(ch, build, p.weight), cx, cy, (h - 2 * t) * (round ? 0.58 : 0.66), (w - 2 * t) * (round ? 0.62 : 0.7));
91
+ return { ink: U(ring, clear(L, ring, GAP * p.gap)), box };
92
+ }
93
+
94
+ /** The treatments of each side, from A's and B's (a third side takes A's). */
95
+ const treatsOf = (p, n) => [...Array(n)].map((_, i) => (i === 1 ? p.treatB : p.treatA));
96
+ /** The builds of each side, from A's and B's (a third side takes A's). */
97
+ const buildsOf = (p, n) => [...Array(n)].map((_, i) => (i === 1 ? p.buildB : p.buildA));
98
+
99
+ /** Round letters: two rings of them side by side read as a pair of eyes or glasses. */
100
+ const ROUND = 'O0QCGD';
101
+
102
+ /**
103
+ * Boxed, rings or cells for two or three characters.
104
+ * - boxed: the sides side by side, a gap apart, each in its own treatment (a knocked-out box beside an open letter);
105
+ * - rings: each side in a circle, apart or overlapping (the later one passing behind, cleared by the gap); round letters
106
+ * in rings read as eyes, so they take rounded squares;
107
+ * - cells: one container split into cells by the gap, the first (and third) cell filled with its letter knocked out,
108
+ * the other open with an ink letter in its share of the rim.
109
+ */
110
+ export function pairs(p) {
111
+ if (p.layout === 'turned') return turned(p);
112
+ const chars = charsOf(p), n = chars.length, g = GAP * p.gap;
113
+ if (blocked(chars) || n < 2) return [];
114
+ const builds = buildsOf(p, n);
115
+ if (p.layout === 'cells') {
116
+ const kind = p.box === 'circle' ? 'rounded' : p.box, W = n * S + (n - 1) * g, outer = container(kind, W / 2, S / 2, W, S);
117
+ const t = Math.max(GAP, p.rim * S), inner = container(kind, W / 2, S / 2, W - 2 * t, S - 2 * t), parts = [];
118
+ for (let i = 0; i < n; i++) {
119
+ const x0 = i * (S + g), x1 = x0 + S, region = rect(i ? x0 : -S, -S, (i === n - 1 ? W + S : x1) - (i ? x0 : -S), 3 * S);
120
+ const cell = I(outer, region), cx = (x0 + x1) / 2;
121
+ if (i % 2 === 0) parts.push(D(cell, place(glyph(chars[i], buildFor(builds[i], 'knockout'), p.weight), cx, S / 2, S * 0.58, S * 0.66)));
122
+ else {
123
+ const frame = D(cell, inner), L = place(glyph(chars[i], builds[i], p.weight), cx, S / 2, (S - 2 * t) * 0.66, (S - 2 * t) * 0.7);
124
+ parts.push(frame, clear(L, frame, g));
125
+ }
126
+ }
127
+ return tidy(U(...parts), { share: 0.003, width: 9 });
128
+ }
129
+ const treats = treatsOf(p, n);
130
+ const rings = p.layout === 'rings', kind = rings ? (chars.every((c) => ROUND.includes(c)) ? 'rounded' : 'circle') : p.box;
131
+ const step = rings && p.join === 'overlap' ? S * 0.88 : S + g;
132
+ let acc = [], prev = null;
133
+ for (let i = 0; i < n; i++) {
134
+ const sd = side(chars[i], builds[i], treats[i], kind, S / 2 + i * step, S / 2, S, S, p);
135
+ acc = prev && rings && p.join === 'overlap' ? U(acc, clear(sd.ink, prev, g)) : U(acc, sd.ink);
136
+ prev = sd.box;
137
+ }
138
+ return tidy(acc, { share: 0.003, width: 9 });
139
+ }
140
+
141
+ /** A shape's ink: its outlines' area less its holes'. */
142
+ const inkOf = (shape) => shape.reduce((t, pg) => t + area(pg[0]) - pg.slice(1).reduce((h, r) => h + area(r), 0), 0);
143
+
144
+ /**
145
+ * Crossover: A as a solid letter running into B's block. Outside the block A is ink (kept a gap from it); inside, A is
146
+ * cut out of the block, and B is cut out of the block beside it.
147
+ */
148
+ export function crossover(p) {
149
+ const [a, b] = charsOf(p), g = GAP * p.gap;
150
+ if (!a || !b || blocked([a, b])) return [];
151
+ const kind = p.box === 'circle' ? 'rounded' : p.box;
152
+ const LA = place(glyph(a, buildFor(p.buildA, 'knockout'), p.weight), S * 0.45, S / 2, S, S * 0.9), [ax0, , ax1] = bbox(LA);
153
+ // A must still read outside the block: the block's edge (and the gap before it) mustn't take a whole stroke, so the
154
+ // overlap moves, nearest first, until at least 68% of A's ink is outside, cleared (an M whose last stem falls in the
155
+ // gap is an I); failing that, the overlap that leaves the most
156
+ const Wb = S * 1.15, total = inkOf(LA), at = (k) => {
157
+ const left = ax1 - p.overlap * k * (ax1 - ax0), block = container(kind, left + Wb / 2, S / 2, Wb, S);
158
+ return { left, block, share: inkOf(D(LA, grown(block, g))) / total };
159
+ };
160
+ let best = null;
161
+ for (const k of [1, 1.25, 0.8, 1.5, 0.6, 1.75]) {
162
+ const c = at(k);
163
+ if (!best || c.share > best.share) best = c;
164
+ if (c.share >= 0.68) { best = c; break; }
165
+ }
166
+ const { left, block } = best, inside = I(LA, block), room = Wb - (ax1 - left) - g;
167
+ const LB = place(glyph(b, buildFor(p.buildB, 'knockout'), p.weight), ax1 + g + room / 2, S / 2, S * 0.58, Math.max(S * 0.3, room * 0.82));
168
+ return tidy(U(D(LA, grown(block, g)), D(block, U(inside, LB))), { share: 0.006, width: 16 });
169
+ }
170
+
171
+ /**
172
+ * Tucked: A big and solid; B (and C) small, each in a small box at A's lower (or upper) right corner, the boxes
173
+ * overlapping A's edge and A cleared from them by the gap. A small side's treatment is B's: knockout, outline, or solid
174
+ * (the small letter on its own, A cleared from it).
175
+ */
176
+ export function tucked(p) {
177
+ const chars = charsOf(p), [a, ...rest] = chars, g = GAP * p.gap;
178
+ if (!a || !rest.length || blocked(chars)) return [];
179
+ const LA = place(glyph(a, p.buildA, p.weight), S / 2, S / 2, S, S * 0.95), [, ay0, ax1, ay1] = bbox(LA), s = S * p.size;
180
+ const smalls = [], boxes = [];
181
+ rest.forEach((ch, i) => {
182
+ const cx = ax1 - s * 0.25 + s / 2, cy = p.corner === 'top' ? ay0 + s / 2 + i * (s + g) : ay1 - s / 2 - i * (s + g);
183
+ const sd = side(ch, p.buildB, p.treatB, p.box, cx, cy, s, s, p);
184
+ smalls.push(sd.ink);
185
+ boxes.push(p.treatB === 'solid' ? sd.ink : sd.box);
186
+ });
187
+ return tidy(U(D(LA, grown(U(...boxes), g)), ...smalls), { share: 0.003, width: 9 });
188
+ }
189
+
190
+ /**
191
+ * Clash: the letters side by side with no container, each in a different build (a heavy sans beside a Didone serif or a
192
+ * blackletter), matched to one cap height. Apart (a gap between their boxes) or interlocked (the second laid over the
193
+ * first by up to 22% of its width, cleared from it by the gap, eased back until it keeps 90% of its ink).
194
+ */
195
+ export function clash(p) {
196
+ const chars = charsOf(p), g = GAP * p.gap;
197
+ if (chars.length < 2 || blocked(chars)) return [];
198
+ const builds = buildsOf(p, chars.length);
199
+ let acc = [], x = 0, prev = null;
200
+ chars.forEach((ch, i) => {
201
+ const L0 = place(glyph(ch, builds[i], p.weight), 0, S / 2, S, S * 1.1), [x0, , x1] = bbox(L0), w = x1 - x0, total = inkOf(L0);
202
+ let L = mapPts(L0, ([px, py]) => [px - x0, py]), kept = L;
203
+ if (i > 0) {
204
+ // interlocked, the later letter laid over the earlier by up to 22% of its width, eased back until the clear
205
+ // leaves it 90% of its ink (a T cleared of an arm is an I); apart, a gap between them
206
+ // (a T or an I, all arm or stem, never interlocks: any clear makes a T an I)
207
+ for (const k of p.join === 'interlock' && !'TI'.includes(ch) ? [0.22, 0.15, 0.08, -g / w] : [-g / w]) {
208
+ L = mapPts(L0, ([px, py]) => [px + x - x0 - w * k, py]);
209
+ kept = k > 0 ? clear(L, prev, g) : L;
210
+ if (k <= 0 || inkOf(kept) >= total * 0.9) break;
211
+ }
212
+ }
213
+ acc = U(acc, kept);
214
+ x = bbox(L)[2];
215
+ prev = L;
216
+ });
217
+ return tidy(acc, { share: 0.003, width: 9 });
218
+ }
219
+
220
+ /**
221
+ * A letter turned: by a quarter turn ('90', '180', '270') about its own middle, or mirrored ('mirror'), at the origin.
222
+ */
223
+ export function turnLetter(shape, turn) {
224
+ if (!turn || turn === '0') return shape;
225
+ const [x0, y0, x1, y1] = bbox(shape), cx = (x0 + x1) / 2, cy = (y0 + y1) / 2;
226
+ if (turn === 'mirror') return mapPts(shape, ([x, y]) => [2 * cx - x, y]).map((pg) => pg.map((r) => r.slice().reverse()));
227
+ const a = (Number(turn) * Math.PI) / 180, c = Math.round(Math.cos(a)), s = Math.round(Math.sin(a));
228
+ return mapPts(shape, ([x, y]) => [cx + (x - cx) * c - (y - cy) * s, cy + (x - cx) * s + (y - cy) * c]);
229
+ }
230
+
231
+ /**
232
+ * Turns that make a letter another real letter (and so the pair another pair, or a word): an M upside down is a W, an N on
233
+ * its side a Z, a 6 upside down a 9; an A, V or Y on its side is an arrowhead, a J upside down a padlock's shackle over
234
+ * the other letter. Such a turn is moved on to the next one that doesn't.
235
+ */
236
+ export const BECOMES = {
237
+ A: { 180: 'V', 90: '<', 270: '>' }, V: { 180: 'A', 90: '>', 270: '<' }, Y: { 90: '>', 270: '<', 180: 'λ' },
238
+ M: { 180: 'W', 90: 'E', 270: 'E' }, W: { 180: 'M', 90: 'E', 270: 'E' }, N: { 90: 'Z', 270: 'Z' }, Z: { 90: 'N', 270: 'N', mirror: 'S' }, S: { mirror: 'Z' },
239
+ 6: { 180: '9' }, 9: { 180: '6' }, U: { 180: 'n', 90: 'C', 270: 'C' }, C: { 90: 'U', 270: 'n' }, E: { 90: 'm', 270: 'w' },
240
+ P: { mirror: 'q' }, L: { 180: '7' }, 7: { 180: 'L' }, J: { mirror: 'L', 180: 'ʃ', 90: 'U', 270: 'C' }, K: { 90: 'ʞ', 270: 'ʞ' },
241
+ };
242
+ /** The turn a letter takes for an asked turn: the asked one, or the next of 90, 270, 180, mirror, none that keeps it itself. */
243
+ export function safeTurn(ch, turn) {
244
+ const order = [turn, '90', '270', '180', 'mirror', '0'];
245
+ return order.find((t) => t === '0' || !(BECOMES[ch] && BECOMES[ch][t])) || '0';
246
+ }
247
+ /**
248
+ * What a letter LOOKS like once turned, where that is near enough another letter to be read as one (each a string of
249
+ * the letters it may pass for): a P or a D on its side a U, a C a U, an N a Z, an M upside down a W, an E on its side
250
+ * an M or a W… A turned letter may still be read as itself, too (nested, an F on its side and a P's stem make an F
251
+ * again), so it reads as itself and what it looks like.
252
+ */
253
+ export const LOOKS = {
254
+ P: { 90: 'UN', 270: 'UN', 180: 'D', mirror: 'Q' }, D: { 90: 'U', 270: 'UN', mirror: 'C' }, C: { 90: 'U', 270: 'UN', 180: 'D', mirror: 'D' },
255
+ U: { 90: 'C', 270: 'CD', 180: 'N' }, N: { 90: 'Z', 270: 'Z' }, Z: { 90: 'N', 270: 'N', mirror: 'S' }, S: { mirror: 'Z', 90: 'N', 270: 'N' },
256
+ M: { 180: 'W', 90: 'E', 270: 'E' }, W: { 180: 'M', 90: 'E', 270: 'E' }, E: { 90: 'MW', 270: 'MW', mirror: '3' }, L: { 180: '7', mirror: 'J', 90: 'J', 270: '7' },
257
+ J: { mirror: 'L', 180: 'L', 90: 'U', 270: 'C' }, A: { 180: 'V' }, V: { 180: 'A' }, 6: { 180: '9' }, 9: { 180: '6' }, K: { 180: 'K' }, G: { 90: 'U' }, B: { 90: 'M', 270: 'W' },
258
+ F: { 180: 'J' }, T: { 180: 'L' }, Y: { 180: 'L' }, R: { mirror: 'K' },
259
+ };
260
+ /** The letters a character may be read as, turned `turn`. */
261
+ export const readsOf = (ch, turn) => (!turn || turn === '0' ? ch : ch + (LOOKS[ch]?.[turn] ?? ''));
262
+ /** Whether two turned letters read, in either order, as blocked initials or a rude read. */
263
+ export const readsBlocked = (a, ta, b, tb) => {
264
+ for (const x of readsOf(a, ta)) for (const y of readsOf(b, tb)) if (blocked([x, y]) || blocked([y, x])) return true;
265
+ return false;
266
+ };
267
+
268
+ /** Pairs never turned and nested: two T's or two L's lock into a cross or a hooked turn; an X turned is still an X. */
269
+ const NO_TURN = /^(TT|LL|X.|.X|\+)$/;
270
+
271
+ /** The share of the smaller of two boxes that the two overlap. */
272
+ const overlapShare = (a, b) => {
273
+ const w = Math.max(0, Math.min(a[2], b[2]) - Math.max(a[0], b[0])), h = Math.max(0, Math.min(a[3], b[3]) - Math.max(a[1], b[1]));
274
+ return (w * h) / Math.min((a[2] - a[0]) * (a[3] - a[1]), (b[2] - b[0]) * (b[3] - b[1]));
275
+ };
276
+
277
+ /**
278
+ * Turned: two letters in one build at one light weight, one (or both) turned or mirrored, then nested so their strokes
279
+ * lock together: the second slid (and, if it helps, set a little smaller) to the place that packs the two tightest
280
+ * without touching, the gap kept between them (a raster search). A place where the two boxes overlap (one letter reaching
281
+ * into the other's room, a bar over the other's arm) beats one where they only sit side by side, and an edge of one lined
282
+ * up with an edge of the other counts for a little. The letters are extended (drawn wider) first, so their arms reach.
283
+ */
284
+ export function turned(p) {
285
+ const [a, b] = charsOf(p), g = GAP * p.gap, w = p.weight * 0.72;
286
+ if (!a || !b || blocked([a, b]) || NO_TURN.test(a + b)) return [];
287
+ const wide = (s) => mapPts(s, ([x, y]) => [x * p.stretch, y]);
288
+ // nested, the bitmap and stencil builds' steps and breaks tangle: a turned pair is drawn in a line build
289
+ const bld = ['sans', 'cut', 'serif', 'rails'].includes(p.buildA) ? p.buildA : 'sans';
290
+ const ta = safeTurn(a, p.turnA), tb = safeTurn(b, p.turnB);
291
+ // the pair as it READS once turned (a P on its side looks like a U, so F with it is FU): never a blocked or rude read,
292
+ // in either order
293
+ if (readsBlocked(a, ta, b, tb)) return [];
294
+ const LA = turnLetter(place(wide(glyph(a, bld, w)), 0, 0, S, S * 1.4), ta);
295
+ const B0 = turnLetter(place(wide(glyph(b, bld, w)), 0, 0, S, S * 1.4), tb);
296
+ const N = 120, span = S * 3.2, px = span / N, toPx = (s) => mapPts(s, ([x, y]) => [((x + span / 2) / span) * 512, ((y + span / 2) / span) * 512]);
297
+ const A = morph(fill(toPx(LA), N), N, Math.ceil(g / px) + 1, false), boxA = bbox(LA); // a pixel over the gap, so the exact clear below trims nothing
298
+ let best = null;
299
+ for (const k of [1, 0.9, 0.8]) {
300
+ const LB0 = k === 1 ? B0 : mapPts(B0, ([x, y]) => [x * k, y * k]), B = fill(toPx(LB0), N), boxB = bbox(LB0);
301
+ const cells = []; for (let i = 0; i < B.length; i++) if (B[i]) cells.push(i);
302
+ for (let dy = -S * 1.1; dy <= S * 1.1; dy += px) for (let dx = -S * 1.2; dx <= S * 1.2; dx += px) {
303
+ const ox = Math.round(dx / px), oy = Math.round(dy / px);
304
+ let hit = false;
305
+ for (const i of cells) { const x = (i % N) + ox, y = ((i / N) | 0) + oy; if (x < 0 || y < 0 || x >= N || y >= N || A[y * N + x]) { hit = true; break; } }
306
+ if (hit) continue;
307
+ const bb = [boxB[0] + dx, boxB[1] + dy, boxB[2] + dx, boxB[3] + dy];
308
+ const X0 = Math.min(boxA[0], bb[0]), X1 = Math.max(boxA[2], bb[2]), Y0 = Math.min(boxA[1], bb[1]), Y1 = Math.max(boxA[3], bb[3]);
309
+ const W = X1 - X0, H = Y1 - Y0, area = W * H * (1 + (Math.abs(W - H) / Math.max(W, H)) * 0.35);
310
+ const nest = overlapShare(boxA, bb), line = [bb[1] - boxA[1], bb[3] - boxA[3], bb[1] - boxA[3], bb[3] - boxA[1], bb[0] - boxA[0], bb[2] - boxA[2]].some((d) => Math.abs(d) < px * 1.5);
311
+ const score = area * (nest > 0.25 ? 0.82 : nest > 0.1 ? 0.92 : 1.15) * (line ? 0.94 : 1) * (k === 1 ? 1 : k === 0.9 ? 1.04 : 1.1);
312
+ if (!best || score < best.score) best = { score, dx, dy, k };
313
+ }
314
+ }
315
+ if (!best) return [];
316
+ const LB = mapPts(B0, ([x, y]) => [x * best.k + best.dx, y * best.k + best.dy]);
317
+ // no detached crumb: a small piece left in a crotch or over a curve is an eye (JM's M over the J's bowl is a face)
318
+ const out = tidy(U(LA, clear(LB, LA, g)), { share: 0.004, width: 9 }), all = inkOf(out), [mx0, my0, mx1, my1] = bbox(out);
319
+ const big = Math.max(mx1 - mx0, my1 - my0);
320
+ // crumbs (under 6% of the ink) go; a bigger piece that is still small across (under 30% of the mark) is a dot or a
321
+ // stub the nesting cut off a letter: such an arrangement isn't drawn, rather than drawn with a letter maimed
322
+ const kept = out.filter((pg) => inkOf([pg]) >= all * 0.06);
323
+ return kept.some((pg) => { const [x0, y0, x1, y1] = bbox([pg]); return Math.max(x1 - x0, y1 - y0) < big * 0.3; }) ? [] : kept;
324
+ }
325
+
326
+ /** A half-plane: the points on the `side` (1 or -1) of the line through (cx, cy) at `deg`, set back by `off`. */
327
+ function halfPlane(cx, cy, deg, side, off) {
328
+ const a = (deg * Math.PI) / 180, nx = -Math.sin(a), ny = Math.cos(a), R = 4000, ox = cx + nx * off * side, oy = cy + ny * off * side;
329
+ const dx = Math.cos(a) * R, dy = Math.sin(a) * R;
330
+ return poly([[ox - dx, oy - dy], [ox + dx, oy + dy], [ox + dx + nx * R * side, oy + dy + ny * R * side], [ox - dx + nx * R * side, oy - dy + ny * R * side]]);
331
+ }
332
+
333
+ /** Letters whose slanted strokes, split upright, make a gun's grip and barrel. */
334
+ export const GRIP = /^[AVWYKXMN4]$/;
335
+
336
+ /**
337
+ * Split letter: one character cut in two along an axis (upright, level or diagonal), the halves a gap apart: the first
338
+ * half the ink letter, the second either the letter cut out of its half of a container (knockout) or the same letter in
339
+ * another build (build: a sans half beside a serif half).
340
+ */
341
+ export function splitchar(p) {
342
+ const ch = String(p.charA), g = GAP * p.gap;
343
+ if (blocked([ch])) return [];
344
+ // a letter of slanted strokes split upright is a pistol: the half body (or half letter) a grip, the slanted stroke
345
+ // running out of it a barrel. Never drawn, in any body or build
346
+ if (GRIP.test(ch) && p.axis === 'upright') return [];
347
+ const A = place(glyph(ch, buildFor(p.buildA, 'knockout'), p.weight), 0, 0, S, S * 1.2), [x0, y0, x1, y1] = bbox(A);
348
+ const deg = p.axis === 'level' ? 0 : p.axis === 'diagonal' ? 60 : 90;
349
+ const near = halfPlane(0, 0, deg, -1, g / 2), far = halfPlane(0, 0, deg, 1, g / 2);
350
+ const first = I(A, near);
351
+ if (p.treatB === 'build') {
352
+ const B = place(glyph(ch, p.buildB, p.weight), 0, 0, y1 - y0, x1 - x0);
353
+ return tidy(U(first, I(B, far)), { share: 0.006, width: 14 });
354
+ }
355
+ // an H knocked out of a disc is a helipad, a P out of a square a car park: each takes the other container
356
+ const kind = ch === 'H' && p.box === 'circle' ? 'rounded' : ch === 'P' && p.box !== 'circle' ? 'circle' : p.box;
357
+ const pad = S * 0.14, box = container(kind, (x0 + x1) / 2, (y0 + y1) / 2, x1 - x0 + 2 * pad, y1 - y0 + 2 * pad);
358
+ return tidy(U(first, D(I(box, far), A)), { share: 0.006, width: 14 });
359
+ }
360
+
361
+ /** The controls every monogram recipe shares (each recipe takes the ones it uses). */
362
+ export const SHARED = {
363
+ charA: { key: 'charA', label: 'First initial', type: 'choice', options: PAIR_CHARS, value: 'J' },
364
+ charB: { key: 'charB', label: 'Second initial', type: 'choice', options: PAIR_CHARS, value: 'M' },
365
+ charC: { key: 'charC', label: 'Third initial', type: 'choice', options: THIRD, value: '-' },
366
+ buildA: { key: 'buildA', label: 'First letter build', type: 'choice', options: BUILDS, value: 'sans' },
367
+ buildB: { key: 'buildB', label: 'Second letter build', type: 'choice', options: BUILDS, value: 'serif' },
368
+ treatA: { key: 'treatA', label: 'First treatment', type: 'choice', options: ['knockout', 'solid', 'outline'], value: 'knockout' },
369
+ treatB: { key: 'treatB', label: 'Second treatment', type: 'choice', options: ['solid', 'knockout', 'outline'], value: 'solid' },
370
+ // `box`, not `container`: the finish has a `container` (a badge round the whole mark)
371
+ box: { key: 'box', label: 'Container', type: 'choice', options: ['rounded', 'square', 'circle'], value: 'rounded' },
372
+ weight: { key: 'weight', label: 'Weight', type: 'range', min: 0.14, max: 0.26, step: 0.005, value: 0.2 },
373
+ rim: { key: 'rim', label: 'Rim', type: 'range', min: 0.08, max: 0.16, step: 0.005, value: 0.11 },
374
+ gap: { key: 'gap', label: 'Gaps', type: 'range', min: 1, max: 2, step: 0.05, value: 1.2 },
375
+ };
376
+
377
+ /* ---------- the Duo recipe (boxed, rings, cells) ---------- */
378
+
379
+ /** @type {import('../index.js').Control[]} */
380
+ export const controls = [
381
+ SHARED.charA, SHARED.charB,
382
+ { key: 'layout', label: 'Layout', type: 'choice', options: ['boxed', 'rings', 'cells', 'turned'], value: 'boxed' },
383
+ SHARED.treatA, SHARED.treatB, SHARED.buildA, SHARED.buildB, SHARED.box,
384
+ { key: 'join', label: 'Rings', type: 'choice', options: ['apart', 'overlap'], value: 'apart' },
385
+ { key: 'turnA', label: 'Turn first (turned)', type: 'choice', options: ['0', '90', '180', '270', 'mirror'], value: '270' },
386
+ { key: 'turnB', label: 'Turn second (turned)', type: 'choice', options: ['0', '90', '180', '270', 'mirror'], value: '90' },
387
+ { key: 'stretch', label: 'Width (turned)', type: 'range', min: 1, max: 1.6, step: 0.05, value: 1.35 },
388
+ SHARED.charC, SHARED.weight, SHARED.rim, SHARED.gap,
389
+ ];
390
+
391
+ /** The mark for resolved params. */
392
+ export const build = pairs;
393
+
394
+ /** Two letters and their containers: more pieces than a plain mark, and serif hairlines a little thin. */
395
+ export const guard = { maxPieces: 34, maxThinShare: 0.06, minInkShare: 0.1 };
@@ -61,6 +61,11 @@ import * as layers from './layers.js';
61
61
  import * as bubble from './bubble.js';
62
62
  import * as check from './check.js';
63
63
  import * as peak from './peak.js';
64
+ import * as duo from './duo.js';
65
+ import * as crossover from './crossover.js';
66
+ import * as tucked from './tucked.js';
67
+ import * as clash from './clash.js';
68
+ import * as splitchar from './splitchar.js';
64
69
  import { FINISH, finish } from '../finish.js';
65
70
  import { TUNING } from '../tuning.js';
66
71
 
@@ -131,5 +136,10 @@ export const RECIPES = {
131
136
  bubble: R('bubble', 'Bubble', 'A speech bubble with one move: a parted tail, a pair, bands, a cut-out or a fold.', bubble),
132
137
  check: R('check', 'Check', 'A heavy tick with one move: a parted heel, doubled, cut from a shape, or folded.', check),
133
138
  peak: R('peak', 'Peak', 'The letter A as a peak: two heavy legs, no crossbar, with one move.', peak),
139
+ duo: R('duo', 'Duo', 'Two initials in unlike treatments: one boxed, one open; each in a ring; or a split badge.', duo),
140
+ crossover: R('crossover', 'Crossover', 'One initial running into the other\'s block, ink outside and cut out inside.', crossover),
141
+ tucked: R('tucked', 'Tucked', 'A big initial with a small one boxed at its corner.', tucked),
142
+ clash: R('clash', 'Type Clash', 'Initials side by side in unlike type: a heavy sans and a serif or blackletter.', clash),
143
+ splitchar: R('splitchar', 'Split Letter', 'One letter cut in two, each half treated another way.', splitchar),
134
144
  halfstripe: R('halfstripe', 'Half Stripe', 'A shape half solid, half bars stepping down.', halfstripe),
135
145
  };
@@ -55,7 +55,7 @@ const BITMAP = {
55
55
  9: ['.###.', '#...#', '#...#', '.####', '....#', '....#', '.###.'],
56
56
  };
57
57
 
58
- const CHARS = [...'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'];
58
+ export const CHARS = [...'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'];
59
59
  const NUMERAL = { 0: 'Zero', 1: 'One', 2: 'Two', 3: 'Three', 4: 'Four', 5: 'Five', 6: 'Six', 7: 'Seven', 8: 'Eight', 9: 'Nine' };
60
60
 
61
61
  /** @type {import('../index.js').Control[]} */
@@ -97,7 +97,7 @@ function bitmapLetter(ch, build, p) {
97
97
  /* ---------- the skeleton builds ---------- */
98
98
 
99
99
  /** The letter's skeleton at cap height H: core's, with an I (bars top and foot) core doesn't have. */
100
- function skeleton(ch, H) {
100
+ export function skeleton(ch, H) {
101
101
  if (ch === 'I') { const w = H * 0.72; return [skStroke(skLine([0, 0], [w, 0])), skStroke(skLine([w / 2, 0], [w / 2, H]), ['j', 'j']), skStroke(skLine([0, H], [w, H]))]; }
102
102
  return SKEL[NUMERAL[ch] || ch](H);
103
103
  }
@@ -0,0 +1,14 @@
1
+ /** Split letter: one character cut in two, the halves in unlike treatments: ink and cut out, or two builds (./duo.js). */
2
+ import { SHARED, splitchar } from './duo.js';
3
+
4
+ /** @type {import('../index.js').Control[]} */
5
+ export const controls = [
6
+ { ...SHARED.charA, label: 'Letter', value: 'D' },
7
+ { key: 'axis', label: 'Cut', type: 'choice', options: ['upright', 'level', 'diagonal'], value: 'upright' },
8
+ { ...SHARED.treatB, label: 'Second half', options: ['knockout', 'build'], value: 'build' },
9
+ SHARED.buildA, SHARED.buildB, SHARED.box, SHARED.weight, SHARED.gap,
10
+ ];
11
+
12
+ /** The mark for resolved params. */
13
+ export const build = splitchar;
14
+ export const guard = { maxPieces: 26, maxThinShare: 0.1, minInkShare: 0.1 };
@@ -0,0 +1,17 @@
1
+ /** Tucked: a big initial with one or two small ones boxed at its corner, overlapping its edge (./duo.js). */
2
+ import { SHARED, tucked } from './duo.js';
3
+
4
+ /** @type {import('../index.js').Control[]} */
5
+ export const controls = [
6
+ { ...SHARED.charA, value: 'R' }, SHARED.charB,
7
+ { ...SHARED.buildA, value: 'serif' }, { ...SHARED.buildB, value: 'sans' },
8
+ { ...SHARED.treatB, label: 'Small treatment', options: ['knockout', 'solid'], value: 'knockout' },
9
+ SHARED.box,
10
+ { key: 'corner', label: 'Corner', type: 'choice', options: ['bottom', 'top'], value: 'bottom' },
11
+ { key: 'size', label: 'Small size', type: 'range', min: 0.38, max: 0.54, step: 0.01, value: 0.46 },
12
+ SHARED.charC, SHARED.weight, SHARED.rim, SHARED.gap,
13
+ ];
14
+
15
+ /** The mark for resolved params. */
16
+ export const build = tucked;
17
+ export const guard = { maxPieces: 34, maxThinShare: 0.1, minInkShare: 0.08 };
package/src/tuning.js CHANGED
@@ -86,6 +86,14 @@ export const TUNING = {
86
86
  check: { move: of('heel', 'heel', 'double', 'triple', 'half'), weight: R(0.17, 0.24), angle: R(44, 58), short: R(0.38, 0.52), ends: of('square', 'level', 'round'), spacing: R(1.1, 1.5) },
87
87
  // a plain peak is a bare A, and one company's: by hand only
88
88
  peak: { move: of('part', 'slot', 'feet', 'seat', 'nest'), apex: of('point', 'flat'), feet: of('level', 'level', 'square'), width: R(0.62, 0.71), weight: R(0.2, 0.27), contrast: rare(0.3, 0.62, 0.85), at: R(0.24, 0.4), spacing: R(1.1, 1.5) },
89
+ // the contrast monograms (2026-11-28): initials a shuffle draws from the common ones; a third initial only by hand
90
+ duo: { charA: of(...'ABCDEFGHJKLMNPRSTW'), charB: of(...'ABCDEFGHJKLMNPRSTW'), layout: of('boxed', 'boxed', 'rings', 'cells', 'turned'), treatA: of('knockout', 'knockout', 'outline'), treatB: of('solid', 'solid', 'outline', 'knockout'),
91
+ buildA: of('sans', 'cut', 'wedge', 'blocks', 'route', 'stencil'), buildB: of('serif', 'serif', 'blackletter', 'sans', 'stencil'), box: of('rounded', 'square', 'circle'), join: of('apart', 'overlap'),
92
+ turnA: of('0', '270', '90'), turnB: of('90', '180', '270', 'mirror'), stretch: R(1.2, 1.5), weight: R(0.17, 0.24), rim: R(0.09, 0.13), gap: R(1, 1.4), charC: { rare: 0 } },
93
+ crossover: { charA: of(...'ABCDEFGJKLPRS'), charB: of(...'ABCDEFGHJKLMNPRSTW'), buildA: of('sans', 'cut', 'wedge'), buildB: of('sans', 'cut', 'wedge', 'stencil'), box: of('rounded', 'square'), overlap: R(0.16, 0.26), weight: R(0.18, 0.24), gap: R(1.1, 1.4) },
94
+ tucked: { charA: of(...'ABCDEFGHJKLMNPRSTW'), charB: of(...'ABCDEFGHJKLMNPRSTW'), buildA: of('sans', 'serif', 'serif', 'cut'), buildB: of('sans', 'sans', 'cut'), treatB: of('knockout'), box: of('rounded', 'square', 'circle'), corner: of('bottom', 'bottom', 'top'), size: R(0.4, 0.5), weight: R(0.18, 0.24), gap: R(1, 1.3), charC: { rare: 0 } },
95
+ clash: { charA: of(...'ABCDEFGHJKLMNPRSTW'), charB: of(...'ABCDEFGHJKLMNPRSTW'), buildA: of('sans', 'cut', 'wedge'), buildB: of('serif', 'serif', 'blackletter'), join: of('apart', 'interlock'), weight: R(0.18, 0.24), gap: R(1, 1.4), charC: { rare: 0 } },
96
+ splitchar: { charA: of(...'ABCDEFGHJKLMNPRSTUWZ'), axis: of('upright', 'upright', 'level', 'diagonal'), treatB: of('knockout', 'knockout', 'build'), buildA: of('sans', 'cut', 'wedge'), buildB: of('serif', 'serif', 'stencil'), box: of('rounded', 'square', 'circle'), weight: R(0.18, 0.24), gap: R(1, 1.4) },
89
97
  halfstripe: { bars: R(3, 5), solid: R(0.44, 0.58), step: R(0.05, 0.14), weight: R(0.5, 0.7) },
90
98
  };
91
99
 
@@ -108,6 +116,7 @@ export const MAIN = {
108
116
  mosaic: ['char', 'tiles', 'parted'], weave: ['strands', 'swells', 'height', 'ring'], notch: ['body', 'depth', 'seat', 'split'], nodes: ['nodes', 'size', 'hole', 'neck'],
109
117
  xband: ['angle', 'weight', 'bend', 'double'], mirror: ['symmetry', 'bands', 'centre', 'body'], ribbon: ['path', 'turns', 'ends', 'slots'], field: ['bars', 'profile', 'slide', 'widths'],
110
118
  zigzag: ['shape', 'stripes', 'teeth', 'slide'], halfstripe: ['shape', 'bars', 'step'],
119
+ duo: ['charA', 'charB', 'layout', 'buildB'], crossover: ['charA', 'charB', 'overlap', 'box'], tucked: ['charA', 'charB', 'treatB', 'corner'], clash: ['charA', 'charB', 'buildB', 'join'], splitchar: ['charA', 'axis', 'treatB', 'buildB'],
111
120
  cloud: ['puffs', 'move', 'rise', 'base'], layers: ['plate', 'count', 'lay', 'top'], bubble: ['body', 'move', 'tail', 'glyph'], check: ['move', 'weight', 'angle', 'ends'], peak: ['move', 'apex', 'width', 'weight'],
112
121
  };
113
122
 
@@ -147,12 +156,14 @@ export const TURNS = {
147
156
  // an A stays upright, its mirror the thin leg on the other side; a tick never turns or mirrors (a backwards tick is no
148
157
  // tick); layers on their side read as a back or rewind arrow (judged from a sheet of turned shuffles): mirror only
149
158
  cloud: MIRROR, bubble: MIRROR, peak: MIRROR, check: NONE, layers: MIRROR,
159
+ // letters stay as they are drawn (a turned pair is the Turned layout's own move)
160
+ duo: NONE, crossover: NONE, tucked: NONE, clash: NONE, splitchar: NONE,
150
161
  };
151
162
  /**
152
163
  * Keys a shuffle draws once and holds across its tries (`shuffled()` keeps the best of a few draws by quality; where a
153
164
  * recipe's forms score unalike, the best-of would always pick one form). Mirror's symmetry: the two-way emblem outscores
154
165
  * the four-way one, so without this two-way won nearly every shuffle.
155
166
  */
156
- export const HOLD = { mirror: ['symmetry'], ribbon: ['path'], cloud: ['move'], bubble: ['move', 'body'], check: ['move'], peak: ['move'] };
167
+ export const HOLD = { duo: ['layout'], mirror: ['symmetry'], ribbon: ['path'], cloud: ['move'], bubble: ['move', 'body'], check: ['move'], peak: ['move'] };
157
168
  /** How often a shuffle turns or mirrors a mark (of the turns its recipe allows). */
158
169
  export const TURN_SHARE = 1 / 3;