commit 3ad64965d6dfe04061279436b7d7f2efda9dabb0
parent bb24465e873f87225da4388894af8f996969f087
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 6 Nov 2026 02:55:25 -0500
umtool: the promise strip's words at 22 px, not 16
The footage strip over a post item's card set its words at 0.62 of a
26 px strip: 16 px, too small to read. The strip now takes the post box's
whole top margin (27 px at 1080; a pixel above, a gap before the card), and
promiseStripType sizes its words against it: one line at 22 px (scaled with
the frame), set solid, when the margin's height holds it and the longest line
fits its width; two lines at 22 when only the width is short and two fit; else
the largest one line that fits. At 1080 the rev9 strip is one line at 22 px,
about 1000 of its 1514 px.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
3 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/umtool/report-to-video/chrome-measure-extras.mjs b/umtool/report-to-video/chrome-measure-extras.mjs
@@ -15,7 +15,7 @@
import { rgba } from "./chrome-deck.mjs";
import { compileCues, cuePageHtml, esc, INSTANT, joinSpans, r4, spanEvents } from "./chrome-cues.mjs";
import {
- daysBetween, daysLeftText, daysText, dietStates, goalStates, measureBox, measureExtraGeometry, measureOf, MEASURE_BOXES, promiseStripRect,
+ daysBetween, daysLeftText, daysText, dietStates, goalStates, measureBox, measureExtraGeometry, measureOf, MEASURE_BOXES, promiseStripRect, promiseStripType,
MEASURE_DODGE_MOVE, measurePlacements, monthYear, peakStates, promiseStates, shortDate, streakStates, upSpans, weightText,
} from "./measure-extras.mjs";
import { MEASURE_RED, resolveMeasureExtra } from "./modules/measure-extras-settings.mjs";
@@ -430,8 +430,11 @@ function promiseStrip(states, place, cfg, render, opts, items) {
return html;
});
const compiled = compileCues(init, ev);
+ // Its type from the longest line's words (rev 9: 16 px did not read).
+ const chars = Math.max(1, ...lines.map((l) => l.replace(/<[^>]+>/g, "").replace(/&[a-z#0-9]+;/gi, "x").length));
+ const type = promiseStripType(rect, render, chars);
const html = `<div id="ps" data-k="ps" style="left:${rect.x - reg.x}px; top:${rect.y - reg.y}px; width:${rect.width}px; height:${rect.height}px">${lines.join("")}</div>`;
- return { html, cues: compiled, rect };
+ return { html, cues: compiled, rect, type };
}
/** The promise clock's page: `{ html, items }`. `opts.avatars` = `{ <speaker>: "assets/…" }`, `opts.handles` = `{ <speaker>: handle }`. */
@@ -582,7 +585,9 @@ export function promiseHtml(schedule, render, opts = {}) {
#ps { position: absolute; visibility: hidden; opacity: 0; }
.sl { position: absolute; inset: 0; visibility: hidden; opacity: 0; display: flex; align-items: center; justify-content: center;
gap: ${Math.round(sk * 10)}px; white-space: nowrap; overflow: hidden; font-family: 'DeckSansBold', sans-serif;
- font-size: ${Math.round(strip ? strip.rect.height * 0.62 : 12)}px; letter-spacing: 0.08em; text-transform: uppercase; color: ${pal.muted}; }
+ font-size: ${strip ? strip.type.size : 12}px; line-height: 1; letter-spacing: 0.08em; text-transform: uppercase; color: ${pal.muted}; }${strip?.type.lines === 2 ? `
+ .sl { flex-wrap: wrap; align-content: center; row-gap: 0; white-space: normal; }
+ .sl > * { white-space: nowrap; }` : ""}
.sl b { color: ${pal.fg}; font-family: ${DISPLAY}; font-weight: 400; letter-spacing: 0.04em; }
.sl .no { color: ${red}; }
.sl .ok { color: ${green}; }
diff --git a/umtool/report-to-video/measure-extras.mjs b/umtool/report-to-video/measure-extras.mjs
@@ -689,12 +689,39 @@ export function promiseColumnRect(render) {
/**
* The strip a promise clock in the FOOTAGE box draws while a post item is up:
* one line in the post box's top margin, over the card (the post's pad, as
- * postLayout lays it: 36 design px of the box's height).
+ * postLayout lays it: 36 design px of the box's height) -- all of it but a
+ * pixel above and a pixel and a gap below, so its words can be read (rev 9:
+ * 22 px at 1080, not 16; promiseStripType).
*/
export function promiseStripRect(render, { feed = false } = {}) {
const f = feed ? feedGeometry(render).footage : deckGeometry(render).footage;
const pad = Math.round(36 * (f.height / 1080));
- return { x: f.x + pad, y: f.y + 2, width: f.width - 2 * pad, height: Math.max(18, pad - 4) };
+ return { x: f.x + pad, y: f.y + 1, width: f.width - 2 * pad, height: Math.max(18, pad - 3) };
+}
+
+/** The strip's words at 1080: no smaller than this when the margin holds them. */
+export const PROMISE_STRIP_PX = 22;
+
+/**
+ * The strip's type: its size, and whether its words go on two lines. One line
+ * at PROMISE_STRIP_PX (scaled with the frame) when the margin is tall enough
+ * and the longest line (`chars`, an uppercase condensed-bold line at about 0.64
+ * em a character, its spacing in) fits its width; two lines at that size when
+ * only the width is short and two fit the height; else the largest one line
+ * that fits both. Lines are set solid (line-height 1).
+ *
+ * @returns {{ size: number, lines: 1 | 2 }}
+ */
+export function promiseStripType(rect, render, chars) {
+ const k = (render?.height ?? 1080) / 1080;
+ const want = PROMISE_STRIP_PX * k;
+ const room = rect.height - 2 * k; // a pixel of air above and below the glyphs
+ const em = 0.64;
+ const fitsWide = (size) => chars * em * size <= rect.width;
+ const r = (v) => Math.floor(v * 100) / 100;
+ if (room >= want - 1e-6 && fitsWide(want)) return { size: r(Math.max(want, Math.min(room, rect.height * 0.62))), lines: 1 };
+ if (room >= 2 * want - 1e-6 && fitsWide(want / 2)) return { size: r(want), lines: 2 };
+ return { size: r(Math.min(room, rect.width / Math.max(1, chars * em))), lines: 1 };
}
/**
diff --git a/umtool/report-to-video/rev9-panel.test.mjs b/umtool/report-to-video/rev9-panel.test.mjs
@@ -14,7 +14,7 @@ import { titleLast } from "./chrome-finale.mjs";
import { instrumentsOn, resolveDial, resolveOdometer, resolveTrail } from "./instruments.mjs";
import { measureTrack, wedgeRange, weightWords } from "./measure-draw.mjs";
import { measureSlice, rangeOf } from "./measure-slice.mjs";
-import { measureExtraGeometry, measurePlacements, promiseStripRect } from "./measure-extras.mjs";
+import { measureExtraGeometry, measurePlacements, PROMISE_STRIP_PX, promiseStripRect, promiseStripType } from "./measure-extras.mjs";
import { placementsFor, promiseFinaleSlot, promiseHtml } from "./chrome-measure-extras.mjs";
import { validateFinaleSettings } from "./finale.mjs";
@@ -182,6 +182,13 @@ test("K: beside the instruments the promise clock stands in the trail's slot (co
const strip = promiseStripRect(f);
assert.ok(p.region.y <= strip.y && p.region.x <= strip.x);
assert.match(promiseHtml(covered, f, { fonts: {} }).html, /<div id="ps" data-k="ps"[^>]*>.*class="sl" data-k="t0"/s);
+ // Its words read (rev 9: 16 px did not): one line at 22 px at 1080, set solid, inside the margin.
+ assert.deepEqual(promiseStripType(strip, f, 80), { size: PROMISE_STRIP_PX, lines: 1 });
+ assert.match(promiseHtml(covered, f, { fonts: {} }).html, /\.sl \{[^}]*font-size: 22px; line-height: 1;/);
+ assert.ok(strip.height >= PROMISE_STRIP_PX + 2);
+ // A margin wide enough for two lines but not one: two at the size; neither: the largest one line that fits.
+ assert.deepEqual(promiseStripType({ x: 0, y: 0, width: 600, height: 50 }, f, 80), { size: 22, lines: 2 });
+ assert.ok(promiseStripType({ x: 0, y: 0, width: 600, height: 27 }, f, 80).size < 22);
// `slot: "footage"` beside the instruments keeps it in the footage box.
assert.equal(measureExtraGeometry("promise", render({ dial: true, promise: { slot: "footage" } })).width, 640);
// The finale: the dial's finale hands its lower column to it ("auto": a promise is on camera).