-% should make generic macro?
-%
-def draw_foot(expr xpos) =
- begingroup;
- clearxy;
- penpos1(thick,0);
- z1=(xpos,foot_top);
- penpos2(foot_width,0);
- z2=(x1,0);
- penpos3(hair,-90);
- z3r=z2r;
- penpos4(hair,90);
- z4l=z2l;
- z5=(x1,hair/2);
- fill z1..{right}z1r{down}..{right}z3l..z3r{left}..z5..{left}z4l..z4r{right}..{up}z1l{right}..z1..cycle;
- endgroup;
- enddef;
-
-def draw_six =
- set_char_box(0, 2/3height#, 0, height#);
- message "w:"&decimal w;
- message "h:"&decimal h;
-
- penpos1(thin,90);
- z1=(thick,h/2+thin);
- penpos2(hair,90);
- z2=(w/2,y1);
- penpos3(thick-hair,0);
- % yup, should use the path [] "everywhere"
- z3r=(w,1/2[0,y1]);
- penpos4(hair,-90);
- z4r=(x2,0);
- penpos5(thick-hair,180);
- z5r=(0,y1);
- penpos6(hair,90);
- z6r=(w-thick-hair,h);
- penpos7(thick-hair,180);
- z7r=(0,h/2);
- penpos10(thick-hair,180);
- z10r=(0,y3);
- penlabels(1,2,3,4,5,6,7,8,9,10,11);
- save t; t=0.833;
-% fill z5{right}..z2r{right}..z3r{down}..z4r{left}
-% ..tension t..z7r{up}..tension t..z6r{right}
-% ..z6l{left}..tension t..z7l{down}..z10l{up}..cycle;
- fill z5{right}..z2r{right}..tension t..z3r{down}
- ..tension t..z4r{left}
- ..tension t..z7r{up}..tension t..z6r{right}
- ..z6l{left}..tension t..z7l{down}..z10l{up}..cycle;
- draw_flare(z6r,0,-90,hair,thick);
- unfill z2l{right}..tension t..z3l{down}..tension t
- ..z4l{left}..tension t..z10l{up}..tension t..cycle;
- enddef;
-
-fet_beginchar("Numeral 0", "0", "zero")
-% set_char_box(0, 4/5height#, 0, height#);
- set_char_box(0, 11/15height#, 0, height#);
- message "w:"&decimal w;
- message "h:"&decimal h;
- penpos1(thin,90);
- z1r=(w/2,h);
- penpos2(thick,0);
- z2r=(w,h/2);
- penpos3(thin,-90);
- z3r=(w/2,0);
- penpos4(thick,180);
- z4r=(0,h/2);
- fill z1r..z2r..z3r..z4r..cycle;
- save t; t=1.2;
- unfill z1l..tension t..z2l..tension t..z3l..tension t..z4l..tension t..cycle;
-fet_endchar;
-
-fet_beginchar("Numeral 1", "1", "one")
-% set_char_box(0, 11/15height#, 0, height#);
- set_char_box(0, 19/30height#, 0, height#);
- message "w:"&decimal w;
- message "h:"&decimal h;
-
- save alpha; alpha=0;
- calc_kuulleke(thick,alpha);
- z1=(thick+thick/2,height);
-
- penpos5(thick,0);
- z5=(x1,foot_top);
-
- z6=(0,h/2);
- save beta; beta=angle(z1l-z6);
- penpos7(thin,beta-90);
- z7l=z6;
- penpos8(thin/cosd(beta),-90);
- z8l=z1l;
- penpos9(thin,beta-90);
- z9r=z8r+(thin/cosd(beta))*(0,-1);
- penlabels(1,2,3,4,5,6,7,8,9);
- save gamma; gamma=angle(length(z1r-z1),+2kuulleke);
- fill z2r{dir(alpha-gamma)}..z4..{dir(alpha+gamma)}z3l..z3r{down}..{down}z5r{left}..z5..{left}z5l{up}..{up}z2l..cycle;
- fill z7l{dir(beta)}..{dir(beta)}z1l..z2r..z9r{up}..z9l{dir(180+beta)}..{dir(180+beta)}z7r..cycle;
- penlabels(7,8,9);
-
- draw_foot(x1);
-fet_endchar;
-
-fet_beginchar("Numeral 2", "2", "two")
- set_char_box(0, 11/15height#, 0, height#);
- message "w:"&decimal w;
- message "h:"&decimal h;
- clearxy;
- save alpha; alpha=-50;
- save beta; beta=75;
- penpos1(thin,90+beta);
- z1=(0,0)+(1/2sqrt(2)*thin)*dir(45);
- penpos3(hair,90+beta);
- z3=(w,thick)+(1/2sqrt(2)*hair)*dir(-135);
- penpos2(thick-hair,90+alpha);
- x2-x1=x3-x2; y2=thick/2+hair;
- penlabels(1,2,3);
- fill z1r{dir(beta)}..{dir(alpha)}z2r..{dir(beta)}z3r
- ..z3l{dir(180+beta)}..{dir(180+alpha)}z2l
- ..{dir(180+beta)}z1l..cycle;