Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.
TypeScript 3dagent-skillsai-agentsai-videobevyclaude-codegame-enginegpulinuxmacosmotion-designmotion-graphicsreactrusttypescriptvideo-editingvideo-renderingwgpuwindows
A font-family whose first family isn't there is a render warning, naming the font drawn instead (#174)
shinyobjectzda2026297618
diff --git a/engine/cli/src/cli.rs b/engine/cli/src/cli.rsindex 9d8f6d54..591a4248 100644--- a/engine/cli/src/cli.rs+++ b/engine/cli/src/cli.rs@@ -54,8 +54,8 @@ pub fn cli(args: &[String]) -> i32 {let still = flag(args, "-o").map(PathBuf::from).filter(|o| o.is_file() && matches!(o.extension().and_then(|e| e.to_str()), Some("png" | "jpg" | "jpeg" | "webp")));if let Some(o) = still { raea_io_media::sign::sign_file(&o, raea_io_media::sign::Made::Created); }}- // and once, what the page asked for and didn't get (#34: dropped CSS, loads that failed)- let said = raea_runtime_export::not_applied::said().filter(|_| args.first().is_some_and(|a| a == "render"));+ // and once, what the page asked for and didn't get (#34: dropped CSS, loads that failed; #174: fonts)+ let said = args.first().is_some_and(|a| a == "render").then(raea_runtime_export::render_said).flatten();for line in [msg].into_iter().chain(said).filter(|m| !m.is_empty()) {println!("{line}");}diff --git a/runtime/export/src/lib.rs b/runtime/export/src/lib.rsindex beae4033..5a1a5794 100644--- a/runtime/export/src/lib.rs+++ b/runtime/export/src/lib.rs@@ -67,6 +67,19 @@ pub(crate) struct Sound {/// `render --manifest PATH` (the CLI's; render_bundle keeps its signature for the iPhone): where render.json goes.static MANIFEST: std::sync::Mutex<Option<PathBuf>> = std::sync::Mutex::new(None);+/// What `raea render` says once its frames are out: the fonts the page asked for and didn't have (#174) as warnings,+/// printed and counted with its findings (raea-app-direction's `rendered` keeps them in the manifest), and the note of+/// what else it didn't apply (#34), returned for the render to print.+pub fn render_said() -> Option<String> {+ let fix = "load it with @font-face (a staticFile font), install it, or name a family that's there";+ let fs: Vec<raea_core_facts::Finding> = not_applied::fonts_missing().into_iter().map(|says| raea_core_facts::Finding::new("font-missing", raea_core_facts::Level::Warn, says, "raea render").fix(fix)).collect();+ for f in &fs {+ eprintln!("raea: {}", f.line());+ }+ raea_core_facts::finding::said(&fs);+ not_applied::said()+}+/// The manifest, its folder made first (2D stills write it before their frames): the composition's length in frames/// (whatever was rendered of it; raea check --quick samples by it, #86), boxes as drawn, findings, sounds, and whether/// it drew 3D (an export in layers draws the 3D in the layer under the page, docs/layers.feature LA2a).diff --git a/vendor/blitz-dom/src/layout/construct.rs b/vendor/blitz-dom/src/layout/construct.rsindex f0f52692..75580d28 100644--- a/vendor/blitz-dom/src/layout/construct.rs+++ b/vendor/blitz-dom/src/layout/construct.rs@@ -1167,6 +1167,8 @@ pub(crate) fn build_inline_layout_into(}text_layout.text = builder.build_into(&mut text_layout.layout);text_layout.text_nodes = std::mem::take(&mut text_transformer.texts);+ // raea: the families its styles asked for, checked now that the builder has let go of the fonts (#174)+ crate::not_applied::check_families(font_ctx);return;fn build_inline_layout_recursive(diff --git a/vendor/blitz-dom/src/not_applied.rs b/vendor/blitz-dom/src/not_applied.rsindex 04472e09..25da8b31 100644--- a/vendor/blitz-dom/src/not_applied.rs+++ b/vendor/blitz-dom/src/not_applied.rs@@ -82,3 +82,85 @@ pub fn said() -> Option<String> {let list: String = all.iter().take(20).map(|w| format!("\n {w}")).collect();(n > 0).then(|| format!("NOTE the page didn't apply {n} thing{}, and is drawn without {}:{list}{more}", if n == 1 { "" } else { "s" }, if n == 1 { "it" } else { "them" }))}++// ---- fonts (#174) ----------------------------------------------------------------------------------------------------+// A font-family list whose first family isn't installed or loaded draws in the next family that is (the browser's+// serif, Times, when none is), and nothing said so: a web font that didn't load turned a whole video into Times. The+// first named family of each list a text layout uses is asked about as the style is made (`ask_family`) and checked+// against the fonts once that layout is built (`check_families`: the layout's builder holds the font context until+// then). Each miss is kept once as `font "X" not found: drawn in Y` for the render to say as a warning+// (`fonts_missing`). A family that turns up later (a web font still loading at the first layout) takes its line back.+// The platform names for the system face that CSS writes first for other browsers (-apple-system and+// BlinkMacSystemFont off Apple, ui-sans-serif and the other ui- names) aren't checked, and neither is a list bevy_text+// made (it ends in "raea-bevy fallback", and falls to the collection's fallbacks by design).++enum Asked {+ Named(String),+ Generic(parley::GenericFamily),+}++thread_local! {+ /// the lists asked about on this thread since its last layout was built, one a first family+ static ASKED: std::cell::RefCell<Vec<Vec<Asked>>> = const { std::cell::RefCell::new(Vec::new()) };+ /// first families found already: never asked about again+ static FOUND: std::cell::RefCell<std::collections::HashSet<String>> = std::cell::RefCell::new(std::collections::HashSet::new());+}++static FONTS: Mutex<Vec<String>> = Mutex::new(Vec::new());++/// A name CSS writes for the system face that this platform's fonts don't carry (the face is the next in the list).+fn platform_name(name: &str) -> bool {+ let n = name.to_ascii_lowercase();+ n.starts_with("ui-") || n == "-apple-system" || n == "blinkmacsystemfont"+}++/// A text style's family list (stylo_to_parley's), its first family asked about when it's named.+pub(crate) fn ask_family(families: &[parley::FontFamilyName<'_>]) {+ let Some(parley::FontFamilyName::Named(first)) = families.first() else { return };+ if platform_name(first) || families.iter().any(|f| matches!(f, parley::FontFamilyName::Named(n) if n.as_ref() == "raea-bevy fallback")) {+ return;+ }+ if FOUND.with(|f| f.borrow().contains(first.as_ref())) {+ return;+ }+ ASKED.with(|a| {+ let mut a = a.borrow_mut();+ if a.len() < 64 && !a.iter().any(|l| matches!(l.first(), Some(Asked::Named(n)) if n.as_str() == first.as_ref())) {+ a.push(families.iter().map(|f| match f {+ parley::FontFamilyName::Named(n) => Asked::Named(n.to_string()),+ parley::FontFamilyName::Generic(g) => Asked::Generic(*g),+ }).collect());+ }+ });+}++/// The lists asked about on this thread, checked against `fcx`'s fonts (after a layout is built).+pub(crate) fn check_families(fcx: &mut parley::FontContext) {+ let asked = ASKED.with(|a| std::mem::take(&mut *a.borrow_mut()));+ for list in asked {+ let Some(Asked::Named(first)) = list.first() else { continue };+ let missing = format!("font \"{first}\" not found");+ if fcx.collection.family_by_name(first).is_some() {+ FOUND.with(|f| f.borrow_mut().insert(first.clone()));+ FONTS.lock().unwrap_or_else(|e| e.into_inner()).retain(|l| !l.starts_with(&missing));+ continue;+ }+ let drawn = list[1..].iter().find_map(|f| match f {+ Asked::Named(n) => fcx.collection.family_by_name(n).map(|i| i.name().to_string()),+ Asked::Generic(g) => {+ let id = fcx.collection.generic_families(*g).next()?;+ fcx.collection.family_name(id).map(str::to_string)+ }+ });+ let line = format!("{missing}: drawn in {}", drawn.as_deref().unwrap_or("the platform's fallback"));+ let mut fonts = FONTS.lock().unwrap_or_else(|e| e.into_inner());+ if !fonts.contains(&line) {+ fonts.push(line);+ }+ }+}++/// The fonts a page asked for and didn't have, taken: `font "X" not found: drawn in Y`, in the order first met.+pub fn fonts_missing() -> Vec<String> {+ std::mem::take(&mut *FONTS.lock().unwrap_or_else(|e| e.into_inner()))+}diff --git a/vendor/blitz-dom/src/stylo_to_parley.rs b/vendor/blitz-dom/src/stylo_to_parley.rsindex a8a0da0d..f666c410 100644--- a/vendor/blitz-dom/src/stylo_to_parley.rs+++ b/vendor/blitz-dom/src/stylo_to_parley.rs@@ -499,6 +499,8 @@ pub(crate) fn style(if !bevy_fallback && !families.iter().any(|f| matches!(f, parley::FontFamilyName::Generic(_))) {families.push(parley::FontFamilyName::Generic(parley::GenericFamily::Serif));}+ // raea: the list's first family, if named, is checked against the fonts once the layout is built (#174)+ crate::not_applied::ask_family(&families);// Wrapping and breakinglet word_break = match itext_styles.word_break {diff --git a/vendor/vendor.toml b/vendor/vendor.tomlindex 68cfa063..3677baac 100644--- a/vendor/vendor.toml+++ b/vendor/vendor.toml@@ -105,7 +105,7 @@ exit = "anyrender's filter graph having both"path = "vendor/anyrender_svg"upstream = "crates.io:0.15.0"kind = "patch"-reason = "SVG masks, filter effects (on raea-page's GPU passes) and patterns, drawn as error boxes upstream; drawings clipped to their viewport"+reason = "SVG masks, filter effects (on raea-page's GPU passes) and patterns, drawn as error boxes upstream; drawings clipped to their viewport; a font-family whose first family isn't there kept (not_applied::fonts_missing) for the render to say as a warning, with the family drawn instead (raea #174)"exit = "anyrender_svg drawing these"[vello_encoding]