diff options
author | Marius Kintel <marius@kintel.net> | 2012-02-18 13:00:15 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2012-02-18 13:00:15 (GMT) |
commit | 1b63103f636ae2cbc68ee29eadce2d26f02d38c8 (patch) | |
tree | 5b38d881ee2addecccd3ce578d5b9ce830955595 /testdata/scad/features/text-search-test.scad | |
parent | 89ffc684864c8e109e4c0ea5c9ba61a407179c60 (diff) | |
parent | a6678827b797b50b9dfea5cd1c0fc6a33f310872 (diff) |
Merge branch 'clothbot-search_function'
Diffstat (limited to 'testdata/scad/features/text-search-test.scad')
-rw-r--r-- | testdata/scad/features/text-search-test.scad | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/testdata/scad/features/text-search-test.scad b/testdata/scad/features/text-search-test.scad new file mode 100644 index 0000000..8b6047f --- /dev/null +++ b/testdata/scad/features/text-search-test.scad @@ -0,0 +1,29 @@ +// fonts test + +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]); +}
\ No newline at end of file |