% ark10.mf file
% Copyright (c) 1988 by Arthur M. Keller
% The ARK font was initially done in MF79
% by Scott Kim.  It was converted to (new) MF by N.N. Billawala
% of Metamarks.
% It contains 10 characters.


rulepen:=pensquare scaled 1;     % makes one pixel proofing lines
mode_setup;
designsize:=10pt#;
width#:=10pt#;
height#:=7.5pt#;
depth#:=2.5pt#;
  define_pixels(width,height,depth);
extra_beginchar:=extra_beginchar&"save p;path p[];";

% ***** general macros *****
extra_beginchar:=extra_beginchar&"w#:=charwd;";          % for adjust def
extra_endchar:=extra_endchar&"wsaved:=w; w:=r-l;";       % for adjust def

letter_fit#:=letter_fit:=0;
def adjust(expr left_adjustment,right_adjustment) =
   l:=-round(left_adjustment*hppp)-letter_fit;
   interim xoffset:=-l;
   charwd:=charwd+2letter_fit#+left_adjustment+right_adjustment;
   r:=l+round(charwd*hppp);
   w:=r-round(right_adjustment*hppp)-letter_fit;
 enddef;

def makebox(text rule)= % makes a reference box for screen and proof characters
 for y=0,h.o_,-d.o_: rule((l,y),(r,y));  endfor % horizontals
 for x=l,r:    rule((x,-d.o_),(x,h.o_)); endfor % outer verticals
 if charic<>0: rule((wsaved+charic*hppp,h.o_),(wsaved+charic*hppp,.5h.o_));fi
enddef;

% ***** pencils *****

line_thickness:=max(1,.3pt);     % thickness of character lines
pencil_thickness#:=.6width#;     % pencil thickness
tip_length#:=.5width#;           % length of pencil tips
lead_length#:=.3tip_length#;     % amount of pencil tip lead showing
tip_curve:=.2;                   % curvature of the pencil tip
lead_curve:=.1;                  % curvature of the pencil tip lead part
bottom_showing:=.7;              % proportion of bottom height/width in pencil

def pencil_pen=pencircle scaled line_thickness; enddef;
define_pixels(pencil_thickness,tip_length,lead_length);


% The pencil keeps a general vertical size no matter what the rotation angle is.
% The width is determined after the character is drawn.
% Adjustments can be made to the height of the pencil(size)
%   angle of pencil from upright or 90 degrees(rotation)
%   thickness or width of the pencil(pencil_thickness)
%   length of the tip of the pencil(pencil_tip)
%   size of the lead showing in the tip(lead_length)
%   the curvature of the pencil tip(tip_curve) as a percentage of the tip_length
%   the curvature of the lead tip(lead_curve) as a percentage of the lead_length
%   the size of the bottom part of the pencil(bottom_showing)

vardef pencil(expr tip,size,rotation)=
 save x,y,p,t; path p[]; transform t; pickup pencil_pen;
 z1=tip+(0,size/(sind abs(90+rotation)));                        % bottom
 z2=z1-(0,.5pencil_thickness);
 for n:=0 upto 5:z[10+n]=z2+(.5pencil_thickness,0) rotated (n*60); endfor
 for n:=0 upto 5:z[10+n]a=.45[z2,z[10+n]]; endfor                % bottom lead
  z2 transformed t=z1-(0,.5*bottom_showing*pencil_thickness);
  z11 transformed t=z11; z12 transformed t=z12;
  z113=z13 transformed t; z114=z14 transformed t;
  z115=z15 transformed t; z110=z10 transformed t;
 z3=tip+(0,tip_length); penpos3(pencil_thickness,0);             % tip
 z4=tip_curve[z3,tip];
  p1=z3r...z4{left}...z3l;
 z20=(x114,ypart tip); z21=(x115,ypart tip);
 z22=p1 intersectionpoint (z114--z20);
 z23=p1 intersectionpoint (z115--z21);
 z5=tip+(0,lead_length);                                         % lead
 y30=y31=y5; z30=whatever[tip,z3l]; z31=whatever[tip,z3r];
 z6=lead_curve[z5,tip];
  p2=(z10--z11--z12--z13--z14--z15--cycle) transformed t;        % pencil bottom
  p3=z113--z3l--tip--z3r--z110;                                  % pencil
  p4=z114--z22;
  p5=z115--z23;
  p6=(z10a..z11a..z12a..z13a..z14a..z15a..cycle) transformed t;  % bottom lead
  p7=tip--z31...z6{left}...z30--cycle;                           % lead tip
 for n:=1 upto 5: draw p[n] rotatedaround (tip,rotation); endfor
 for n:=6,7: fill p[n]rotatedaround (tip,rotation); endfor
enddef;

% An amount for placing the tip of the pencil
def tip_adjust=
 if abs(tip_length*cosd (90+rotation))>abs(.5*pencil_thickness):0
  else:abs(.5*pencil_thickness-abs(tip_length*cosd (90+rotation)))fi enddef;

"small pencil";
  rotation:=55;                                  % angle of pencil
  pencil_width#:=
    pencil_thickness#+                           % base or minimum width
    (height#+depth#)                             % vertical pencil dimension
     *abs(cosd(90+rotation)/sind(90+rotation))   %  * rotation
    -pencil_thickness#*abs(cosd(90+rotation));   %  - adjustment to thickness

  beginchar(oct"120",pencil_width#,height#,depth#);
   z0=(if rotation>0:w- else:0+ fi tip_adjust,0);
   pencil(z0,h+d,rotation);
  adjust(.2width#,.2width#);
  endchar;

"large pencil";
  rotation:=20;                                  % angle of pencil
  pencil_width#:=
    pencil_thickness#+                           % base or minimum width
    (height#+depth#)                             % vertical pencil dimension
     *abs(cosd(90+rotation)/sind(90+rotation))   %  * rotation
    -pencil_thickness#*abs(cosd(90+rotation));   %  - adjustment to thickness

  beginchar(oct"127",pencil_width#,2.8height#,2.8depth#);
   z0=(if rotation>0:w- else:0+ fi tip_adjust,0);
   pencil(z0,h+d,rotation);
  adjust(.2width#,.2width#);
  endchar;


% ***** return *****
def return_pen=pencircle scaled line_thickness; enddef;


"return";
  beginchar(oct"103",.4width#,.6height#,.6depth#);
  save curvature,arrowhead,base_length;
  curvature1=angle((h+d),-.25(h+d));
  curvature2=angle(-(h+d),-.25(h+d));
  arrowhead=.2h;                                 % length of arrowhead
  pickup return_pen;                             % the pen used in this char
  top lft z1=(0,h); bot lft z3=(0,-d); rt z2=(w,.5[y1,y3]);
  p1=z1{dir curvature1}...z2{down}...z3{dir curvature2};
  z4=z3+(arrowhead,0) rotated curvature2;
  z5=z3+(arrowhead,0) rotated (curvature2+120);
  z6=z3+(arrowhead,0) rotated (curvature2-120);
  draw p1; filldraw z4--z5--z6--cycle;
  adjust(.3width#,.2width#);
  endchar;



% ***** eye *****
"eye";
  beginchar(oct"105",1.2width#,.75height#,depth#);
  save limit; pair limit;                        % keeps curve bounded
  randomseed:=.71;                               % iris shape
  pickup pencil_pen;                             % the pen used in this char
  lft x1=0; x0=x2=x4=.5w; rt x3=w;
  bot y2=0; y0=y1=y3=.5h; top y4=h;
  limit=if abs(y2-y1)>abs(x2-x1):down else:(0,0) fi;
  draw z1{limit}...z2{right}...z3{-limit}--
       z3+(0,eps){-limit}...z4{left}...z1+(0,eps){limit}--cycle;  % outer shape
  draw z2..(.5[z0,z3])..z4..(.5[z0,z1])..cycle;                   % "retina"
  pickup pencircle;       % number and shape of pupil lines can be altered here
  for n:=0 step 25 until 360:
    draw z0--(z0+(.9abs(y4-y0),0)rotated n);
   endfor
  for n:=60 step 60 until 360:
    draw z0--(z0+(.9abs(y4-y0),0)rotated (n*(uniformdeviate 5)));
   endfor
  pickup pencircle scaled .10h;
  for n:=12 step 30 until 375:
    draw z0--(z0+((((uniformdeviate 2)+2)*.15abs(y4-y0)),0)rotated n);
   endfor
  adjust(.2width#,.2width#);
  endchar;


% ***** hands *****
handheight#:=6.5pt#;
handdepth#:=3pt#;
  define_pixels(handheight,handdepth);
cuff_width:=.15width;                              % thickness of the cuff
shirt_width:=.75cuff_width;                        % thickness of the sleeve
digit:=round(.2handheight);                        % thickness of the fingers
indent:=.05width;                                  % finger indent increment
knuckles:=2indent;                                 % length of knuckles
finger_tips:=3indent;                              % length of finger tips

def handpen=pickup pencircle scaled .2pt; enddef;

% Makes an open horizontal oval shape; path moves clockwise
vardef finger(expr tip,alength)suffix $=
 save x,y,tips; boolean tips; tips=if str$="tips":true else:false fi;
 z2=tip; x1=x3=x2 if tips:+finger_tips else:-knuckles fi; x4=x3-alength;
 y1=y2+.5digit; y1-y3=digit; y4=y3;
 if tips:z4..z3{left}...z2...z1{right} else:z1{right}...z2...z3{left}...z4 fi
enddef;

% Points used in the hand characters
def hand_points=
  y1=y2=h; top y3=top y4=y2-(.05h+1); x1=x5=0; x2=x3=x6=x7=x1+cuff_width;% cuff
  y5=y6=0; bot y7=bot y8=y5+(.05h+1); x4=x8=x1a=x3a=x2+shirt_width;
  y1a=y3-(.1h); y2a=y3; x2a=.3[x1a,w-3indent];                     % wrist
  y3a=y1a-.5h; y4a=y7+(.05h+1); y5a=.2[y4a,y2a]; x4a=x5a=.45[x3a,x5d];
  y1b=y3-.5digit; y2b+digit=y3b+2digit=y4b+3digit=y1b; y5b=y4b;    % knuckles
  x1b+2indent=x2b+indent=x3b=x4b+indent=w; x5b=x3b+2knuckles;
  for n:=1 upto 4:y[n]c=y[n]b; endfor                              % tips
  x1c=x2c=x3c=x4c-indent=0[x3d,x3b];
  z3d=(.5[x3a,x3b],-d); z2d=z3d+(.5digit,.3d); z4d=z2d-(digit,0);  % up thumb
  z1d=(x2d-indent,.5[y2d,y4b-.5digit]); z5d=z1d-(1.5digit,0);
  z1e=z5d+(0,.5digit); z2e=(.2[x1e,x3b],y1e);                      % down thumb
  z5e=(.55[x3c,x3b],y3b-.5digit);
  z3e=.4[z2e,z5e]+(.55digit,0)rotated(angle(z5e-z2e)-90);
  z4e-z3e=whatever*(z5e-z2e); y4e=y4b;
  z6e=z3e+(1.1digit,0)rotated(angle(z5e-z2e)+90); z7e=z6e-(.5knuckles,0);
  z8e=(1[x3a,x5d],y3b);
 enddef;

def cuff(expr trans)=
  p10=z1--z2--z6--z5--cycle; fill p10 transformed trans;              % cuff
  p11=z3--z4--z8--z7;        draw p11 transformed trans;              % sleeve
 enddef;

"left thumbs down";
  beginchar(oct"104",1.2*width#,handheight#,handdepth#);
   transform t[]; t1=identity shifted (0,-.1h);
   handpen  hand_points;
   cuff(t1);                                                           % cuff
   p1=z1a{right}...z2a{right}...finger(z1b,2.5indent);                 % finger
   p2=finger(z2b,2.5indent);                                           % finger
   p3=finger(z3b,4.5indent);                                           % finger
   p4=finger(z4b,2.5indent)...                                         % finger
      z1d{down}...z2d{down}...z3d...z4d{up}...z5d{z4a-z3d}...z3a{left};% thumb
   for n:=1 upto 4: draw p[n] transformed t1; endfor
  adjust(.2width#,.2width#);
  endchar;

"right thumbs down";
  beginchar(oct"144",1.2*width#,handheight#,handdepth#);
   transform t[];
   t1=identity reflectedabout ((.5w,0),(.5w,h)) shifted (0,-.1h);
   handpen  hand_points;
   cuff(t1);                                                           % cuff
   p1=z1a{right}...z2a{right}...finger(z1b,2.5indent);                 % finger
   p2=finger(z2b,2.5indent);                                           % finger
   p3=finger(z3b,4.5indent);                                           % finger
   p4=finger(z4b,2.5indent)...                                         % finger
      z1d{down}...z2d{down}...z3d...z4d{up}...z5d{z4a-z3d}...z3a{left};% thumb
   for n:=1 upto 4: draw p[n] transformed t1; endfor
  adjust(.2width#,.2width#);
  endchar;

"left thumbs up";
  beginchar(oct"125",1.2*width#,handheight#,handdepth#);
   transform t[];
   t1=identity reflectedabout ((0,.5h),(w,.5h)) shifted (0,-.1h);
   handpen  hand_points;
   cuff(t1);                                                           % cuff
   p1=z1a{right}...z2a{right}...finger(z1b,0)--finger(z1c,0)tips;      % finger
   p2=finger(z2b,0)--finger(z2c,0)tips;                                % finger
   p3=finger(z3b,0)--finger(z3c,0)tips;                                % finger
   p4=finger(z4c,0)tips--finger(z4b,0){left}...                        % finger
       z1d{down}...z2d{down}...z3d...z4d{up}...z5d{z4a-z3d}...z4a...z5a{up};
   p5=z3a--z4a;                                                        % wrist
   for n:=1 upto 5: draw p[n] shifted (0,-.07h) transformed t1; endfor
  adjust(.2width#,.2width#);
  endchar;

"right thumbs up";
  beginchar(oct"165",1.2*width#,handheight#,handdepth#);
   transform t[];
   t1=identity rotatedaround ((.5w,.5h),180) shifted (0,-.1h);
   handpen  hand_points;
   cuff(t1);                                                           % cuff
   p1=z1a{right}...z2a{right}...finger(z1b,0)--finger(z1c,0)tips;      % finger
   p2=finger(z2b,0)--finger(z2c,0)tips;                                % finger
   p3=finger(z3b,0)--finger(z3c,0)tips;                                % finger
   p4=finger(z4c,0)tips--finger(z4b,0){left}...                        % finger
       z1d{down}...z2d{down}...z3d...z4d{up}...z5d{z4a-z3d}...z4a...z5a{up};
   p5=z3a--z4a;                                                        % wrist
   for n:=1 upto 5: draw p[n] shifted (0,-.07h) transformed t1; endfor
  adjust(.2width#,.2width#);
  endchar;

"left hand pointing right";
  beginchar(oct"122",1.2*width#,handheight#,handdepth#);
   transform t[];
   t1=identity reflectedabout ((0,.5h),(w,.5h)) shifted (0,-.1h);
   handpen  hand_points;
   cuff(t1);                                                           % cuff
   z1f=(z2e{right}...z3e{z5e-z2e}...z5e{left}...z6e{z2e-z5e})
        intersectionpoint ((0,y4b-.5digit)--(w,y4b-.5digit));
   p1=z1a{right}...z2a{right}...finger(z1b,0)--finger(z1c,0)tips;      % finger
   p2=finger(z2b,0)--finger(z2c,0)tips;                                % finger
   p3=finger(z3b,0)--finger(z3c,0)tips;                                % finger
   p4=z5e--finger(z5b,0)--z1f;                                         % finger
   p5=z3a{right}...z1e{right}...z2e{right}...z3e{z5e-z2e}...
      z4e{z5e-z2e}...z5e{left}...z6e{z2e-z5e} & z6e--z7e{dir 120}..z8e;
   w:=w+2knuckles;
   for n:=1 upto 5: draw p[n] shifted (0,-.07h) transformed t1; endfor
  adjust(.2width#,.35width#);
  endchar;

"right hand pointing left";
  beginchar(oct"114",1.2*width#,handheight#,handdepth#);
   transform t[];
   t1=identity rotatedaround ((.5w,.5h),180) shifted (0,-.1h);
   handpen  hand_points;
   cuff(t1);                                                           % cuff
   z1f=(z2e{right}...z3e{z5e-z2e}...z5e{left}...z6e{z2e-z5e})
        intersectionpoint ((0,y4b-.5digit)--(w,y4b-.5digit));
   p1=z1a{right}...z2a{right}...finger(z1b,0)--finger(z1c,0)tips;      % finger
   p2=finger(z2b,0)--finger(z2c,0)tips;                                % finger
   p3=finger(z3b,0)--finger(z3c,0)tips;                                % finger
   p4=z5e--finger(z5b,0)--z1f;                                         % finger
   p5=z3a{right}...z1e{right}...z2e{right}...z3e{z5e-z2e}...
      z4e{z5e-z2e}...z5e{left}...z6e{z2e-z5e} & z6e--z7e{dir 120}..z8e;
   w:=w+2knuckles;
   for n:=1 upto 5: draw p[n] shifted (0,-.07h) transformed t1; endfor
  adjust(.35width#,.2width#);
  endchar;

end

