%{{{ dkalpha.mf - alphabetic characters for Ditko
% Copyright (C) 1990 Damian Cugley
% - pdc Tue. 25 Sept. 1990

%{{{  Macros
% Macros to allow me to read this file twice, the second time filling in
% any uppercase letters that aren't already defined.
% pdc - 13-Dec-90

%  Given a character number or one-character string, return a
%  single-character string that is its uppercase equivalent:
vardef toupper primary ch =
    save __ch; __ch = byte ch;
    if (__ch > 96) and (__ch < 123):
	char(__ch - 32)
    else:
	char(__ch)
    fi
enddef;

%  The first time this file is read, force all letters created to be
%  uppercase.  In the second pass, lowercase and/or uppercase will be
%  produced: any uppercase will override the glyph produced in the first
%  pass.
if testing or (known __stalpha_loaded):
    vardef uch primary ch = ch enddef;
else:
    vardef uch primary ch = toupper ch enddef;
    __stalpha_loaded = 1;
fi
%}}}  Macros

%{{{  u

stdchar(uch "u", 12 + jut#/u#, 1, 0);
    pickup round_pen;
    istem_pts.stem(r - 2jut - penw, h, -d);
    ubowl_pts.bowl(l, r - jut); 
    cutdraw ubowl_path.bowl;
    pickup square_pen; 
    draw z.stem.top -- z.stem.bot -- top lft (r, baseline); 
    %%%%    draw ujut_path.bowl;
endchar;

%}}}

if testing: endinput fi

% - pdc Tue. 25 Sept. 1990
%{{{  t

stdchar(uch "t", 12, 1/2, 1/2);
    pickup square_pen;
    if 1/2[l,r] <> good.x 1/2[l,r]: change_width; fi
    top y1 = top y2 = top y10 = h;
    bot y0 = bot y3 = bot y10 - dip_dp;
    lft x0 = lft x1 = l; rt x2 = rt x3 = r;
    x10 = x11 = 1/2[x1, x2];
    bot y11 = -d;
    draw z0 -- z1 -- z2 -- z3;
    draw z10 -- z11;
    labels(0,1,2,3,10,11)
endchar;
%}}}
% - pdc Wed. 26 Sept. 1990
%{{{  s

talldipchar(uch "s", 12, 1, 1);
    save superosity; superosity = 0.8;
    pickup round_pen;
    top y1 = cap_ht; top y0 = h; 
    bot y5 = baseline; bot y6 = -d;
    rt  x1 = rt  x0 = hround(r - 1/2u);	% top right
    lft x5 = lft x6 = hround(l + 1/2u);	% bottom left
    z3 = 1/2[z1, z5];		% middle
    y2 = 1/2[y1, y3]; lft x2 = l;
    y4 = 1/2[y3, y5]; rt x4 = r;
    x1a = x5a = x3; y1a = y1; y5a = y5;
    draw z1 --- curve_vhalf_path(z1a, z2, z3)
    	& curve_vhalf_path(z3, z4, z5a) --- z5;
    pickup square_pen; draw z0 -- z1; draw z5 -- z6;
    labels(0, 1, 1a, 2, 3, 4, 5a, 5, 6);
endchar;
%}}}
%{{{  o
stdchar(uch "o", 12, 1/2, 1/2);
    pickup round_pen;
    top y1 = h + o; bot y3 = -d - o;
    y0 = y2 = 1/2[y1,y3];
    lft x2 = l - o; rt x0 = r + o;
    x1 = x3 = 1/2[x0,x2];
    draw curve_cycle(z0, z1, z2, z3);
    labels(0,1,2,3)
endchar;
%}}}
%{{{  n
stdchar(uch "n", 12 + jut#/u#, 0, 1);
    pickup round_pen;
    istem_pts.stem(l, h, -d);
    nbowl_pts.bowl(l + jut, r); 
    cutdraw nbowl_path.bowl;
    pickup square_pen; draw istem_path.stem;
endchar;
%}}}
%{{{  m
stdchar(uch "m", 16, 1, 1);
    pickup round_pen;
    if 1/2[l,r] <> good.x 1/2[l,r]: change_width; fi
    nbowl_pts.bowl(1/2[l,r] - 1/2penw, r);
    bot z.foot = (1/2[l,r], baseline);
    cutdraw nbowl_path.bowl;
    cutdraw nbowl_path.bowl reflectedabout (z.foot, z.bowl.j);
    pickup square_pen; draw z.foot -- z.bowl.j;
    labels(foot);
endchar;
%}}}
%{{{  h
tallchar(uch "h", 12 + jut#/u#, 0, 1);
    pickup round_pen;
    istem_pts.stem(l, h, -d);
    nbowl_pts.bowl(l + jut, r); 
    cutdraw nbowl_path.bowl;
    pickup square_pen; draw istem_path.stem;
endchar;
%}}}  h
%{{{  i
stdchar(uch "i", (penw# + jut#)/u#, 0, 1);
    pickup square_pen;
    istem_pts(l, h, -d);
    draw istem_path;
endchar;
%}}}  i
%{{{  c
stdchar(uch "c", 11, 2/3, 1/2);
    pickup round_pen;
    cbowl_pts(l,r); cutdraw cbowl_path;
endchar;
%}}}  c
%{{{  e
dipchar(uch "e", 11 + 1/2jut#/u#, 1/2, 1/2);
    pickup round_pen;
    cbowl_pts.curve(l + 1/2jut, r); cutdraw cbowl_path.curve;
    pickup square_pen;
    lft z1 = (l, 1/2[baseline, cap_ht]); 
    y2 = y1; x2 = x.curve1 - 2 * xpart pen_adj;
    draw z1 -- z2;
    labels(1,2);
endchar;
%}}}
% - pdc 27th Sept. 1990.
%{{{  j
Dipchar(uch "j", (jut# + penw#)/u#, 0, 1);
    pickup square_pen;
    istem_pts(l, h, baseline);  jtail_attach();
    draw jstem_path;
    pickup round_pen; cutdraw jtail_path;
endchar;
%}}}
%{{{  g
Dipchar(uch "g", 11, 1/2, 1/2);
    pickup round_pen;
    cbowl_pts(l,r); cutdraw cbowl_path;
    istem_pts(r - jut - penw, vround(1/2[baseline,cap_ht]), -dip_dp);
    jtail_attach(); cutdraw jtail_path;
    pickup square_pen; draw jstem_path;
endchar;
%}}}
%{{{  p
stdchar(uch "p", 11 + jut#/u#, 0, 1);
    pickup square_pen;
    istem_pts.stem(l, h, -d); draw istem_path.stem;
    pickup round_pen;
    pbowl_pts.bowl(l + jut, r, 0.333[baseline, cap_ht]);
    pbowl_draw.bowl;
endchar;
%}}}
%{{{  d
stdchar(uch "d", 11 + jut#/u#, 0, 1);
    pickup square_pen;
    istem_pts.stem(l, h, -d); draw istem_path.stem;
    pickup round_pen;
    pbowl_pts.bowl(l + jut, r, top baseline - o);
    pbowl_draw.bowl;
endchar;
%}}}
% - pdc Sun. 30 Sept. 1990
%{{{  f
Dipchar(uch "f", 10 + jut#/u#, 0, 1/2);
    pickup square_pen;
    istem_pts(l, h, -d); jtail_attach();
    %  Define points at right of top bar:
    y1 = y.jut; rt x1 = rt x2 = r; bot y2 = bot y1 - dip_dp;
    % Define points for bottom bar:
    y3 = y4 = good.y 0.4cap_ht; bot y5 = bot y4 - dip_dp;
    lft x3 = hround(lft x.top - 1/2jut); rt x4 = rt x5 = hround(r - jut);
    draw jstem_path; draw z.jut -- z1 -- z2;
    % draw z3 -- z4 -- z5;
    draw z3 -- z4;
    pickup round_pen; cutdraw jtail_path;
    labels(range 1 thru 5);
endchar;
%}}}
%{{{  L
talldipchar("L", 12 + jut#/u#, 0, 1/2);
    pickup square_pen;
    istem_pts(l, h, baseline);
    y1 = y.bot; rt x1 = rt x2 = r; bot y2 = -d;
    draw istem_path -- z1 -- z2;
    labels(1,2);
endchar;
%}}}
%{{{  l
tallchar(uch "l", 12 + jut#/u#, 0, 1/2);
    pickup square_pen;
    istem_pts(l, h, baseline);
    y1 = y.bot; rt x1 = rt x2 = r; top y2 = top y1 + dip_dp;
    draw istem_path -- z1 -- z2;
    labels(1,2);
endchar;
%}}}
% - pdc Sun. 30 Sept. 1990

%{{{  a
%  Trying to get the spine to work in odd situations took some work:
stdchar(uch "a", (15u# - agap# + jut#)/u#, 1, 0);
    z1r = (l + agap, h);			  % where top corner goes
    z2c = (r - jut, baseline + penh);		  % used to get angles right
    z1l - z1r = z2l - z2r = 2 * penoffset (z2c - z1r) of currentpen;
    z1 = 1/2[z1l, z1r]; z2 = 1/2[z2l, z2r];
    z2r = z1r + whatever * (z1r - z2c);		  % where bot corner goes
    y2l = baseline;
    fill z1r -- z2r -- z2l -- z1l -- cycle;	  % draw spine

    pickup round_pen;
    z.centre = z.centre' + jut*right = 1/2[z1, z2]; 
    bot lft z.botleft = bot lft z.botleft' - jut*right = (l, baseline);
    draw curve_qtr_path(z.centre', z.botleft) --- 
    	curve_qtr_path(z.botleft', z.centre) --- cycle;
    pickup square_pen;
    drawdot z.botleft;

    top lft z1b + ajut*right = top rt z1a = z1r; 
    bot rt z2b = (r, baseline); bot lft z2a = z2l;
    draw z1a -- z1b; draw z2a -- z2b;
    labels(2c, forsuffixes $ = 1,2: $a, $b, $, $l, $r, endfor 
    	centre, centre', botleft, botleft');
endchar;
%}}}
%{{{  oo
ifcode oo:
    vardef circ@#(expr leftx, topy) =
    	top y@#h = vround topy + o; bot y@#hh = vround (topy - 9u) - o;
    	lft x@#v = hround leftx - o; rt x@#vv = hround (leftx + 9u) + o;
    	y@#v = y@#vv = 1/2[y@#h, y@#hh];
    	x@#h = x@#hh = 1/2[x@#v, x@#vv];
    	draw curve_cycle(z@#v, z@#h, z@#vv, z@#hh);
    enddef;

    stdchar(code.oo, 18 + 1/2space#/u#, 1/2, 1/2); "oo ligature";
    	pickup round_pen;
    	circ1(l, h); circ2(l + 9u + 1/2space, 9u);
    endchar;
fi
%}}}
%{{{  ll
ifcode ll:
    vardef elle@#(expr leftx) =
        istem_pts@#(hround leftx, h, -d); 
    	y@#a = y@#bot; rt x@#a = hround(leftx + 9u);
    	draw istem_path@# -- z@#a;
    	labels(@#a)
    enddef;

    tallchar(code.ll, 18 + (space# - jut#)/u#, 0, 1/2); "ligature LL";
    	pickup square_pen;
    	elle1(l); elle2(l + 9u + space - jut);
    endchar;
fi
%}}}

%{{{  R
%  I need a quick-&-dirty "R" to do the Fred & Daniel banner
%  Will do a better-looking one later
% - pdc Mon.  8 Oct. 1990
stdchar(uch "r", 12 + jut#/u#, 1/2, 1); "Hackjob R";
    pickup square_pen;
    istem_pts.stem(l, h, -d); draw istem_path.stem;
    pickup round_pen;
    pbowl_pts.t(l + jut, r - u, 0.5[baseline, cap_ht]);
    pbowl_draw.t;
    bot rt z.tail = (r, baseline); lft z.tj = lft z.tail + jut*left;
    cutdraw z.t.hh -- z.tj -- rt z.tail;
    labels(tj,tail);
endchar;
%}}}
% - pdc Tue. 16 Oct. 1990
%{{{  y
Dipchar(uch "y", 12, 1/2, 1);
    pickup round_pen;
    z.t = (l + nindent, h); % top
    y.v = 1/2h; y.j = h - njoin; 
    lft x.v = l; rt x.j = r;
    bot y.h = baseline - o; x.h = 1/2[x.j,x.v];	% bot of bowl
    labels(j, h, v, t);
    cutdraw z.j{(z.h - z.j) yscaled 2} ... {(z.h - z.j) yscaled 0}z.h
 	&  curve_qtr_path(z.h,z.v) .. z.t;
    pickup square_pen;
    top rt z.tl.t = (r, h);
    bot rt z.tl.b = (r, -d);
    bot lft z.tl.f = (1/2[r,l],-d);
    draw z.tl.t -- z.tl.b -- z.tl.f;
    labels(tl.t,tl.b,tl.f);
endchar;
%}}}

%{{{  v
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% - pdc Sat. 12 Jan. 1991
stdchar(uch "v", 12 + jut#/u#, 0, 1/2);
    numeric mid; mid = l + 5.5u;

    % points of the topleft serif:
    z0 = z1 + penh*up = (l, h); 
    z2 = z1 + penw * right;
    z5 = z0 + whatever * right; 

    % points on the diagonal:
    z3 = (hround (mid - u), 0);
    numeric theta; theta = angle(z2 - z3);
    z5 - z5a = z3a - z3 = 1/2[penh, penw] * dir (theta - 90);
    z5 - z3a = z5a - z3 = whatever * dir theta;

    % points on curve to right:
    z10 = z11 + penw * right = (r, h);
    z13 = z13a + penh * down = (mid, 0);
    numeric sup; sup = 0.7;
    z14 = sup[(x13a, y11), (x11, y13a)];
    z15 = sup[(x13, y10), (x10, y13)];

    pickup pencircle scaled 2; 
    fill z5 -- z0 -- z1 -- z2 -- z3 -- z13 -- z3a -- cycle;
    fill z10 -- z11{down} ... z14{z13a - z11} ... {left}z13a 
    	-- z13{right} ... z15{z10 - z13} ... {up}cycle;
    labels(0, 1, 2, 3, 3a, 5, 5a, 10, 11, 12, 13, 13a, 14, 15);
endchar;
%}}}    
%}}} dkalpha.mf

%Local variables:
%fold-folded-p:t
%End: