%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% A font of the border-project       %
% This file has version number 1.2.  %
% 19.06.1993                         %
% (c) by Andreas Schrell, Wuppertal  %
%    and Andreas H"orstemeier, Hemer %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

input umrand

def wood(expr W) =
    beginchar(incr nextchar,charsize#,charsize#,0cm#);
        pickup pencircle scaled penwid;
        xscal:=1;
        u:=w/10; v:=h/20;
        x0=x1=0;
        x2=x3=x4=x5=x6=u;
        x7=x8=x9=x10=x11=x12=2u;
        x13=x14=x15=3u;
        x16=x17=x18=x19=4u;
        x20=x21=x22=5u;
        x23=x24=x25=6u;
        x26=7u;  x27=8u;
        x28=x29=10u;
        y2=20v;     y0=19v;     y3=16v;
        y7=y16=15v; y13=y20=14v;
        y8=13v;     y21=12v;
        y9=y17=y23=y27=y28=11v;
        y4=y14=y26=10v;
        y18=y24=y29=9v;
        y5=8v;      y10=y19=y25=7v;
        y15=y22=6v;
        y11=5v;     y12=3v;     y1=v;       y6=0v;
		CenterRot(W);
		if abs(abs(sind(W))-abs(cosd(W))) < eps:
			currenttransform := identity shifted(2u,0) 
									transformed (currenttransform);
		fi
        draw z2--z0--z1--z6--z5--z15;
        draw z10--z12--z22--z19--z11;
        draw z0--z16--z8--z7--z13;
        draw z7--z3--z4--z9--z8;
        draw z4--z19--z18--z9--z20--z21--z14;
        draw z17--z18;
        draw z21--z22--z25--z24--z23--z21;
        draw z23--z26--z24;
        draw z20--z27--z26;
        draw z2--z28--z25;
        draw z28--z29--z6;
    endchar;
enddef;

def yingyang(expr W) =
    beginchar(incr nextchar,charsize#,charsize#,0cm#);
        pickup pencircle scaled penwid;
        xscal:=1;
		CenterRot(W);
        x1=w-x2=0; y1=y2=y5=0.5h;
        y3=h-y4=0; x3=x4=x5=0.5w;
        x8=y8=w-x7=w-y7=w/4;
        draw (z1{down}..z3{right}..z2{up}..z4{left}..z1{down}--cycle);
        turningcheck:=0;
        fill (z3{right}..z2{up}..z7{left}..z5{down}
                              ..z8{left}..z1{up}--z1{down}..z3{right}--cycle);
        turningcheck:=2;
        cullit;
        fill (fullcircle scaled (w/6) shifted (w/4,h/2));
        unfill (fullcircle scaled (w/6) shifted (w-w/4,h/2));
    endchar;
enddef;


% nach Apollonio: Dynamische circulaire 5 H

def dynacirc(expr W,Lines) =
    beginchar(incr nextchar,charsize#,charsize#,0cm#);
        pw# := charsize#/(2.3*(Lines));
        define_blacker_pixels(pw);
        pickup pencircle scaled pw;
        xscal:=1;
		CenterRot(W);
        for i=0 upto Lines:
            penpos[i](pw,90);
            x[i]=0.5w;
            y[i]=i*h/Lines;
        endfor;
        penpos100(1,-40);   penpos101(1,-40);
        x100=x101=0.5w;
        top y100=y0;        bot y101=y[Lines];
        for i=0 upto Lines:
            penstroke (
                z[100].e{left}..z[i].e{right}..z[101].e{left});
        endfor;
    endchar;
enddef;


% nach Ludwig: Kinematische Scheibe

def kinemat(expr W,Lines) =
    beginchar(incr nextchar,charsize#,charsize#,0cm#);
        pa# := charsize#*3.14/3.5*2/Lines;
        pi# := charsize#/7*3.14/3.5*2/Lines;
        define_blacker_pixels(pa,pi);
        xscal:=1;
        CenterRot(W);
        penpos0(pa,90);
        penpos1(pi,90);
        z0=(w,0.5h);
        z1=(0.5w+0.06w,0.5h+0.08h);
        for i=0 upto Lines:
            penstroke CenterRotation(i*360/Lines,
                z0e--z1e);
        endfor;
    endchar;
enddef;

def saw(expr W,Lines) =
    beginchar(incr nextchar,charsize#,charsize#,0cm#);
        pa# := charsize#*3.14/3*2/Lines;
        pi# := charsize#/4*3.14/3*2/Lines;
        define_blacker_pixels(pa,pi);
        xscal:=1;
        CenterRot(W);
        penpos0(pi,90);
        penpos1(pa,90);
        z0=(w,0.5h);
        z1=(0.5w+0.4w,0.5h+0.4h);
        for i=0 upto Lines:
            penstroke CenterRotation(i*360/Lines,
                z0e--z1e);
        endfor;
    endchar;
enddef;

def opta(expr W) =
    beginchar(incr nextchar,charsize#,charsize#,0cm#);
        xscal:=1;
        a := hround(w/8);
        pickup pencircle scaled penwi;
        for i=0 upto 5:
            draw fullcircle scaled (w-i*a) shifted (0.5w,0.5h);
        endfor;
        pickup pencircle scaled penwid;
        draw (w,h/2)--(w/2,h)--(0,h/2)--(w/2,0)--cycle;
    endchar;
enddef;

def optb(expr W) =
    beginchar(incr nextchar,charsize#,charsize#,0cm#);
        xscal:=1;
        a := hround(w/8);
        pickup pencircle scaled penwi;
        for i=0 upto 5:
            draw quartercircle scaled (w-i*a)
                rotated 0 shifted (0,0);
            draw quartercircle scaled (w-i*a)
                rotated 90 shifted (w,0);
            draw quartercircle scaled (w-i*a)
                rotated 180 shifted (w,h);
            draw quartercircle scaled (w-i*a)
                rotated 270 shifted (0,h);
        endfor;
        pickup pencircle scaled penwid;
        draw (w,h/2)--(w/2,h)--(0,h/2)--(w/2,0)--cycle;
    endchar;
enddef;

def kassette(expr W) =
	if abs(abs(sind(W))-abs(cosd(W)))<eps:
		fak:=sqrt(2)
	else:
		fak:=1
	fi;
    beginchar(incr nextchar,fak*charsize#,fak*charsize#,0cm#);
        pickup pencircle scaled penwid;
        xscal:=1;
		CenterRot(W);
        draw ((0,0)--(normw,0)--(normw,normh)--(0,normh)--cycle);
        draw ((normw/4,normh)--(normw/4,normh/4)--(normw,normh/4));
        draw 
		((normw/4,3normh/4)--(3normw/4,3normh/4)--(3normw/4,normh/4));
        fill ((0,0)--(normw/3,0)--(normw/3,normh/3)--(0,normh/3)--cycle);
    endchar;
enddef;

def kassetteb(expr W) =
	if abs(abs(sind(W))-abs(cosd(W)))<eps:
		fak:=sqrt(2)
	else:
		fak:=1
	fi;
    beginchar(incr nextchar,fak*charsize#,fak*charsize#,0cm#);
        pickup pencircle scaled penwid;
        xscal:=1;
		CenterRot(W);
        draw ((0,0)--(normw,0)--(normw,normh)--(0,normh)--cycle);
        draw ((normw/2,0)--(normw/2,normh/2)--(normw,normh/2));
        draw ((0,normh/5)--(normw/2,normh/5));
        draw ((4normw/5,normh)--(4normw/5,normh/2));
        draw (unitsquare scaled (normw/5) shifted (0,4normh/5));
        draw (unitsquare scaled (normw/3) shifted (0,2normh/3));
        fill (unitsquare scaled (normw/3) shifted (2normw/3,0));
    endchar;
enddef;

def qq(expr W) =
    beginchar(incr nextchar,charsize#,charsize#,0cm#);
        xscal:=1;
        pickup pencircle scaled penwid;
		CenterRot(W);
        draw (unitsquare scaled (w));
        fill (unitsquare scaled (w/2) shifted (w/4,h/4));
    endchar;
enddef;

def oval(expr W) =
    beginchar(incr nextchar,(1+abs(cosd(W)))*charsize#,(1+abs(sind(W)))*charsize#,0cm#);
        pickup pencircle scaled penwid;
        xscal:=2;
		CenterRot(W);
        draw (fullcircle xscaled (2normw) yscaled (normw)
                              shifted (normw,normw/2));
    endchar;
enddef;

def teilquad(expr W) =
    beginchar(incr nextchar,charsize#,charsize#,0cm#);
        pickup pencircle scaled penwid;
        xscal:=1;
		CenterRot(W);
        draw ((0,h)--(0,0)--(w,0)--(w,h));
    endchar;
enddef;

def gras(expr W) =
    beginchar(incr nextchar,charsize#,charsize#,0cm#);
        pickup pencircle scaled penwid;
        xscal:=1;
		CenterRot(W);
        draw ((w/2,0){up}..{left}(0,h));
        draw ((w/2,0){up}..{right}(w,h));
        draw ((w/2,0){up}..{left}(0,2h/3));
        draw ((w/2,0){up}..{right}(w,2h/3));
    endchar;
enddef;


def fish(expr W,xs) =
    beginchar(incr nextchar,(1+abs(cosd(W)))*charsize#,(1+abs(sind(W)))*charsize#,0cm#);
        pickup pencircle scaled penwid;
        path p;
        xscal:=2;
		CenterRot(W);
        x0=0; x1=x2=2normw/3; x3=x4=2.3*3normw/4; x5=x6=2normw; x7=2*11normw/12;
        y0=y7=normw/3; y1=normw; y2=y6=0; y4=normw/6; y5=2normw/3;
        y3=normw/2; x8=normw/5; y8=y0;
        p := z0{up}..z1{right}.. tension 1 and 1.2 ..z3..
        tension 1.2 and 4 .. z5 ..tension 4 and 1
        ..z7..
        tension 1 and 4 .. z6 .. tension 4 and 1 ..z4..z2{left}..z0..cycle;
        draw (CenterMirror(xs,1,p));
        draw (CenterMirror(xs,1,z0{z2-z0}..z8));
        pickup pencircle scaled penwidd;
        drawdot (CenterMirror(xs,1,(normw/3,2normw/3.2)));
    endchar;
enddef;

def xlines(expr W) =
    beginchar(incr nextchar,(1+abs(cosd(W)))*charsize#,(1+abs(sind(W)))*charsize#,0cm#);
        pickup pencircle scaled penwid;
        xscal:=2;
		CenterRot(W);
        draw ((0,0){right}..{right}(2normw,normw));
        draw ((0,normw){right}..{right}(2normw,0));
    endchar;
enddef;

def xcirc(expr W) =
    beginchar(incr nextchar,charsize#,charsize#,0cm#);
        pickup pencircle scaled penwid;
        xscal:=1;
		CenterRot(W);
        draw (fullcircle scaled w shifted (w/2,h/2));
    endchar;
enddef;

def xquad(expr W) =
    beginchar(incr nextchar,charsize#,charsize#,0cm#);
        pickup pencircle scaled penwid;
        xscal:=1;
		CenterRot(W);
        draw (unitsquare scaled w);
    endchar;
enddef;

def xbcirc(expr W) =
    beginchar(incr nextchar,charsize#,charsize#,0cm#);
        pickup pencircle scaled penwid;
        xscal:=1;
		CenterRot(W);
        draw (fullcircle scaled (sqrt(2)*w) shifted (w/2,h/2));
    endchar;
enddef;

def flower(expr W,xs) =
    beginchar(incr nextchar,charsize#,charsize#,0cm#);
        pickup pencircle scaled penwid;
        gr := w/9*0.9; kr := w/12*0.9;
        z0=(2kr+gr,h-2kr-gr); z1=(w-2kr-gr,2kr+gr);
        xscal:=1;
		CenterRot(W);
        fill (
            CenterMirror(xs,1,fullcircle scaled (2gr) shifted z0));
        for l:=0 upto 8-1:
            draw (
                CenterMirror(xs,1,
                fullcircle scaled (2kr) shifted (gr+kr,0)
                           rotated (l*360/8) shifted z0));
        endfor;
        pwd# := 3penwid#;
        define_blacker_pixels(pwd);
        if write_white_engine:
            pwd:=max(pwd,2);
        fi;
        draw (
            CenterMirror(xs,1,(z0+(gr,0)){dir (-360/8)}..{right}(w,0)));
        z3 = (0.9w,0);
        z4 = z3+(-0.3w,0.6w);
        z6 = z3+(-0.2w,0.3w);
        z5 = z3+(-0.7w,0.3w);
        z7 = z3+(-0.35w,0.2w);
        penpos3(1,0); penpos4(1,45); penpos5(1,60);
        penpos6(pwd,45); penpos7(pwd,60);
        penstroke (
            CenterMirror(xs,1,z3e..z6e..z4e));
        penstroke (
            CenterMirror(xs,1,z3e..z7e..z5e));
    endchar;
enddef;

def snake(expr W,xs) =
    beginchar(incr nextchar,(1+abs(cosd(W)))*charsize#,(1+abs(sind(W)))*charsize#,0cm#);
        pickup pencircle scaled penwid;
        xscal:=2;
		CenterRot(W);
        u:=2normw/100; v:=normw/43;
        def MYTR(expr a) = (CenterMirror(xs,1,a)) enddef;
          x0=24u; x1=26u; x2=34u; x3=46u; x4=54u; x5=65u; x6=74u;
        x7=86u; x8=95u; x9=100u; x17=11u;
        x10=21u; x11=16u; x12=12u; x13=9u; x14=18.5u; x15=4u; x16=6u;
        y0=34v; y1=15v; y2=5v; y3=18v; y4=30v; y5=13v; y6=3v;
        y7=13v; y8=14v; y9=11v; y17=37v;
        y10=39v; y11=38v; y12=35v; y13=33v; y14=39v; y15=29v; y16=30v;
        penpos0(8u,20); penpos1(8u,30); penpos2(7.5u,87); penpos3(7u,130);
        penpos4(7u,90); penpos5(6.5u,43); penpos6(6u,87); penpos7(5u,130);
        penpos8(3u,80); penpos9(1,45);
        penpos10(8u,70); penpos11(8u,100); penpos12(11u,130);
        penpos13(9u,130); penpos14(8u,90); penpos15(1,135); penpos16(4u,135);
        penstroke MYTR(
            z15e..z16e..z13e..z12e..z11e..z14e..z10e
            ..z0e..z1e..z2e..z3e..z4e..z5e..z6e..z7e..z8e..z9e);
        cullit;
        unfill MYTR(z13--z16l..z15l..z15r..
                        z16r--z13--cycle);
        draw MYTR(z13{(-1,-1)}..(0,26v));
        draw MYTR(z13{(-1,-1)}..(2.5u,24v));
        pickup pencircle scaled penwidd;
        undrawdot(MYTR(z17));
    endchar;
enddef;

nextchar:=-1; % -1: we start first char width incr(-1) = 0!

for k=0 upto 8-1: wood(k*360/8); endfor;

for k=0 upto 12-1: yingyang(k*360/12); endfor;

for k=0 upto 6-1: dynacirc(k*180/6,13); endfor;

for k=0 upto 6-1: dynacirc(k*180/6,8); endfor;

kinemat(0,35);

saw(0,8);

opta(0);

optb(0);

for k=0 upto 8-1: kassette(k*360/8); endfor;

for k=0 upto 8-1: kassetteb(k*360/8); endfor;

qq(0);

for k=0 upto 4-1: oval(k*180/4); endfor;

for k=0 upto 4-1: teilquad(k*360/4); endfor;

for k=0 upto 4-1: gras(k*360/4); endfor;

for k=0 upto 4-1: fish(k*360/4,1); fish(k*360/4,-1); endfor;

xlines(0); xlines(90); xcirc(0); xquad(0); xbcirc(0);

for k=0 upto 4-1: flower(k*360/4,1); flower(k*360/4,-1); endfor;

for k=0 upto 4-1: snake(k*360/4,1); snake(k*360/4,-1); endfor;


beginchar(incr nextchar,charsize#,charsize#,0cm#);
        xscal:=1;
		CenterRot(0);
        pickup pencircle scaled penwid;
        sec(5);
        draw (.5u,0)--(.5u,.5v)--(3.5u,.5v)--(3.5u,3.5v)--(1.5u,3.5v)--(1.5u,2.5v)--(2.5u,2.5v)--(2.5u,1.5v)--(.5u,1.5v)--(.5u,4.5v)--(4.5u,4.5v)--(4.5u,.5v)--(5u,.5v);
endchar;

beginchar(incr nextchar,charsize#,charsize#,0cm#);
        xscal:=1;
		CenterRot(0);
        pickup pencircle scaled penwid;
        sec(5);
        draw (0,.5v)--(3.5u,.5v)--(3.5u,3.5v)--(1.5u,3.5v)--(1.5u,2.5v)--(2.5u,2.5v)--(2.5u,1.5v)--(.5u,1.5v)--(.5u,4.5v)--(4.5u,4.5v)--(4.5u,.5v)--(5u,.5v);
endchar;

beginchar(incr nextchar,charsize#,charsize#,0cm#);
        xscal:=1;
		CenterRot(0);
        pickup pencircle scaled penwid;
        sec(5);
        draw (0,.5v)--(3.5u,.5v)--(3.5u,3.5v)--(1.5u,3.5v)--(1.5u,2.5v)--(2.5u,2.5v)--(2.5u,1.5v)--(.5u,1.5v)--(.5u,4.5v)--(4.5u,4.5v)--(4.5u,0);
endchar;

beginchar(incr nextchar,charsize#,charsize#,0cm#);
        xscal:=1;
		CenterRot(0);
        pickup pencircle scaled penwid;
        sec(5);
        draw (4.5u,5v)--(4.5u,4.5v)--(.5u,4.5v)--(.5u,.5v)--(3.5u,.5v)--(3.5u,2.5v)--(2.5u,2.5v)--(2.5u,1.5v)--(1.5u,1.5v)--(1.5u,3.5v)--(4.5u,3.5v)--(4.5u,0);
endchar;

beginchar(incr nextchar,charsize#,charsize#,0cm#);
        xscal:=1;
		CenterRot(0);
        pickup pencircle scaled penwid;
        sec(5);
        draw (4.5u,5v)--(4.5u,4.5v)--(1.5u,4.5v)--(1.5u,1.5v)--(3.5u,1.5v)--(3.5u,2.5v)--(2.5u,2.5v)--(2.5u,3.5v)--(4.5u,3.5v)--(4.5u,.5v)--(.5u,.5v)--(.5u,4.5v)--(0,4.5v);
endchar;

beginchar(incr nextchar,charsize#,charsize#,0cm#);
        xscal:=1;
		CenterRot(0);
        pickup pencircle scaled penwid;
        sec(5);
        draw (5u,4.5v)--(1.5u,4.5v)--(1.5u,1.5v)--(3.5u,1.5v)--(3.5u,2.5v)--(2.5u,2.5v)--(2.5u,3.5v)--(4.5u,3.5v)--(4.5u,.5v)--(.5u,.5v)--(.5u,4.5v)--(0,4.5v);
endchar;

beginchar(incr nextchar,charsize#,charsize#,0cm#);
        xscal:=1;
		CenterRot(0);
        pickup pencircle scaled penwid;
        sec(5);
        draw (5u,4.5v)--(1.5u,4.5v)--(1.5u,1.5v)--(3.5u,1.5v)--(3.5u,2.5v)--(2.5u,2.5v)--(2.5u,3.5v)--(4.5u,3.5v)--(4.5u,.5v)--(.5u,.5v)--(.5u,5v);
endchar;

beginchar(incr nextchar,charsize#,charsize#,0cm#);
        xscal:=1;
		CenterRot(0);
        pickup pencircle scaled penwid;
        sec(5);
        draw (.5u,0)--(.5u,.5v)--(4.5u,.5v)--(4.5u,4.5v)--(1.5u,4.5v)--(1.5u,2.5v)--(2.5u,2.5v)--(2.5u,3.5v)--(3.5u,3.5v)--(3.5u,1.5v)--(.5u,1.5v)--(.5u,5v);
endchar;

end;