Function to_cues

Source
pub fn to_cues(
    segs: &[Segment],
    max_chars: usize,
    lines: usize,
    min_dur: f64,
    cont: (&str, &str),
) -> Vec<(f64, f64, String)>
Expand description

Segments → subtitle cues: wrapped to max_chars per line, lines lines to a cue (joined with \n), timed by the word timings when there are any and proportionally to the characters otherwise, each held for at least min_dur unless the next cue needs the time. Where a sentence continues across the cue split, cont = (prefix, suffix) marks it: the suffix goes on the cut-off cue, the prefix on its continuation (e.g. ("…", " —")). ponytail: the marks are added after the wrap, so a marked line can run a few chars past max_chars.