mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 04:02:00 -06:00
Support override fonts (#378)
* Support override fonts * Compile fix * Actual compile fix * Use snake_case
This commit is contained in:
parent
6515d3025f
commit
4fc20c7c1c
1 changed files with 7 additions and 1 deletions
|
|
@ -1295,7 +1295,7 @@ const FONTS: [(&str, &str); 68] = [
|
|||
("Webdings", "webdings.woff2"),
|
||||
];
|
||||
lazy_static::lazy_static! {
|
||||
static ref FONT_REGEX: Regex = Regex::new(r"(?m)^Style:\s.+?,(?P<font>.+?),").unwrap();
|
||||
static ref FONT_REGEX: Regex = Regex::new(r"(?m)^(?:Style:\s.+?,(?P<font>.+?),|(?:Dialogue:\s(?:.+?,)+,\{(?:\\.*)?\\fn(?P<overrideFont>[\w\s]+)(?:\\.*)?)\})").unwrap();
|
||||
}
|
||||
|
||||
/// Get the fonts used in the subtitle.
|
||||
|
|
@ -1309,6 +1309,12 @@ fn get_subtitle_stats(path: &Path) -> Result<Vec<String>> {
|
|||
fonts.push(font_string)
|
||||
}
|
||||
}
|
||||
if let Some(override_font) = capture.name("overrideFont") {
|
||||
let font_string = override_font.as_str().to_string();
|
||||
if !fonts.contains(&font_string) {
|
||||
fonts.push(font_string)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(fonts)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue