1use svgbob::{to_svg_with_settings, Settings};2use wasm_bindgen::prelude::*;34/// Render one ASCII source using svgbob's pure library API.5///6/// The JavaScript adapter validates bounds and option syntax. Keeping this7/// wrapper free of DOM, filesystem, and network APIs makes it usable in a8/// Cloudflare Worker compiled-Wasm binding.910pub fn render(11 source: &str,12 background: &str,13 fill_color: &str,14 font_family: &str,15 font_size: u32,16 scale: f32,17 stroke_width: f32,18) -> String {19 let mut settings = Settings::default();20 settings.background = background.to_owned();21 settings.fill_color = fill_color.to_owned();22 settings.font_family = font_family.to_owned();23 settings.font_size = font_size as usize;24 // Kroki's `scale` is a multiplier over Svgbob's default scale (8.0).25 settings.scale = 8.0 * scale;26 settings.stroke_width = stroke_width;27 to_svg_with_settings(source, &settings)28}