Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.
TypeScript agentic-aiaiai-agentsai-videocompilerdslffmpeggenerative-aillmmarkup-languagemonorepoplugin-systemprogramming-languagetext-to-videotypescriptvideovideo-automationvideo-clonevideo-editingvideo-generation
fix: the caption outline goes behind the glyph, not over it
rponee099136b0425
diff --git a/packages/caption-fine/src/manifest.ts b/packages/caption-fine/src/manifest.tsindex a995c984..7c9abfe7 100644--- a/packages/caption-fine/src/manifest.ts+++ b/packages/caption-fine/src/manifest.ts@@ -76,7 +76,7 @@ export const captionFineMarkupSurfaces = [{ name: "stroke-color", required: false, fallback: "#000000",summary: "Paints the outline drawn around each glyph." },{ name: "stroke-width", required: false, fallback: "0",- summary: "Sets the glyph outline thickness in pixels. An outline that only has to separate the caption from the picture behind it is thin — around a twentieth of `size`, so roughly 2px at a `size` of 46. It grows quickly: past about a tenth of `size` the outline starts closing the counters of a, e and o and the caption reads as a slab rather than as letters." },+ summary: "Sets the glyph outline thickness in pixels. The outline is drawn behind the glyph body, so it grows outward and leaves the letterform whole. An outline that only has to separate the caption from the picture behind it is thin — around a twentieth of `size`, so roughly 2px at a `size` of 46. It grows quickly: past about a tenth of `size` neighbouring letters meet, the gaps between them close, and the caption reads as a slab rather than as words." },{ name: "shadow-color", required: false, fallback: "#000000",summary: "Paints the soft drop shadow behind each glyph." },{ name: "shadow-opacity", required: false, fallback: "0",@@ -100,7 +100,7 @@ export const captionFineMarkupSurfaces = [{ name: "glow-opacity", required: false, fallback: "0",summary: "Sets how strongly the glyph halo reads." },{ name: "glow-blur", required: false, fallback: "0",- summary: "Spreads the glyph halo by this many pixels. A halo reads as a halo while it stays close to the glyph — near a tenth of `size`. Spread wide it stops tracing the letters, fills the space between them and washes the caption into a bright smear; the counters go first, exactly as they do under a heavy outline." },+ summary: "Spreads the glyph halo by this many pixels. A halo reads as a halo while it stays close to the glyph — near a tenth of `size`. Spread wide it stops tracing the letters, fills the space between them and washes the caption into a bright smear; the gaps between letters go first, exactly as they do under a heavy outline." },{ name: "active-fill", required: false, fallback: "#FFD54A",summary: "Paints the glyph body of the Word being spoken." },{ name: "active-opacity", required: false, fallback: "opacity",@@ -114,7 +114,7 @@ export const captionFineMarkupSurfaces = [{ name: "active-stroke-color", required: false, fallback: "stroke-color",summary: "Paints the outline around the Word being spoken." },{ name: "active-stroke-width", required: false, fallback: "stroke-width",- summary: "Sets the active glyph outline thickness in pixels. It inherits `stroke-width`, and the same proportion holds: emphasis on the spoken Word is carried by its Paint, so thickening its outline past the rest buys little and closes its counters first." },+ summary: "Sets the active glyph outline thickness in pixels. It inherits `stroke-width`, and the same proportion holds: emphasis on the spoken Word is carried by its Paint, so thickening its outline past the rest buys little and closes the gaps between its letters first." },{ name: "active-shadow-color", required: false, fallback: "shadow-color",summary: "Paints the drop shadow behind the Word being spoken." },{ name: "active-shadow-opacity", required: false, fallback: "shadow-opacity",diff --git a/packages/caption-fine/src/render.ts b/packages/caption-fine/src/render.tsindex 852ca5bb..5f215aec 100644--- a/packages/caption-fine/src/render.ts+++ b/packages/caption-fine/src/render.ts@@ -102,6 +102,14 @@ function glyphStyle(...(paint.stroke.widthPx === 0 ? [] : [{ name: "-webkit-text-stroke-color", value: paint.stroke.color },{ name: "-webkit-text-stroke-width", value: `${compactNumber(paint.stroke.widthPx)}px` },+ // A text stroke is centred on the glyph outline, so half of it falls inside the letter. Left+ // in the default order the browser fills first and strokes over the top, and that inner half+ // is painted away: every stroke of every letter is separately narrowed, the counters of a, e+ // and o close, and where two letters kern tightly one letter's outline crosses its+ // neighbour's face. Putting the stroke first spends the same width the other way — the fill+ // lands on top of it, and what is left showing is one contour around the outside of the+ // word, which is what an outline is for.+ { name: "paint-order", value: "stroke fill" },] as const),...(shadows.length === 0 ? [] : [{ name: "text-shadow", value: shadows.join(",") }] as const),...(underline === undefined ? [] : underlineStyle(underline)),diff --git a/packages/caption-fine/test/caption-fine.test.ts b/packages/caption-fine/test/caption-fine.test.tsindex 2d073ebe..821cc247 100644--- a/packages/caption-fine/test/caption-fine.test.ts+++ b/packages/caption-fine/test/caption-fine.test.ts@@ -427,6 +427,7 @@ test("full Fine Paint and layered motion lower to terminal Visual IR without cha...recipe.properties,"text-transform": "uppercase","gradient-from": "#FFFFFF", "gradient-to": "#60A5FA", "gradient-angle": 120,+ "stroke-color": "#101010", "stroke-width": 3,"long-shadow-color": "#172554", "long-shadow-opacity": 0.55,"long-shadow-distance": 8, "long-shadow-angle": 45,underline: "always", "underline-color": "#A7F3D0", "underline-thickness": 2, "underline-offset": 5,@@ -462,6 +463,10 @@ test("full Fine Paint and layered motion lower to terminal Visual IR without chaassert.ok(base?.style.some(({ name, value }) => name === "text-transform" && value === "uppercase"));assert.ok(base?.style.some(({ name }) => name === "text-decoration-thickness"));assert.ok(base?.style.some(({ name, value }) => name === "text-shadow" && String(value).split(",").length >= 8));+ // The outline is only an outline when it is painted behind the body it outlines; the other way+ // round it eats the letterform it was meant to separate from the picture.+ assert.ok(base?.style.some(({ name }) => name === "-webkit-text-stroke-width"));+ assert.ok(base?.style.some(({ name, value }) => name === "paint-order" && value === "stroke fill"));const activeGlyph = elements.find((element) => element.id === "atom-1-active-1");assert.equal(activeGlyph?.kind, "text");assert.ok(activeGlyph?.style.some(({ name }) => name === "background-image"));