Download node-graph/gstd/src/text.rs from openfree/graphite2: direct link, hf CLI and curl.
- Browser
- Download file 964 Bytes
-
https://huggingface.co/spaces/openfree/graphite2/resolve/main/node-graph/gstd/src/text.rs
- Command line
-
hf download hf://spaces/openfree/graphite2/node-graph/gstd/src/text.rs
-
curl -L -o text.rs https://huggingface.co/spaces/openfree/graphite2/resolve/main/node-graph/gstd/src/text.rs
964 Bytes
| 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) | |
| } | |