%%
%% This is file `uncltitle.mf',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% uncial.dtx  (with options: `mfd')
%% 
%%  Copyright 1999 Peter R. Wilson
%% 
%%  This program is provided under the terms of the
%%  LaTeX Project Public License distributed from CTAN
%%  archives in directory macros/latex/base/lppl.txt.
%% 
%% Author: Peter Wilson (CUA)
%%         now at: peter.r.wilson@boeing.com
%% 
def makebox(text rule) =
  for y=0,half_height,cap_height,body_height,x_height,-desc_depth,-body_depth:
    rule((l,y)t_,(r,y)t_); endfor  % horizontals
  for x=l,r: rule((x,-body_depth)t_,(x,body_height)t_); endfor % verticals
  for x=u*(1+floor(1/u)) step u until r-1:
    rule((x,-body_depth)t_,(x,body_height)t_); endfor         % more verticals
  if charic<>0:
    rule((r+charic*pt,h.o_),(r+charic*pt,.5h.o_)); fi  % italic correction
enddef;


def proofpcbb(suffix $)(expr xoff, yoff) =
if proofing > 0:
  x$bl = x$ - xoff; y$bl = y$ - yoff;         % Bottom Left Hand Corner
  z$br = (x$bl+side, y$bl);                   % BRHC
  z$tr = (x$bl+side, y$bl+side);              % TRHC
  z$tl = (x$bl, y$bl+side);                   % TLHC
  z$bc = 1/2[z$bl,z$br]; z$tc = 1/2[z$tl,z$tr];  % horizontal mid points
  pair hc, vc;
  hc = (2u,0); vc = (0,2u);
  pickup pensquare scaled 2;
  for s = z$bl, z$br, z$tr, z$tl, z$bc, z$tc:
    draw s-hc--s+hc;
    draw s-vc--s+vc;
  endfor
fi
enddef;


def uncial_font_setup= % contains special stuff for uncial fonts
  define_pixels(side,half_height,carol_height,comma_width);
  define_pixels(u,dot_size,letter_size,cap_height,width_adj,serif_fit,
                cap_serif_fit,jut,cap_jut);
  define_pixels(fig_width);
  define_whole_pixels(letter_fit);
  define_whole_vertical_pixels(body_height,asc_height,cap_height,x_height,
                               desc_depth,body_depth,fig_height);
  define_corrected_pixels(o);
  define_blacker_pixels(thick,thin);
  let adjust_fit = normal_adjust_fit;
  pickup pencircle scaled thin;
  stylus:=savepen;
  pickup pencircle xscaled thick yscaled thin rotated pangle;
  quill:=savepen;
  numeric pcshiftx#; % x value of LHS of box wrt origin of char box
  define_pixels(pcshiftx);
  numeric sqxside#;   % x size of the square
  numeric sqyside#;   % y size of the square
  define_pixels(sqxside,sqyside);

enddef; % end of uncial_font_setup

boolean ductus;
ductus:=false;
numeric qhor, qvert;
qhor:=cosd(pangle); qvert:=sind(pangle);
pair pdir; pdir=dir(pangle);
pair ppdir; ppdir=dir(pangle+90);

def draw_serif(suffix $, $$)(expr fr)=
  numeric beta, ajut, bjut;
  beta=1-fr;
  ajut=fr*jut; bjut=beta*jut;
  pair vec[]; vec1=unitvector(z$$-z$);
  vec2=ajut*vec1;
  z$a=z$ shifted vec2;
  z$b=z$a rotatedaround (z$,-90);
  boolean top_serif;
  if y$>y$$:
    top_serif := true;
    z$c=z$b shifted (-bjut*pdir);
  else:
    top_serif:=false;
    z$c=z$b shifted (bjut*pdir);
  fi
  if top_serif:
    draw z$c--z$b{pdir}..{z$$-z$}z$a;    % the serif
  else:
    draw z$c--z$b{-pdir}..{z$$-z$}z$a;
  fi
  labels($a,$b,$c);
enddef; % end of draw_serif


def draw_istem(suffix $, $$)(expr fr)=
  draw_serif($, $$, fr);  % top serif
  draw_serif($$, $, fr);  % bottom serif
  draw z$a--z$$a;  % the stem
enddef; % end of draw_istem


def draw_tstem(suffix $, $$)(expr fr)=
  draw_serif($$, $, fr);  % the serif
  draw z$--z$$a;                      % the stem
enddef; % end of draw_tstem


def draw_tlserif(suffix $, $$)(expr fr)=
  draw_serif($, $$, fr);  % the serif
  draw z$a--z$$;                       % the stem
enddef; % end of draw_tlserif


def draw_jstem(suffix $, $$)(expr fr, jjut, jdepth)=
  draw_serif($, $$, fr);  % the serif
  lft x$$a=x$$-jjut; bot y$$a=y$$-jdepth;
  draw z$a--z$${down}..{-pdir}z$$a;   % straight stem and curved ending
  labels($$a);
enddef; % end of draw_jstem


def draw_jcurve(suffix $)(expr fr, jjut, jdepth)=
  z$'= z$ shifted down;
  draw_serif($, $', fr);  % the serif
  lft x$d=x$-jjut; bot y$d=y$-jdepth;
  draw z$a{down}...{-pdir}z$d;   % curved downwards stem
  labels($d);
enddef; % end of draw_jcurve


def draw_flick(suffix $)(expr rise, fall, fjut)=
  rt x$b = x$+fjut; top y$b=y$-fall;
  x$a=0.5[x$,x$b]; top y$a=y$+rise;
  draw z$..z$a..z$b;
  labels($a,$b);
enddef; % end of draw_flick


def draw_hbowl(suffix $)(expr rise, fall, fjut)=
  numeric rad; rad=0.5(rise+fall);
  x$c=x$+fjut-rad; y$c=y$+rise-rad;
  lft x$d=x$c-rad; rt x$f=x$c+rad; y$d=y$f=y$c;
  x$e=x$g=x$c; top y$e=y$c+rad; bot y$g=y$c-rad;
  z$k = z$c shifted (-rad*ppdir);
  path p[];
  p1 = z$e{right}..z$f{down}..{left}z$g;
  z$i = (z$c--z$k) intersectionpoint p1;
  x$j=x$i; bot y$j = y$c-rad;
  draw z$..z$e{right}..z$f{down}..{-pdir}z$j;
  labels($c,$d,$e,$f,$g,$i,$j,$k);
enddef; % end of draw_hbowl


def draw_wave(suffix $,$$)(expr f)=
  x$wl=x$; y$wl=y$-f;
  x$wr=x$$; y$wr=y$$+f;
  z$wc=0.5[z$wl,z$wr];
  draw z$wl{pdir}..z$wc{right}..{pdir}z$wr;
  labels($wl,$wc,$wr);
enddef; % end of draw_wave

def draw_pdot(suffix $)(expr sz)=
  z$s = z$ shifted (0.5sz*left);
  z$t = z$ shifted (0.5sz*up);
  z$u = z$s shifted (sz*right);
  z$v = z$t shifted (sz*down);
  pickup stylus;
  filldraw z$s--z$t--z$u--z$v--cycle;
  labels($s,$t,$u,$v);
enddef; % end of draw_pdot


def draw_pcomma(suffix $)(expr sz, ar)=
  z$s = z$ shifted (0.5sz*left);
  z$t = z$s shifted (sz*right);
  x$v=x$s-ar; y$v=y$s-ar;
  z$u = z$v shifted (sz*right);
  pickup stylus;
  filldraw z$s--z$t--z$u--z$v--cycle;
  labels($s,$t,$u,$v);
enddef; % end of draw_pcomma


def draw_plq(suffix $)(expr sz, ar)=
  z$s = z$ shifted (0.5sz*left);
  z$t = z$s shifted (sz*right);
  x$v=x$s+ar; y$v=y$s-ar;
  z$u = z$v shifted (sz*right);
  pickup stylus;
  filldraw z$s--z$t--z$u--z$v--cycle;
  labels($s,$t,$u,$v);
enddef; % end of draw_plq


font_coding_scheme:="ASCII minuscules and punctuation";
mode_setup;
uncial_font_setup;


input uncll;        % minuscules (lower case)
input unclu;        % majuscules (capitals)
input unclpunct;    % punctuation
input uncllig;      % the several dashes
input uncldig;      % arabic digits
%%%input unclp;        % ampersand and ?mark


font_slant slant; font_x_height x_height#;
if monospace: font_normal_space 9u#; % no stretching or shrinking
 font_quad 18u#;
 font_extra_space 9u#;
else: font_normal_space 6u#+2letter_fit#;
 font_normal_stretch 3u#; font_normal_shrink 2u#;
 font_quad 18u#+4letter_fit#;
 font_extra_space 2u#;
 k#:=-.5u#; kk#:=-1.5u#; kkk#:=-2u#; % three degrees of kerning
%% ligtable "P": "T": "Y": "A" kern kk#;
%% ligtable "F": "V": "W": "A" kern if serifs: kkk# else: kk#fi,
%%  "K": "X": "O" kern k#, "C" kern k#, "G" kern k#, "Q" kern k#;
%% ligtable "O": "D": "X" kern k#, "W" kern k#, "A" kern k#,
%%   "V" kern k#, "Y" kern k#;
%% ligtable "A": if serifs: "R": fi
%%  "C" kern k#, "O" kern k#, "G" kern k#, "U" kern k#, "Q" kern k#,
%%  "L": "T" kern kk#, "Y" kern kkk#, "V" kern kk#, "W" kern kkk#;
%%ligtable "I": "I" kern -k#; % Richard III
fi

bye.

