LaserFont

Just as small single line font ideal for lasercutting  I made in processing (only numbers implemented).

 

 

{syntaxhighlighter brush: java;gutter: false; light: true; fontsize: 100; first-line: 1; }//for #gx30 ;) //corneel cannaerts void setup(){ size(400,400); } void draw(){ laserFont("123",170,170,20); } // simple line and arc font for laser engraving void laserFont(String message, float x, float y, float fs) { pushMatrix(); translate(x,y); noFill(); for(int i=0; i< message.length(); i++) { char c = message.charAt(i); switch(c) { case '0': arc(fs*0.5, fs*0.5, fs, fs, TWO_PI-PI, TWO_PI); line(0,fs*0.5,0,fs*1.5); arc(fs*0.5, fs*1.5, fs, fs, TWO_PI, TWO_PI+PI); line(fs,fs*0.5,fs,fs*1.5); break; case '1': line(0,fs*0.5,fs*0.5,0); line(fs*0.5,0,fs*0.5,fs*2); line(0,fs*2,fs,fs*2); break; case '2': arc(fs*0.5, fs*0.5, fs, fs, TWO_PI-PI, TWO_PI); line(fs,fs*0.5,0,fs*2); line(0,fs*2,fs,fs*2); break; case '3': arc(fs*0.5, fs*0.5, fs, fs, TWO_PI-PI, TWO_PI+PI/2); arc(fs*0.5, fs*1.5, fs, fs, TWO_PI-PI/2, TWO_PI+PI); break; case '4': line(fs,fs*1.25,0,fs*1.25); line(0,fs*1.25,fs*0.75,0); line(fs*0.75,0,fs*0.75,fs*2); break; case '5': arc(fs*0.5, fs*1.5, fs, fs, TWO_PI-PI/2, TWO_PI+PI); line(fs*0.5,fs,0,fs); line(0,fs,0,0); line(0,0,fs,0); break; case '6': arc(fs*0.5, fs*1.5, fs, fs, TWO_PI-PI, TWO_PI+PI); line(0,fs*1.25,0,fs*0.5); arc(fs*0.5, fs*0.5, fs, fs, TWO_PI-PI, TWO_PI); break; case '7': line(0,0,fs,0); line(fs,0,0,fs*2); break; case '8': arc(fs*0.5, fs*0.5, fs, fs, TWO_PI-PI, TWO_PI+PI); arc(fs*0.5, fs*1.5, fs, fs, TWO_PI-PI, TWO_PI+PI); break; case '9': arc(fs*0.5, fs*0.5, fs, fs, TWO_PI-PI, TWO_PI+PI); line(fs,fs*1.5,fs,fs*0.5); arc(fs*0.5, fs*1.5, fs, fs, TWO_PI, TWO_PI+PI); break; default: println("Zulu"); // Does not execute break; } translate(fs*1.25,0); } popMatrix(); }{/syntaxhighlighter}

Gallery

Info

Difficulty: ●○○○○

Contributors:

Last updated: 9 years ago

Admin