@@ -3,41 +3,63 @@ use graph_craft::wasm_application_io::WasmEditorApi;
33use graphic_types:: Vector ;
44pub use text_nodes:: * ;
55
6+ /// Draws a text string as vector geometry with a choice of font and styling.
67#[ node_macro:: node( category( "Text" ) ) ]
78fn text < ' i : ' n > (
89 _: impl Ctx ,
9- #[ scope( "editor-api" ) ] editor_resources : & ' i WasmEditorApi ,
10+ /// The Graphite editor's source for global font resources.
11+ #[ scope( "editor-api" ) ]
12+ editor_resources : & ' i WasmEditorApi ,
13+ /// The text content to be drawn.
1014 #[ widget( ParsedWidgetOverride :: Custom = "text_area" ) ]
1115 #[ default( "Lorem ipsum" ) ]
1216 text : String ,
13- #[ widget( ParsedWidgetOverride :: Custom = "text_font" ) ] font : Font ,
17+ /// The typeface used to draw the text.
18+ #[ widget( ParsedWidgetOverride :: Custom = "text_font" ) ]
19+ font : Font ,
20+ /// The font size used to draw the text.
1421 #[ unit( " px" ) ]
1522 #[ default( 24. ) ]
1623 #[ hard_min( 1. ) ]
1724 size : f64 ,
25+ /// The line height ratio, relative to the font size. Each line is drawn lower than its previous line by the distance of *Size* × *Line Height*.
26+ ///
27+ /// 0 means all lines overlap. 1 means all lines are spaced by just the font size. 1.2 is a common default for readable text. 2 means double-spaced text.
1828 #[ unit( "x" ) ]
1929 #[ hard_min( 0. ) ]
2030 #[ step( 0.1 ) ]
2131 #[ default ( 1.2 ) ]
2232 line_height : f64 ,
33+ /// Additional spacing, in pixels, added between each character.
2334 #[ unit( " px" ) ]
2435 #[ step( 0.1 ) ]
2536 character_spacing : f64 ,
26- #[ widget( ParsedWidgetOverride :: Hidden ) ] has_max_width : bool ,
37+ /// Whether the *Max Width* property is enabled so that lines can wrap to fit its specified block width.
38+ #[ widget( ParsedWidgetOverride :: Hidden ) ]
39+ has_max_width : bool ,
40+ /// The maximum width that the text block can occupy before wrapping to a new line. Otherwise, lines do not wrap.
2741 #[ unit( " px" ) ]
2842 #[ hard_min( 1. ) ]
2943 #[ widget( ParsedWidgetOverride :: Custom = "optional_f64" ) ]
3044 max_width : f64 ,
31- #[ widget( ParsedWidgetOverride :: Hidden ) ] has_max_height : bool ,
45+ /// Whether the *Max Height* property is enabled so that lines beyond it are not drawn.
46+ #[ widget( ParsedWidgetOverride :: Hidden ) ]
47+ has_max_height : bool ,
48+ /// The maximum height that the text block can occupy. Excess lines are not drawn.
3249 #[ unit( " px" ) ]
3350 #[ hard_min( 1. ) ]
3451 #[ widget( ParsedWidgetOverride :: Custom = "optional_f64" ) ]
3552 max_height : f64 ,
53+ /// The angle of faux italic slant applied to each glyph.
3654 #[ unit( "°" ) ]
3755 #[ hard_min( -85. ) ]
3856 #[ hard_max( 85. ) ]
3957 tilt : f64 ,
40- #[ widget( ParsedWidgetOverride :: Custom = "text_align" ) ] align : TextAlign ,
58+ /// The horizontal alignment of each line of text within its surrounding box.
59+ /// To have an effect on a single line of text, *Max Width* must be set.
60+ #[ widget( ParsedWidgetOverride :: Custom = "text_align" ) ]
61+ align : TextAlign ,
62+ /// Whether to split every letterform into its own vector path element. Otherwise, a single compound path is produced.
4163 separate_glyph_elements : bool ,
4264) -> Table < Vector > {
4365 let typesetting = TypesettingConfig {
0 commit comments