WIP Extract gtext

This commit is contained in:
Firestar99
2025-06-30 18:50:57 +02:00
parent 9f9a50e79a
commit e5c6a645de
11 changed files with 77 additions and 40 deletions

View File

@@ -35,6 +35,7 @@ graphene-application-io = { workspace = true }
graphene-element-nodes = { workspace = true }
graphene-raster-nodes = { workspace = true }
graphene-brush = { workspace = true }
graphene-text = { workspace = true }
# Workspace dependencies
fastnoise-lite = { workspace = true }

View File

@@ -1,6 +1,5 @@
pub mod any;
pub mod http;
pub mod text;
#[cfg(feature = "wasm")]
pub mod wasm_application_io;
@@ -13,6 +12,7 @@ pub use graphene_element_nodes::animation;
pub use graphene_math_nodes as math_nodes;
pub use graphene_path_bool as path_bool;
pub use graphene_raster_nodes as raster_nodes;
pub use graphene_text as text;
/// stop gap solutions until all paths have been replaced with their absolute ones
pub mod renderer {

View File

@@ -1,31 +0,0 @@
use crate::vector::{VectorData, VectorDataTable};
use graph_craft::wasm_application_io::WasmEditorApi;
use graphene_core::Ctx;
pub use graphene_core::text::*;
#[node_macro::node(category(""))]
fn text<'i: 'n>(
_: impl Ctx,
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,
#[default(None)] max_width: Option<f64>,
#[default(None)] max_height: Option<f64>,
) -> VectorDataTable {
let buzz_face = editor.font_cache.get(&font_name).map(|data| load_face(data));
let typesetting = TypesettingConfig {
font_size,
line_height_ratio,
character_spacing,
max_width,
max_height,
};
let result = VectorData::from_subpaths(to_path(&text, buzz_face, typesetting), false);
VectorDataTable::new(result)
}