From 6bea0676787f21b84de2fcc79c85ee54549c6571 Mon Sep 17 00:00:00 2001 From: Garth Minette Date: Tue, 18 Jan 2022 22:16:23 -0800 Subject: [PATCH] Corrected text() and text3d() docs. --- shapes2d.scad | 8 +++++++- shapes3d.scad | 17 +++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/shapes2d.scad b/shapes2d.scad index 52ad6d1..d523dfe 100644 --- a/shapes2d.scad +++ b/shapes2d.scad @@ -1486,7 +1486,7 @@ function reuleaux_polygon(N=3, r, d, anchor=CENTER, spin=0) = // Module: text() // Topics: Attachments, Text // Usage: -// text(text, [size], [font]); +// text(text, [size], [font], ...); // Description: // Creates a 3D text block that can be attached to other attachable objects. // NOTE: This cannot have children attached to it. @@ -1495,6 +1495,12 @@ function reuleaux_polygon(N=3, r, d, anchor=CENTER, spin=0) = // size = The font size used to create the text block. Default: 10 // font = The name of the font used to create the text block. Default: "Helvetica" // --- +// halign = If given, specifies the horizontal alignment of the text. `"left"`, `"center"`, or `"right"`. Overrides `anchor=`. +// valign = If given, specifies the vertical alignment of the text. `"top"`, `"center"`, `"baseline"` or `"bottom"`. Overrides `anchor=`. +// spacing = The relative spacing multiplier between characters. Default: `1.0` +// direction = The text direction. `"ltr"` for left to right. `"rtl"` for right to left. `"ttb"` for top to bottom. `"btt"` for bottom to top. Default: `"ltr"` +// language = The language the text is in. Default: `"en"` +// script = The script the text is in. Default: `"latin"` // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `"baseline"` // spin = Rotate this many degrees around the Z axis. See [spin](attachments.scad#subsection-spin). Default: `0` // See Also: attachable() diff --git a/shapes3d.scad b/shapes3d.scad index e26948a..d2b6a62 100644 --- a/shapes3d.scad +++ b/shapes3d.scad @@ -1835,7 +1835,6 @@ function spheroid(r, style="aligned", d, circum=false, anchor=CENTER, spin=0, or // Creates a torus shape. // // Figure(2D,Med): -// module text3d(t,size=8) text(text=t,size=size,font="Helvetica", halign="center",valign="center"); // module dashcirc(r,start=0,angle=359.9,dashlen=5) let(step=360*dashlen/(2*r*PI)) for(a=[start:step:start+angle]) stroke(arc(r=r,start=a,angle=step/2)); // r = 75; r2 = 30; // down(r2+0.1) #torus(r_maj=r, r_min=r2, $fn=72); @@ -1847,19 +1846,19 @@ function spheroid(r, style="aligned", d, circum=false, anchor=CENTER, spin=0, or // } // rot(240) color("blue") linear_extrude(height=0.01) { // stroke([[0,0],[r+r2,0]], endcaps="arrow2",width=2); -// right(r) fwd(9) rot(-240) text3d("or",size=10); +// right(r) fwd(9) rot(-240) text("or",size=10,anchor=CENTER); // } // rot(135) color("blue") linear_extrude(height=0.01) { // stroke([[0,0],[r-r2,0]], endcaps="arrow2",width=2); -// right((r-r2)/2) back(8) rot(-135) text3d("ir",size=10); +// right((r-r2)/2) back(8) rot(-135) text("ir",size=10,anchor=CENTER); // } // rot(45) color("blue") linear_extrude(height=0.01) { // stroke([[0,0],[r,0]], endcaps="arrow2",width=2); -// right(r/2) back(8) text3d("r_maj",size=9); +// right(r/2) back(8) text("r_maj",size=9,anchor=CENTER); // } // rot(30) color("blue") linear_extrude(height=0.01) { // stroke([[r,0],[r+r2,0]], endcaps="arrow2",width=2); -// right(r+r2/2) fwd(8) text3d("r_min",size=7); +// right(r+r2/2) fwd(8) text("r_min",size=7,anchor=CENTER); // } // // Arguments: @@ -2074,7 +2073,7 @@ module onion(r, ang=45, cap_h, d, anchor=CENTER, spin=0, orient=UP) // Module: text3d() // Topics: Attachments, Text // Usage: -// text3d(text, [h], [size], [font]); +// text3d(text, [h], [size], [font], ...); // Description: // Creates a 3D text block that can be attached to other attachable objects. // NOTE: This cannot have children attached to it. @@ -2084,6 +2083,12 @@ module onion(r, ang=45, cap_h, d, anchor=CENTER, spin=0, orient=UP) // size = The font size used to create the text block. Default: 10 // font = The name of the font used to create the text block. Default: "Helvetica" // --- +// halign = If given, specifies the horizontal alignment of the text. `"left"`, `"center"`, or `"right"`. Overrides `anchor=`. +// valign = If given, specifies the vertical alignment of the text. `"top"`, `"center"`, `"baseline"` or `"bottom"`. Overrides `anchor=`. +// spacing = The relative spacing multiplier between characters. Default: `1.0` +// direction = The text direction. `"ltr"` for left to right. `"rtl"` for right to left. `"ttb"` for top to bottom. `"btt"` for bottom to top. Default: `"ltr"` +// language = The language the text is in. Default: `"en"` +// script = The script the text is in. Default: `"latin"` // anchor = Translate so anchor point is at origin (0,0,0). See [anchor](attachments.scad#subsection-anchor). Default: `"baseline"` // spin = Rotate this many degrees around the Z axis. See [spin](attachments.scad#subsection-spin). Default: `0` // orient = Vector to rotate top towards. See [orient](attachments.scad#subsection-orient). Default: `UP`