@softure-ai/marketing-kit 0.27.0 → 0.29.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 +32 -0
- package/README.md +15 -2
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +1 -0
- package/dist/config/config.js.map +1 -1
- package/dist/config/schema.d.ts +6 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +6 -2
- package/dist/config/schema.js.map +1 -1
- package/dist/footage/caption-highlight.d.ts +23 -3
- package/dist/footage/caption-highlight.d.ts.map +1 -1
- package/dist/footage/caption-highlight.js +23 -2
- package/dist/footage/caption-highlight.js.map +1 -1
- package/dist/footage/compose.d.ts.map +1 -1
- package/dist/footage/compose.js +15 -6
- package/dist/footage/compose.js.map +1 -1
- package/dist/footage/draft-overlays.d.ts.map +1 -1
- package/dist/footage/draft-overlays.js +28 -16
- package/dist/footage/draft-overlays.js.map +1 -1
- package/dist/footage/draft.d.ts.map +1 -1
- package/dist/footage/draft.js +41 -6
- package/dist/footage/draft.js.map +1 -1
- package/dist/footage/edl.d.ts +9 -0
- package/dist/footage/edl.d.ts.map +1 -1
- package/dist/footage/film.d.ts +15 -3
- package/dist/footage/film.d.ts.map +1 -1
- package/dist/footage/film.js +7 -2
- package/dist/footage/film.js.map +1 -1
- package/dist/footage/overlay-html.d.ts.map +1 -1
- package/dist/footage/overlay-html.js +20 -5
- package/dist/footage/overlay-html.js.map +1 -1
- package/dist/footage/overlay-schema.d.ts +18 -0
- package/dist/footage/overlay-schema.d.ts.map +1 -1
- package/dist/footage/overlay-schema.js +10 -0
- package/dist/footage/overlay-schema.js.map +1 -1
- package/dist/footage/overlays.d.ts +49 -3
- package/dist/footage/overlays.d.ts.map +1 -1
- package/dist/footage/overlays.js +95 -20
- package/dist/footage/overlays.js.map +1 -1
- package/dist/footage/pipeline.js +1 -1
- package/dist/footage/pipeline.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/schema/edl.schema.json +17 -0
- package/schema/marketing.schema.json +12 -2
- package/src/config/config.ts +1 -0
- package/src/config/schema.ts +6 -2
- package/src/footage/caption-highlight.ts +27 -5
- package/src/footage/compose.ts +15 -5
- package/src/footage/draft-overlays.ts +30 -17
- package/src/footage/draft.ts +53 -7
- package/src/footage/film.ts +17 -3
- package/src/footage/overlay-html.ts +29 -5
- package/src/footage/overlay-schema.ts +16 -0
- package/src/footage/overlays.ts +112 -23
- package/src/footage/pipeline.ts +1 -1
- package/src/index.ts +16 -0
package/src/footage/overlays.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
isTypedOverlay,
|
|
10
10
|
type EdlOverlay,
|
|
11
11
|
type EdlOverlayColors,
|
|
12
|
+
type OverlayAlign,
|
|
12
13
|
type OverlayEntrance,
|
|
13
14
|
type OverlayKind,
|
|
14
15
|
type OverlayPosition,
|
|
@@ -17,7 +18,7 @@ import {
|
|
|
17
18
|
} from "./overlay-schema.js";
|
|
18
19
|
import { getSegmentZoomEases } from "./compose.js";
|
|
19
20
|
import { normalizeWord } from "./words.js";
|
|
20
|
-
import type
|
|
21
|
+
import { STYLE_PADDING_SCALES, type BrandStyle, type CornerRadius } from "./brand-style.js";
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* An EDL's overlays resolved for the render and the draft (issue #1200): each one's film time (from its word through
|
|
@@ -39,14 +40,21 @@ export const OVERLAY_FONT_SIZES: Record<TextOverlayKind, Record<OverlaySize, num
|
|
|
39
40
|
keyword: { s: 64, m: 84, l: 108 },
|
|
40
41
|
lower_third: { s: 44, m: 52, l: 60 },
|
|
41
42
|
list: { s: 40, m: 48, l: 56 },
|
|
42
|
-
hook_title: { s:
|
|
43
|
+
hook_title: { s: 50, m: 64, l: 82 },
|
|
43
44
|
search_bar: { s: 36, m: 42, l: 50 },
|
|
44
|
-
place_card: { s:
|
|
45
|
+
place_card: { s: 70, m: 92, l: 118 },
|
|
45
46
|
counter: { s: 84, m: 108, l: 132 },
|
|
46
47
|
date_stamp: { s: 30, m: 36, l: 44 },
|
|
47
48
|
};
|
|
48
49
|
/** A second line's type size in main font sizes: the hook title's place label, the subtitle, the unit, the stamp's place. */
|
|
49
|
-
export const OVERLAY_SECONDARY_SCALE = { hook_title: 0.55, place_card: 0.
|
|
50
|
+
export const OVERLAY_SECONDARY_SCALE = { hook_title: 0.55, place_card: 0.55, counter: 0.5, date_stamp: 0.78 } as const;
|
|
51
|
+
/** A place card's subtitle size in title sizes, by its `subtitle_size` (RV-131 of an adopting app: 0.42 read tiny). */
|
|
52
|
+
export const OVERLAY_SUBTITLE_SCALES: Record<OverlaySize, number> = { s: 0.42, m: 0.55, l: 0.7 };
|
|
53
|
+
/** The smallest a place card's subtitle is drawn, in px of a 1080 px wide frame (2.3 % of a 1920 px tall one). */
|
|
54
|
+
export const MIN_OVERLAY_SUBTITLE_PX = 44;
|
|
55
|
+
/** How a title that does not fit two lines shrinks before it is refused: by this factor, at most `MAX_TITLE_SHRINKS` times. */
|
|
56
|
+
export const OVERLAY_TITLE_SHRINK = 0.9;
|
|
57
|
+
const MAX_TITLE_SHRINKS = 3;
|
|
50
58
|
/** A text overlay's line height and its box's padding, in font sizes. */
|
|
51
59
|
export const OVERLAY_LINE_HEIGHT = 1.15;
|
|
52
60
|
export const OVERLAY_LIST_LINE_HEIGHT = 1.4;
|
|
@@ -117,6 +125,8 @@ export interface OverlayLook {
|
|
|
117
125
|
colors: EdlOverlayColors;
|
|
118
126
|
/** Its card's own corner (`style.corner_radius`), else null: the brand style's, or the kind's own without one. */
|
|
119
127
|
cornerRadius?: CornerRadius | null;
|
|
128
|
+
/** Its card's padding in `OVERLAY_PADDING_EM`s: the brand style's `padding` (`STYLE_PADDING_SCALES`); absent: 1. */
|
|
129
|
+
padScale?: number;
|
|
120
130
|
}
|
|
121
131
|
|
|
122
132
|
type Drawn = OverlayBase & OverlayLook;
|
|
@@ -132,9 +142,9 @@ export type ResolvedOverlay =
|
|
|
132
142
|
| (Drawn & { kind: "list"; items: string[]; fontSize: number; side: OverlaySide; box: OverlayBox })
|
|
133
143
|
| (Drawn & { kind: "arrow"; from: OverlayPoint; to: OverlayPoint })
|
|
134
144
|
| (Drawn & { kind: "highlight"; rect: OverlayBox })
|
|
135
|
-
| (Drawn & { kind: "hook_title"; lines: string[]; place: string | null; fontSize: number; placeFontSize: number; box: OverlayBox })
|
|
145
|
+
| (Drawn & { kind: "hook_title"; lines: string[]; place: string | null; fontSize: number; placeFontSize: number; align?: OverlayAlign; box: OverlayBox })
|
|
136
146
|
| (Drawn & { kind: "search_bar"; text: string; fontSize: number; box: OverlayBox })
|
|
137
|
-
| (Drawn & { kind: "place_card"; lines: string[]; subtitle: string | null; fontSize: number; subtitleFontSize: number; box: OverlayBox })
|
|
147
|
+
| (Drawn & { kind: "place_card"; lines: string[]; subtitle: string | null; fontSize: number; subtitleFontSize: number; align?: OverlayAlign; box: OverlayBox })
|
|
138
148
|
| (Drawn & { kind: "counter"; value: number; from: number; decimals: number; unit: string | null; fontSize: number; unitFontSize: number; box: OverlayBox })
|
|
139
149
|
| (Drawn & { kind: "date_stamp"; text: string; place: string | null; fontSize: number; placeFontSize: number; side: OverlaySide; box: OverlayBox });
|
|
140
150
|
|
|
@@ -148,6 +158,8 @@ export interface ResolveOverlaysInput {
|
|
|
148
158
|
frame: { width: number; height: number };
|
|
149
159
|
/** The film's caption box (`getFootageCaptionLayout`). */
|
|
150
160
|
caption: CaptionLayout;
|
|
161
|
+
/** The brand's style: its `padding` pads every overlay card (absent: `m`, the cards' own padding). */
|
|
162
|
+
style?: Pick<BrandStyle, "padding">;
|
|
151
163
|
}
|
|
152
164
|
|
|
153
165
|
/** The part of the frame no platform interface covers: a 9:16 film's caption preset zone (`all` without one), else 80 px. */
|
|
@@ -184,6 +196,12 @@ function findOverlayStart(overlay: EdlOverlay, words: TimedWord[]): { ok: true;
|
|
|
184
196
|
const r1 = (value: number): number => Math.round(value * 10) / 10;
|
|
185
197
|
const r3 = (value: number): number => Math.round(value * 1000) / 1000 || 0;
|
|
186
198
|
|
|
199
|
+
/** A drawn overlay's padding round its text, in px: `OVERLAY_PADDING_EM` of its font size, scaled by its `padScale`. */
|
|
200
|
+
export function getOverlayPadding(overlay: { fontSize: number; padScale?: number }): { x: number; y: number } {
|
|
201
|
+
const scale = overlay.padScale ?? 1;
|
|
202
|
+
return { x: Math.round(overlay.fontSize * OVERLAY_PADDING_EM.x * scale), y: Math.round(overlay.fontSize * OVERLAY_PADDING_EM.y * scale) };
|
|
203
|
+
}
|
|
204
|
+
|
|
187
205
|
/** The estimated width of a line of text at a font size, in px (`OVERLAY_CHAR_EM` a letter). */
|
|
188
206
|
export function estimateTextWidth(text: string, fontSize: number): number {
|
|
189
207
|
return Math.ceil([...text].length * OVERLAY_CHAR_EM * fontSize - 1e-6);
|
|
@@ -249,7 +267,7 @@ export function getSideTextLines(overlay: SideTextOverlay): string[] {
|
|
|
249
267
|
export function getDrawnOverlayCard(overlay: ResolvedOverlay): OverlayBox | null {
|
|
250
268
|
if (overlay.kind !== "keyword" && overlay.kind !== "lower_third" && overlay.kind !== "list") return getOverlayBounds(overlay);
|
|
251
269
|
const { box, fontSize, side } = overlay;
|
|
252
|
-
const padX =
|
|
270
|
+
const padX = getOverlayPadding(overlay).x;
|
|
253
271
|
const textWidth = Math.max(0, ...getSideTextLines(overlay).map((line) => estimateTextWidth(line, fontSize)));
|
|
254
272
|
const width = Math.min(box.width, Math.ceil(textWidth + 2 * padX));
|
|
255
273
|
return { left: side === "right" ? box.left + box.width - width : box.left, top: box.top, width, height: box.height };
|
|
@@ -330,7 +348,7 @@ export function resolveEdlOverlays(input: ResolveOverlaysInput): ResolvedOverlay
|
|
|
330
348
|
}
|
|
331
349
|
}
|
|
332
350
|
const base = { index, start, end, segment };
|
|
333
|
-
const placed = placeOverlay(overlay, base, { zone, frame, band: getCaptionBand(input, segment) });
|
|
351
|
+
const placed = placeOverlay(overlay, base, { zone, frame, band: getCaptionBand(input, segment), padScale: STYLE_PADDING_SCALES[input.style?.padding ?? "m"] });
|
|
334
352
|
if (!placed.ok) {
|
|
335
353
|
problems.push(`${at}: ${placed.error}`);
|
|
336
354
|
return;
|
|
@@ -391,6 +409,8 @@ interface Placement {
|
|
|
391
409
|
zone: { top: number; bottom: number; left: number; right: number };
|
|
392
410
|
frame: { width: number; height: number };
|
|
393
411
|
band: { top: number; bottom: number } | null;
|
|
412
|
+
/** Every card's padding scale (`STYLE_PADDING_SCALES` of the brand's `padding`). */
|
|
413
|
+
padScale: number;
|
|
394
414
|
}
|
|
395
415
|
|
|
396
416
|
type Placed = { ok: true; overlay: ResolvedOverlay } | { ok: false; error: string };
|
|
@@ -435,7 +455,7 @@ function placeOverlay(overlay: EdlOverlay, base: OverlayBase, place: Placement):
|
|
|
435
455
|
const ease = r3(Math.min(PUNCH_IN_EASE_SECONDS, (base.end - base.start) / 2));
|
|
436
456
|
return { ok: true, overlay: { ...base, kind: "punch_in", scale: PUNCH_IN_SCALES[overlay.style?.size ?? "m"], ease } };
|
|
437
457
|
}
|
|
438
|
-
const drawn = { ...base, ...getLook(overlay) };
|
|
458
|
+
const drawn = { ...base, ...getLook(overlay), ...(place.padScale === 1 ? {} : { padScale: place.padScale }) };
|
|
439
459
|
if (overlay.kind === "arrow" || overlay.kind === "highlight") return placeMark(overlay, drawn, place);
|
|
440
460
|
if (overlay.kind === "keyword" || overlay.kind === "lower_third" || overlay.kind === "list") return placeSideText({ ...overlay, kind: overlay.kind }, drawn, place);
|
|
441
461
|
return placeCard({ ...overlay, kind: overlay.kind }, drawn, place);
|
|
@@ -473,7 +493,7 @@ function placeSideText(overlay: EdlOverlay & { kind: "keyword" | "lower_third" |
|
|
|
473
493
|
const scale = frame.width / 1080;
|
|
474
494
|
const side = overlay.style?.side ?? (overlay.kind === "keyword" ? "right" : "left");
|
|
475
495
|
const fontSize = Math.round(OVERLAY_FONT_SIZES[overlay.kind][overlay.style?.size ?? "m"] * scale);
|
|
476
|
-
const padY =
|
|
496
|
+
const padY = getOverlayPadding({ fontSize, padScale: place.padScale }).y;
|
|
477
497
|
const lines = overlay.kind === "list" ? (overlay.items ?? []).length : 1;
|
|
478
498
|
const lineHeight = overlay.kind === "list" ? OVERLAY_LIST_LINE_HEIGHT : OVERLAY_LINE_HEIGHT;
|
|
479
499
|
const height = Math.ceil(lines * fontSize * lineHeight + 2 * padY);
|
|
@@ -512,30 +532,99 @@ interface CardMetrics {
|
|
|
512
532
|
/** The widest the content may be, in px. */
|
|
513
533
|
room: number;
|
|
514
534
|
label: string;
|
|
535
|
+
/** The frame's width / 1080. */
|
|
536
|
+
scale: number;
|
|
515
537
|
}
|
|
516
538
|
|
|
517
539
|
const tooWide = (metrics: CardMetrics, what: string): CardResult => ({ ok: false, error: `the ${metrics.label}'s ${what} is too wide for one line; shorten it or use a smaller size` });
|
|
518
540
|
|
|
519
|
-
/**
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
541
|
+
/**
|
|
542
|
+
* A title's lines at a font size: two lines balanced so neither is much wider than the other (the narrower the
|
|
543
|
+
* wider of the two, the better), or the greedy wrap when it takes one line or more than two.
|
|
544
|
+
*/
|
|
545
|
+
export function wrapOverlayTitle(text: string, fontSize: number, width: number): string[] {
|
|
546
|
+
const lines = wrapOverlayText(text, fontSize, width);
|
|
547
|
+
if (lines.length !== 2) return lines;
|
|
548
|
+
const words = text.split(/\s+/).filter((part) => part.length > 0);
|
|
549
|
+
let best = lines;
|
|
550
|
+
let bestWidth = Math.max(...lines.map((line) => estimateTextWidth(line, fontSize)));
|
|
551
|
+
for (let split = 1; split < words.length; split++) {
|
|
552
|
+
const pair = [words.slice(0, split).join(" "), words.slice(split).join(" ")];
|
|
553
|
+
const widest = Math.max(...pair.map((line) => estimateTextWidth(line, fontSize)));
|
|
554
|
+
if (widest < bestWidth) [best, bestWidth] = [pair, widest];
|
|
555
|
+
}
|
|
556
|
+
return best;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/** A title's lines and font size: its own size, else smaller by `OVERLAY_TITLE_SHRINK` until it fits two lines; null when it never does. */
|
|
560
|
+
function fitTitle(text: string, fontSize: number, room: number): { lines: string[]; fontSize: number } | null {
|
|
561
|
+
for (let shrink = 0, size = fontSize; shrink <= MAX_TITLE_SHRINKS; shrink++, size = Math.round(size * OVERLAY_TITLE_SHRINK)) {
|
|
562
|
+
const lines = wrapOverlayTitle(text, size, room);
|
|
563
|
+
if (lines.length <= MAX_OVERLAY_TITLE_LINES && lines.every((line) => estimateTextWidth(line, size) <= room)) return { lines, fontSize: size };
|
|
525
564
|
}
|
|
565
|
+
return null;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* A place card's subtitle size: its `subtitle_size` of the title, at least `MIN_OVERLAY_SUBTITLE_PX`; a subtitle too
|
|
570
|
+
* long for that shrinks to fit `room`, never below the `s` step (the size every subtitle had before, so nothing that
|
|
571
|
+
* fitted then is refused now).
|
|
572
|
+
*/
|
|
573
|
+
function getSubtitleSize(input: { subtitle: string; titleSize: number; step: OverlaySize; room: number; scale: number }): number {
|
|
574
|
+
const wanted = Math.max(Math.round(MIN_OVERLAY_SUBTITLE_PX * input.scale), Math.round(input.titleSize * OVERLAY_SUBTITLE_SCALES[input.step]));
|
|
575
|
+
const fitting = Math.floor(input.room / ([...input.subtitle].length * OVERLAY_CHAR_EM));
|
|
576
|
+
return Math.min(wanted, Math.max(fitting, Math.round(input.titleSize * OVERLAY_SUBTITLE_SCALES.s)));
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
/** A hook title's or a place card's second line: the place label (with its pin) or the subtitle. */
|
|
580
|
+
type TitleOverlay = Extract<ResolvedOverlay, { kind: "hook_title" | "place_card" }>;
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* The text block of a hook title or a place card without its padding, in px: its widest line (the place label with
|
|
584
|
+
* its pin, the subtitle, each title line) and its height. Its card is this plus the padding, so the draft and the
|
|
585
|
+
* render find the block's left edge and top inside the card from it whatever the title's fitted size.
|
|
586
|
+
*/
|
|
587
|
+
export function getTitleContentSize(input: { kind: TitleOverlay["kind"]; lines: readonly string[]; fontSize: number; second: string | null; secondSize: number }): { width: number; height: number } {
|
|
588
|
+
const { kind, lines, fontSize, second, secondSize } = input;
|
|
589
|
+
const isHook = kind === "hook_title";
|
|
590
|
+
const secondWidth = second === null ? 0 : estimateTextWidth(second, secondSize) + (isHook ? Math.round(secondSize * 1.1) : 0);
|
|
591
|
+
const lineHeight = isHook ? OVERLAY_LINE_HEIGHT : OVERLAY_TITLE_LINE_HEIGHT;
|
|
592
|
+
return {
|
|
593
|
+
width: Math.max(secondWidth, ...lines.map((line) => estimateTextWidth(line, fontSize))),
|
|
594
|
+
height: lines.length * fontSize * lineHeight + (second === null ? 0 : secondSize * 1.3 + fontSize * 0.12),
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/** A resolved title's text block inside its card: its left edge and top, in px of the frame. */
|
|
599
|
+
export function getTitleContentBox(overlay: TitleOverlay): OverlayBox {
|
|
600
|
+
const second = overlay.kind === "hook_title" ? overlay.place : overlay.subtitle;
|
|
601
|
+
const secondSize = overlay.kind === "hook_title" ? overlay.placeFontSize : overlay.subtitleFontSize;
|
|
602
|
+
const size = getTitleContentSize({ kind: overlay.kind, lines: overlay.lines, fontSize: overlay.fontSize, second, secondSize });
|
|
603
|
+
const { box } = overlay;
|
|
604
|
+
return { left: box.left + (box.width - size.width) / 2, top: box.top + (box.height - size.height) / 2, width: size.width, height: size.height };
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/** A hook title's or a place card's lines and second line, aligned as its style says. */
|
|
608
|
+
function measureTitle(overlay: EdlOverlay & { kind: "hook_title" | "place_card" }, metrics: CardMetrics): CardResult {
|
|
609
|
+
const { room, label } = metrics;
|
|
610
|
+
const fitted = fitTitle(overlay.text ?? "", metrics.fontSize, room);
|
|
611
|
+
if (fitted === null) return { ok: false, error: `the ${label} takes more than ${MAX_OVERLAY_TITLE_LINES} lines even at a smaller size; shorten it or use a smaller size` };
|
|
612
|
+
const { lines, fontSize } = fitted;
|
|
526
613
|
const isHook = overlay.kind === "hook_title";
|
|
527
614
|
const second = (isHook ? overlay.place : overlay.subtitle) ?? null;
|
|
528
|
-
const secondSize =
|
|
615
|
+
const secondSize =
|
|
616
|
+
!isHook && second !== null
|
|
617
|
+
? getSubtitleSize({ subtitle: second, titleSize: metrics.fontSize, step: overlay.style?.subtitle_size ?? "m", room, scale: metrics.scale })
|
|
618
|
+
: Math.round(metrics.fontSize * OVERLAY_SECONDARY_SCALE[overlay.kind]);
|
|
529
619
|
// The hook title's place label carries a pin about one label line wide before it.
|
|
530
620
|
const secondWidth = second === null ? 0 : estimateTextWidth(second, secondSize) + (isHook ? Math.round(secondSize * 1.1) : 0);
|
|
531
621
|
if (secondWidth > room) return tooWide(metrics, isHook ? "place label" : "subtitle");
|
|
532
|
-
const
|
|
622
|
+
const align = overlay.style?.align ?? "center";
|
|
533
623
|
return {
|
|
534
624
|
ok: true,
|
|
535
625
|
content: {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
fields: isHook ? { kind: "hook_title", lines, place: second, fontSize, placeFontSize: secondSize } : { kind: "place_card", lines, subtitle: second, fontSize, subtitleFontSize: secondSize },
|
|
626
|
+
...getTitleContentSize({ kind: overlay.kind, lines, fontSize, second, secondSize }),
|
|
627
|
+
fields: isHook ? { kind: "hook_title", lines, place: second, fontSize, placeFontSize: secondSize, align } : { kind: "place_card", lines, subtitle: second, fontSize, subtitleFontSize: secondSize, align },
|
|
539
628
|
},
|
|
540
629
|
};
|
|
541
630
|
}
|
|
@@ -592,8 +681,8 @@ function placeCard(overlay: EdlOverlay & { kind: CardKind }, drawn: Drawn, place
|
|
|
592
681
|
const margin = Math.round(OVERLAY_MARGIN * scale);
|
|
593
682
|
const outer = frame.width - zone.left - zone.right - 2 * margin;
|
|
594
683
|
const fontSize = Math.round(OVERLAY_FONT_SIZES[overlay.kind][overlay.style?.size ?? "m"] * scale);
|
|
595
|
-
const pad = {
|
|
596
|
-
const metrics = { fontSize, pad, room: outer - 2 * pad.x, label: overlay.kind.replace("_", " ") };
|
|
684
|
+
const pad = getOverlayPadding({ fontSize, padScale: place.padScale });
|
|
685
|
+
const metrics = { fontSize, pad, room: outer - 2 * pad.x, label: overlay.kind.replace("_", " "), scale };
|
|
597
686
|
const measured =
|
|
598
687
|
overlay.kind === "hook_title" || overlay.kind === "place_card"
|
|
599
688
|
? measureTitle({ ...overlay, kind: overlay.kind }, metrics)
|
package/src/footage/pipeline.ts
CHANGED
|
@@ -747,7 +747,7 @@ async function runRenderFootage(
|
|
|
747
747
|
if (lowDisk.length > 0) return err(`not enough disk space to render: ${lowDisk.join(" ")}`);
|
|
748
748
|
const seconds = getFootageFilmSeconds(film, edl);
|
|
749
749
|
const words = remapWords(edl, transcript.words, film.cut.fillers);
|
|
750
|
-
const overlays = resolveEdlOverlays({ film, edl, words, frame: getFrame(film), caption: getFootageCaptionLayout(film, options.layout ?? {}) });
|
|
750
|
+
const overlays = resolveEdlOverlays({ film, edl, words, frame: getFrame(film), caption: getFootageCaptionLayout(film, options.layout ?? {}), ...(options.brand.style === undefined ? {} : { style: options.brand.style }) });
|
|
751
751
|
if (!overlays.ok) return err(`footage film ${film.id}: the EDL's overlays cannot be drawn: ${overlays.problems.join("; ")}`, { kind: "input" });
|
|
752
752
|
const music = await getMusic(film, edl, clips, seconds, options);
|
|
753
753
|
if (!music.ok) return music;
|
package/src/index.ts
CHANGED
|
@@ -63,6 +63,10 @@ export {
|
|
|
63
63
|
CAPTION_HIGHLIGHT_BOX_PADDING_EM,
|
|
64
64
|
CAPTION_HIGHLIGHT_BOX_RADIUS,
|
|
65
65
|
CAPTION_HIGHLIGHT_SECONDS,
|
|
66
|
+
CAPTION_ENTRANCE_SECONDS,
|
|
67
|
+
CAPTION_POP_FROM_SCALE,
|
|
68
|
+
CAPTION_UNDERLINE_EM,
|
|
69
|
+
getCaptionEntranceTween,
|
|
66
70
|
getCaptionHighlight,
|
|
67
71
|
getCaptionHighlightContrast,
|
|
68
72
|
type CaptionHighlightColors,
|
|
@@ -88,6 +92,8 @@ export {
|
|
|
88
92
|
MAX_OVERLAY_UNIT_LENGTH,
|
|
89
93
|
MIN_OVERLAY_SECONDS,
|
|
90
94
|
MIN_OVERLAY_TYPING_SPEED,
|
|
95
|
+
OVERLAY_ALIGNED_KINDS,
|
|
96
|
+
OVERLAY_ALIGNS,
|
|
91
97
|
OVERLAY_ENTRANCES,
|
|
92
98
|
OVERLAY_ENTRANCES_BY_KIND,
|
|
93
99
|
OVERLAY_KINDS,
|
|
@@ -102,6 +108,7 @@ export {
|
|
|
102
108
|
type EdlOverlayColors,
|
|
103
109
|
type EdlOverlayStyle,
|
|
104
110
|
type EdlOverlayWord,
|
|
111
|
+
type OverlayAlign,
|
|
105
112
|
type OverlayEntrance,
|
|
106
113
|
type OverlayKind,
|
|
107
114
|
type OverlayPosition,
|
|
@@ -133,12 +140,19 @@ export { createDraftTextMeasure, wrapDraftLine, type DraftTextMeasure } from "./
|
|
|
133
140
|
export {
|
|
134
141
|
OVERLAY_FONT_ROLES,
|
|
135
142
|
OVERLAY_FONT_SIZES,
|
|
143
|
+
OVERLAY_SUBTITLE_SCALES,
|
|
144
|
+
MIN_OVERLAY_SUBTITLE_PX,
|
|
145
|
+
OVERLAY_TITLE_SHRINK,
|
|
136
146
|
PUNCH_IN_EASE_SECONDS,
|
|
137
147
|
PUNCH_IN_SCALES,
|
|
138
148
|
findShotBreak,
|
|
139
149
|
formatOverlayNumber,
|
|
140
150
|
getDrawnOverlayCard,
|
|
141
151
|
getOverlayBounds,
|
|
152
|
+
getOverlayPadding,
|
|
153
|
+
getTitleContentBox,
|
|
154
|
+
getTitleContentSize,
|
|
155
|
+
wrapOverlayTitle,
|
|
142
156
|
getOverlaySafeZone,
|
|
143
157
|
getOverlayTexts,
|
|
144
158
|
getOverlayTextsByRole,
|
|
@@ -324,6 +338,7 @@ export {
|
|
|
324
338
|
CAPTION_PRESETS,
|
|
325
339
|
CAPTION_STYLES,
|
|
326
340
|
CAPTION_HIGHLIGHT_STYLES,
|
|
341
|
+
CAPTION_ENTRANCES,
|
|
327
342
|
DEFAULT_EDIT,
|
|
328
343
|
DEFAULT_END_CARD_SECONDS,
|
|
329
344
|
DEFAULT_LOGO_END_CARD_FADE_SECONDS,
|
|
@@ -336,6 +351,7 @@ export {
|
|
|
336
351
|
type CaptionPreset,
|
|
337
352
|
type CaptionStyle,
|
|
338
353
|
type CaptionHighlightStyle,
|
|
354
|
+
type CaptionEntrance,
|
|
339
355
|
type FootageEdit,
|
|
340
356
|
type ClipFit,
|
|
341
357
|
type ClipRole,
|