sign

Créer des signatures type unistra - retour accueil

git clone git://bebou.netlib.re/sign

Log | Files | Refs | README |

sign (627B)


      1 #! awk -f
      2 
      3 BEGIN { atom=10;width=atom;height=atom*2;x=0;y=0;inrect=0;print "<svg xmlns='http://www.w3.org/2000/svg' >" }
      4 {
      5 	split($0,a,"");
      6 	fin=length(a);
      7 	for (i=1;i<=fin;i++) {
      8 		if      (a[i]==" " && !inrect) { x=x+atom; }
      9 		else if (a[i]==" " && inrect)  { width=width+atom;}
     10 		else if (a[i]=="|" && !inrect) { inrect=1; }
     11 		else if (a[i]=="|" && inrect)  {
     12 			printf "<rect width='%s' height='%s' x='%s' y='%s' fill='white' stroke='black' stroke-width='0.1' />\n",width,height,x,y;
     13 			x=x+width;
     14 			width=atom;
     15 		}
     16 	}
     17 	y=y+height;
     18 	width=atom;
     19 	inrect=0;
     20 	x=0;
     21 }
     22 END { print "</svg>" }
     23 #       |   |
     24 #|  |    |  |
     25 #||  |