summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Plumb <andrew@plumb.org>2012-02-18 17:10:06 (GMT)
committerAndrew Plumb <andrew@plumb.org>2012-02-18 17:10:06 (GMT)
commitbd5aac6f96ac7ecf3613fd81999bd82605925562 (patch)
treec6ed88af4106dd71f254a83629ebb008319bbee0
parent6038c8d6b15ed11951e6f2ca306106e531f68318 (diff)
MCAD/fonts with search() example.
Adding example023.scad demonstrating use of search() with MCAD/fonts.scad
-rw-r--r--examples/example023.scad30
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/example023.scad b/examples/example023.scad
new file mode 100644
index 0000000..3f59264
--- /dev/null
+++ b/examples/example023.scad
@@ -0,0 +1,30 @@
+// MCAD/fonts.scad with search() function example.
+
+use <MCAD/fonts.scad>
+
+thisFont=8bit_polyfont();
+thisText="OpenSCAD Rocks!";
+// Find one letter matches from 2nd column (index 1)
+theseIndicies=search(thisText,thisFont[2],1,1);
+// Letter spacing, x direction.
+x_shift=thisFont[0][0];
+y_shift=thisFont[0][1];
+echo(theseIndicies);
+// Simple polygon usage.
+for(i=[0:len(theseIndicies)-1]) translate([i*x_shift-len(theseIndicies)*x_shift/2,0]) {
+ polygon(points=thisFont[2][theseIndicies[i]][6][0],paths=thisFont[2][theseIndicies[i]][6][1]);
+}
+
+theseIndicies2=search("ABC",thisFont[2],1,1);
+// outline_2d() example
+for(i=[0:len(theseIndicies2)-1]) translate([i*x_shift-len(theseIndicies2)*x_shift,-y_shift]) {
+ outline_2d(outline=true,points=thisFont[2][theseIndicies2[i]][6][0],paths=thisFont[2][theseIndicies2[i]][6][1],width=0.25);
+}
+
+theseIndicies3=search("123",thisFont[2],1,1);
+// bold_2d() outline_2d(false) example
+for(i=[0:len(theseIndicies3)-1]) translate([i*x_shift,-2*y_shift]) {
+ bold_2d(bold=true,width=0.25,resolution=8)
+ outline_2d(false,thisFont[2][theseIndicies3[i]][6][0],thisFont[2][theseIndicies3[i]][6][1]);
+}
+
contact: Jan Huwald // Impressum