Compare commits

...

3 Commits

Author SHA1 Message Date
+merlan #flirora
e60d3021a7
Add env setting for ignore_system_fonts (#6092) 2025-03-31 08:17:37 +00:00
Astra3
326bec1f0d
Correcting Czech translation in typst-library (#6101) 2025-03-31 08:16:47 +00:00
Myriad-Dreamin
758ee78ef5
Make World::font implementations safe (#6117) 2025-03-31 08:08:55 +00:00
6 changed files with 8 additions and 6 deletions

View File

@ -361,7 +361,7 @@ pub struct FontArgs {
/// Ensures system fonts won't be searched, unless explicitly included via
/// `--font-path`.
#[arg(long)]
#[arg(long, env = "TYPST_IGNORE_SYSTEM_FONTS")]
pub ignore_system_fonts: bool,
}

View File

@ -210,7 +210,9 @@ impl World for SystemWorld {
}
fn font(&self, index: usize) -> Option<Font> {
self.fonts[index].get()
// comemo's validation may invoke this function with an invalid index. This is
// impossible in typst-cli but possible if a custom tool mutates the fonts.
self.fonts.get(index)?.get()
}
fn today(&self, offset: Option<i64>) -> Option<Datetime> {

View File

@ -97,7 +97,7 @@ impl World for TestWorld {
}
fn font(&self, index: usize) -> Option<Font> {
Some(self.base.fonts[index].clone())
self.base.fonts.get(index).cloned()
}
fn today(&self, _: Option<i64>) -> Option<Datetime> {

View File

@ -4,5 +4,5 @@ equation = Rovnice
bibliography = Bibliografie
heading = Kapitola
outline = Obsah
raw = Seznam
raw = Výpis
page = strana

View File

@ -498,7 +498,7 @@ impl World for DocWorld {
}
fn font(&self, index: usize) -> Option<Font> {
Some(FONTS.1[index].clone())
FONTS.1.get(index).cloned()
}
fn today(&self, _: Option<i64>) -> Option<Datetime> {

View File

@ -67,7 +67,7 @@ impl World for TestWorld {
}
fn font(&self, index: usize) -> Option<Font> {
Some(self.base.fonts[index].clone())
self.base.fonts.get(index).cloned()
}
fn today(&self, _: Option<i64>) -> Option<Datetime> {