| use crate::vector::{VectorData, VectorDataTable}; | |
| use graph_craft::wasm_application_io::WasmEditorApi; | |
| use graphene_core::Ctx; | |
| pub use graphene_core::text::*; | |
| fn text<'i: 'n>( | |
| _: impl Ctx, | |
| editor: &'i WasmEditorApi, | |
| text: String, | |
| font_name: Font, | |
| font_size: f64, | |
| line_height_ratio: f64, | |
| character_spacing: f64, | |
| max_width: Option<f64>, | |
| max_height: Option<f64>, | |
| tilt: f64, | |
| ) -> VectorDataTable { | |
| let typesetting = TypesettingConfig { | |
| font_size, | |
| line_height_ratio, | |
| character_spacing, | |
| max_width, | |
| max_height, | |
| tilt, | |
| }; | |
| let font_data = editor.font_cache.get(&font_name).map(|f| load_font(f)); | |
| let result = VectorData::from_subpaths(to_path(&text, font_data, typesetting), false); | |
| VectorDataTable::new(result) | |
| } | |