Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

Lyric type: data readouts sit on an ink plate by default

Claude8b39a2937f9a
diff --git a/server/services/musicVideo/documentTemplates/shared/lyricType.js b/server/services/musicVideo/documentTemplates/shared/lyricType.js
index 777872b4e4..86384e475a 100644
--- a/server/services/musicVideo/documentTemplates/shared/lyricType.js
+++ b/server/services/musicVideo/documentTemplates/shared/lyricType.js
@@ -24,8 +24,9 @@
* stamp short punches, negations, spoken lines: a three-frame stamp with a
* small tilt, optional strike-through.
* data HUD captions, counters and tags in mono; numbers roll. At most one
- * per shot. Set large enough to read on a phone and ringed in ink, so a
- * corner readout needs no backing plate on a light picture.
+ * per shot. Set large enough to read on a phone, on an ink plate by
+ * default (`dataBacking: 'outline'` rings each word in ink instead), so
+ * a corner readout reads on a light picture either way.
*
* Every frame is a pure function of song time, so a draft frame matches the full
* render at that time. The file is plain ES2020 with no imports.
@@ -247,12 +248,15 @@ function rollNumbers(text, k) {
* defaultZone zone for a shot without textZone (hooks default to `center`)
* boil `{ px, fps }` ink-boil jitter (off by default; share the scene's line boil)
* exclusive a visible hook hides the other roles (default true)
+ * dataBacking how a data readout stays legible: 'plate' (an ink plate behind it,
+ * the default) or 'outline' (each word ringed in ink, no plate)
*/
export function createLyricType(mv = globalThis.PORTOS_MV, options = {}) {
const T = LYRIC_TIMING;
const fps = mv?.render?.fps || 24;
const palette = { ...DEFAULT_PALETTE, ...(options.palette || {}) };
const fonts = { ...DEFAULT_FONTS, ...(options.fonts || {}) };
+ const dataPlate = options.dataBacking !== 'outline';
const beats = (mv?.song?.beats || []).filter(finite).slice().sort((a, b) => a - b);
const songWords = mv?.song?.words || [];
const scenes = (mv?.scenes || [])
@@ -394,6 +398,22 @@ export function createLyricType(mv = globalThis.PORTOS_MV, options = {}) {
ctx.save();
ctx.font = font; ctx.textAlign = 'left'; ctx.textBaseline = 'alphabetic';
ctx.lineJoin = 'round'; ctx.miterLimit = 2; ctx.lineWidth = outline;
+ if (line.role === 'data' && dataPlate && placed.words.some((w) => states[w.index].shown)) {
+ // One plate for the whole readout, sized to its full text so it doesn't grow as words appear.
+ const pad = placed.px * 0.35;
+ const x0 = Math.min(...placed.words.map((w) => w.x)) - pad;
+ const x1 = Math.max(...placed.words.map((w) => w.x + w.w - measure(' ', font))) + pad;
+ const y0 = Math.min(...placed.words.map((w) => w.y)) - placed.px * 0.85 - pad * 0.6;
+ const y1 = Math.max(...placed.words.map((w) => w.y)) + placed.px * 0.25 + pad * 0.6;
+ ctx.save();
+ ctx.globalAlpha = clamp(0.88 * exit.alpha);
+ ctx.fillStyle = palette.ink;
+ ctx.translate(0, exit.dy * unit);
+ ctx.beginPath();
+ if (ctx.roundRect) ctx.roundRect(x0, y0, x1 - x0, y1 - y0, pad * 0.5); else ctx.rect(x0, y0, x1 - x0, y1 - y0);
+ ctx.fill();
+ ctx.restore();
+ }
for (const word of placed.words) {
const s = states[word.index];
if (!s.shown) continue;
@@ -408,7 +428,7 @@ export function createLyricType(mv = globalThis.PORTOS_MV, options = {}) {
const text = line.role === 'data' ? rollNumbers(word.text, (t - s.startSec) / T.dataRollSec) : word.text;
const x0 = -(word.w - measure(' ', font)) / 2;
if (line.role === 'data') {
- ctx.strokeStyle = palette.ink; ctx.strokeText(text, x0, 0);
+ if (!dataPlate) { ctx.strokeStyle = palette.ink; ctx.strokeText(text, x0, 0); }
ctx.fillStyle = palette.accent; ctx.fillText(text, x0, 0);
} else if (line.role === 'hook' && word.index === line.accent) {
ctx.lineWidth = outline * 1.6;
diff --git a/server/services/musicVideo/overlayTextService.browser.test.js b/server/services/musicVideo/overlayTextService.browser.test.js
index 72d73fa2dc..0ca7b3050c 100644
--- a/server/services/musicVideo/overlayTextService.browser.test.js
+++ b/server/services/musicVideo/overlayTextService.browser.test.js
@@ -3,9 +3,10 @@
* draws a corner readout under a big lyric, a pale caption on a pale frame, a
* line past the right edge, a tiny tag and a DOM caption is staged like a
* render, probed at its text moments, and each problem comes back once —
- * while a word ringed in a wide ink outline passes on the same pale frame. The
- * shipped layered template (lyricType.js) passes on a pale still, data readout
- * included.
+ * while a word ringed in a wide ink outline, and a caption on an ink plate,
+ * pass on the same pale frame: either is a legibility treatment, not a problem.
+ * The shipped layered template (lyricType.js) passes on a pale still, its
+ * plated data readout included.
*/
import { afterAll, describe, expect, it, vi } from 'vitest';
import { existsSync } from 'node:fs';
@@ -47,6 +48,9 @@ function draw() {
ctx.strokeText('WHOLE', 300, 130); ctx.fillStyle = '#f3ead7'; ctx.fillText('WHOLE', 300, 130);
// Ringed in ink on the pale frame: readable.
ctx.strokeText('BLOOM', 80, 330); ctx.fillText('BLOOM', 80, 330);
+ // Pale on an ink plate: readable too.
+ ctx.fillStyle = '#141217'; ctx.fillRect(760, 380, 420, 70);
+ ctx.font = '500 40px monospace'; ctx.fillStyle = '#f3ead7'; ctx.fillText('ON A PLATE', 780, 428);
// Pale on pale, no outline.
ctx.font = '700 64px sans-serif'; ctx.fillStyle = '#fffaf0'; ctx.fillText('DISAPPEAR', 80, 480);
// Past the right edge.
@@ -58,7 +62,7 @@ globalThis.portosComposition = { durationSec: 4, fps: 12, width: 1280, height: 7
`;
describe.skipIf(!chrome)('overlay text check (headless Chrome)', () => {
- it('flags each text problem once, names the shot, and passes outlined type', async () => {
+ it('flags each text problem once, names the shot, and passes outlined or plated type', async () => {
const source = join(PATHS.data, 'overlay-doc');
await mkdir(source, { recursive: true });
await writeFile(join(source, 'index.html'), PAGE);
@@ -83,6 +87,7 @@ describe.skipIf(!chrome)('overlay text check (headless Chrome)', () => {
expect(kinds('tiny tag')).toContain('small');
expect(kinds('DOM CAPTION')).toEqual(['contrast']);
expect(kinds('BLOOM')).toEqual([]);
+ expect(kinds('ON A PLATE')).toEqual([]);
// One finding per problem however many frames showed it, errors first.
expect(new Set(check.findings.map((f) => f.id)).size).toBe(check.findings.length);
expect(check.findings[0].severity).toBe('error');