Files
texrra-engine/tests/support/native_fonts.rs
T

24 lines
913 B
Rust

//! Native CLI tests explicitly supply real font resources; runtime lookup has
//! no installed-distribution or bundled-font fallback.
use std::{path::PathBuf, process::Command, sync::OnceLock};
pub fn command() -> Command {
static MAP: OnceLock<PathBuf> = OnceLock::new();
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
let map = MAP.get_or_init(|| {
let r = Command::new("kpsewhich")
.arg("pdftex.map")
.output()
.expect("reference font map required");
assert!(r.status.success());
PathBuf::from(String::from_utf8(r.stdout).unwrap().trim())
.parent()
.unwrap()
.to_owned()
});
let mut c = Command::new(env!("CARGO_BIN_EXE_texrra"));
c.env("TFMFONTS", root.join("crates/texrra-tex-core/assets"));
c.env("T1FONTS", root.join("assets/fonts"));
c.env("TEXFONTMAPS", map);
c
}