mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-11 08:47:59 +00:00
Add line height and character spacing to the Text node (#2016)
This commit is contained in:
parent
904cf09c79
commit
2d86fb24ab
10 changed files with 127 additions and 34 deletions
|
@ -3,7 +3,15 @@ use graph_craft::wasm_application_io::WasmEditorApi;
|
|||
pub use graphene_core::text::{bounding_box, load_face, to_path, Font, FontCache};
|
||||
|
||||
#[node_macro::node(category(""))]
|
||||
fn text<'i: 'n>(_: (), editor: &'i WasmEditorApi, text: String, font_name: Font, #[default(24)] font_size: f64) -> crate::vector::VectorData {
|
||||
fn text<'i: 'n>(
|
||||
_: (),
|
||||
editor: &'i WasmEditorApi,
|
||||
text: String,
|
||||
font_name: Font,
|
||||
#[default(24.)] font_size: f64,
|
||||
#[default(1.2)] line_height_ratio: f64,
|
||||
#[default(1.)] character_spacing: f64,
|
||||
) -> crate::vector::VectorData {
|
||||
let buzz_face = editor.font_cache.get(&font_name).map(|data| load_face(data));
|
||||
crate::vector::VectorData::from_subpaths(to_path(&text, buzz_face, font_size, None), false)
|
||||
crate::vector::VectorData::from_subpaths(to_path(&text, buzz_face, font_size, line_height_ratio, character_spacing, None), false)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue