Skip to content

Commit 5f4d01c

Browse files
committed
Add SVG 2 textPath enums and node parameters
1 parent a558fb8 commit 5f4d01c

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

node-graph/graph-craft/src/document/value.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ tagged_value! {
275275
TextAlign(text_nodes::TextAlign),
276276
TextPathSide(text_nodes::text_on_path::TextPathSide),
277277
TextAnchor(text_nodes::text_on_path::TextAnchor),
278+
TextPathMethod(text_nodes::text_on_path::TextPathMethod),
279+
TextPathSpacing(text_nodes::text_on_path::TextPathSpacing),
280+
LengthAdjust(text_nodes::text_on_path::LengthAdjust),
278281
ScaleType(core_types::transform::ScaleType),
279282
}
280283

node-graph/nodes/gstd/src/text.rs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use core_types::{Ctx, table::Table};
22
use graph_craft::wasm_application_io::WasmEditorApi;
33
use graphic_types::Vector;
4-
pub use text_nodes::text_on_path::{TextAnchor, TextPathSide};
4+
pub use text_nodes::text_on_path::{LengthAdjust, TextAnchor, TextPathMethod, TextPathSide, TextPathSpacing};
55
pub use text_nodes::*;
66

77
/// Draws a text string as vector geometry with a choice of font and styling.
@@ -106,6 +106,28 @@ fn text_on_path<'i: 'n>(
106106
side: text_nodes::text_on_path::TextPathSide,
107107
/// Text anchor point — affects where along the path the text is anchored.
108108
text_anchor: text_nodes::text_on_path::TextAnchor,
109+
/// Glyph rendering method. 'Align' uses rigid transforms; 'Stretch' warps glyphs along the path curvature.
110+
method: text_nodes::text_on_path::TextPathMethod,
111+
/// Spacing mode. 'Exact' uses computed positions; 'Auto' adjusts for path curvature.
112+
spacing: text_nodes::text_on_path::TextPathSpacing,
113+
/// Whether a forced text length is enabled.
114+
#[widget(ParsedWidgetOverride::Hidden)]
115+
has_text_length: bool,
116+
/// If set, forces the total text advance to this length along the path.
117+
#[unit(" px")]
118+
#[hard_min(0.)]
119+
text_length: f64,
120+
/// How to fit text to the forced text length: adjust spacing only, or spacing and glyph widths.
121+
length_adjust: text_nodes::text_on_path::LengthAdjust,
122+
/// Whether a custom path authoring length is enabled.
123+
#[widget(ParsedWidgetOverride::Hidden)]
124+
has_path_length: bool,
125+
/// Authoring path length for scaling startOffset. Maps the offset to the actual path length.
126+
#[unit(" px")]
127+
#[hard_min(0.)]
128+
path_length: f64,
129+
/// Right-to-left text direction.
130+
rtl: bool,
109131
) -> Table<Vector> {
110132
text_nodes::text_on_path::place_text_on_path(
111133
&text,
@@ -117,6 +139,13 @@ fn text_on_path<'i: 'n>(
117139
start_offset_percent,
118140
side,
119141
text_anchor,
142+
method,
143+
spacing,
144+
has_text_length.then_some(text_length),
145+
length_adjust,
146+
has_path_length.then_some(path_length),
147+
rtl,
120148
&editor_resources.font_cache,
121149
)
122150
}
151+

0 commit comments

Comments
 (0)