Skip to content

FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust

fix: document that the caption track margin is a fraction of the frame height

Brandon Thomasd90b9c8ee2be
diff --git a/crates/engine/src/captions.rs b/crates/engine/src/captions.rs
index 2bcb97634..4fd7666e3 100644
--- a/crates/engine/src/captions.rs
+++ b/crates/engine/src/captions.rs
@@ -296,7 +296,7 @@ pub fn commands() -> Vec<CommandSpec> {
"Caption Track Style",
&[],
None,
- r##"{"track":id|"C1","font":str?,"size":f32?,"color":"#rrggbb[aa]"?,"background":bool?,"backgroundColor":"#rrggbbaa"?,"align":"left|center|right"?,"anchor":"top|middle|bottom"?,"margin":f32?,"lineSpacing":f32?,"outline":f32?,"outlineColor":str?,"reset":bool?}"##,
+ r##"{"track":id|"C1","font":str?,"size":f32?,"color":"#rrggbb[aa]"?,"background":bool?,"backgroundColor":"#rrggbbaa"?,"align":"left|center|right"?,"anchor":"top|middle|bottom"?,"margin":0..0.45 (fraction of frame height)?,"lineSpacing":f32?,"outline":f32?,"outlineColor":str?,"reset":bool?}"##,
has_caption_track,
|s, p| {
let tid = track_param(s, p).ok_or_else(|| bad("captions.setStyle", "no such caption track"))?;
diff --git a/docs/captions.md b/docs/captions.md
index b8c03f0a4..1ed4f7b52 100644
--- a/docs/captions.md
+++ b/docs/captions.md
@@ -11,7 +11,8 @@ version 2; version 1 projects open with no caption tracks).
burned in on export), lock, sync lock, and a **track style**:
font size (pixels at 1080 lines, scaled to the frame), text colour, background box and its colour,
outline width and colour, alignment (left/centre/right), position (top/middle/bottom) and
- margin, line spacing.
+ margin (a fraction of the frame height, default 0.08; `captions.setStyle` clamps it to 0–0.45),
+ line spacing.
- **Caption**: in/out in exact `Tick`s, text (lines separated by `\n`; `<i>`, `<b>`, `<u>` kept
as written), optional speaker, and the WebVTT cue id and cue settings, kept for round trips.
Captions on a track never overlap.