pub struct CaptionStyle { /* private fields */ }Expand description
production subtitle style with an explicit safe area and frozen font environment.
Implementations§
Source§impl CaptionStyle
impl CaptionStyle
Sourcepub fn new(safe: Rect) -> Self
pub fn new(safe: Rect) -> Self
Defaults to 30-unit white text, translucent black, padding 12/8 and two lines.
Sourcepub fn background(self, color: Color) -> Self
pub fn background(self, color: Color) -> Self
Replaces the shared backplate color.
Sourcepub fn padding(self, horizontal: f64, vertical: f64) -> Self
pub fn padding(self, horizontal: f64, vertical: f64) -> Self
Replaces nonnegative horizontal/vertical padding, each at most 4096.
Sourcepub fn gap(self, gap: f64) -> Self
pub fn gap(self, gap: f64) -> Self
Replaces the nonnegative gap between simultaneous cues, at most 4096.
Sourcepub fn max_lines(self, lines: usize) -> Self
pub fn max_lines(self, lines: usize) -> Self
Replaces the per-cue line limit in 1..=8; excess text is rejected.
Sourcepub fn keyword(self, word: impl Into<String>, color: Color) -> Self
pub fn keyword(self, word: impl Into<String>, color: Color) -> Self
Adds a grapheme-safe literal keyword; longest match and then insertion order win.
Sourcepub fn layout(
&self,
track: &CaptionTrack,
canvas: Size,
fonts: &FontLibrary,
) -> Result<CaptionLayout>
pub fn layout( &self, track: &CaptionTrack, canvas: Size, fonts: &FontLibrary, ) -> Result<CaptionLayout>
Measures with supplied fonts and freezes vector artwork before frame evaluation. At most 1024 cues/128 KiB source and explicit per-cue line/safe-area limits apply.
Trait Implementations§
Source§impl Clone for CaptionStyle
impl Clone for CaptionStyle
Auto Trait Implementations§
impl Forget for CaptionStyle
impl Freeze for CaptionStyle
impl Move for CaptionStyle
impl RefUnwindSafe for CaptionStyle
impl Send for CaptionStyle
impl Sync for CaptionStyle
impl Unpin for CaptionStyle
impl UnsafeUnpin for CaptionStyle
impl UnwindSafe for CaptionStyle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more