%%% ====================================================================
%%%  @METAFONT-file{
%%%     author-1        = "Jeremy Gibbons",
%%%     author-2        = "Alan Jeffrey",
%%%     version         = "1.1",
%%%     date            = "02 June 1992",
%%%     time            = "15:06:36 BST",
%%%     filename        = "stmaryba.mf",
%%%     address-1       = "Department of Computer Science
%%%                        University of Aukland
%%%                        Private Bag
%%%                        Aukland
%%%                        New Zealand",
%%%     address-2       = "School of Cognitive and Computing Sciences
%%%                        University of Sussex
%%%                        Brighton BN1 9QH
%%%                        UK",
%%%     telephone-1     = "+64 9 373 7599 x 5120",
%%%     telephone-2     = "+44 273 606755 x 3238",
%%%     FAX-1           = "+64 9 373 7453",
%%%     FAX-2           = "+44 273 678188",
%%%     checksum        = "49457 121 567 4939",
%%%     email-1         = "jeremy@cs.aukuni.ac.nz",
%%%     email-2         = "alanje@cogs.sussex.ac.uk",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "metafont symbols math fonts",
%%%     supported       = "yes",
%%%     abstract        = "This is part of the metafont program for
%%%                        the St Mary's Road symbol font.",
%%%     docstring       = "This is part of the metafont program for
%%%                        the St Mary's Road symbol font.  The font
%%%                        contains a number of mathematical
%%%                        characters which are not present in the
%%%                        standard TeX and AMS symbol fonts.
%%%
%%%                        It is described in stmaryrd.tex.
%%%
%%%                        Copyright 1992 Jeremy Gibbons and Alan Jeffrey.
%%%
%%%                        The checksum field above contains a CRC-16
%%%                        checksum as the first value, followed by the
%%%                        equivalent of the standard UNIX wc (word
%%%                        count) utility output of lines, words, and
%%%                        characters.  This is produced by Robert
%%%                        Solovay's checksum utility.",
%%%     package         = "St Mary's Road",
%%%     dependencies    = "none",
%%%  }
%%% ====================================================================
%%%
%%% 20 May 1991, v1.0: Created the font out of alans.mf and galileo.mf.
%%%
%%% 2 Jun 1992, v1.1: added the headers.

% This is the base file for the St Mary's Road symbol font, stmaryrd.mf.

% The following stolen from the AMS bsymbols.mf file:

def char_negate(suffix c,t,b) = %c is center point; t is top point; b is bottom
pickup rule.nib;
w-x.t=x.b; y.t-y.c=y.c-y.b; draw z.t--z.b;
penlabels(t,c,b); enddef;
def char_center(suffix c) = % find center of type character
x.c=w/2; y.c=.5[-d,h]; enddef;

% The command to draw semantic brackets:

def left_semantic_bracket(expr breadth,do_top,do_bot) =
 pickup crisp.nib;
 numeric thickness; thickness=hround breadth;
 pos1(thickness,0); pos2(thickness,0);
 top y1=h; bot y2=1-d; lft x1l=lft x2l=hround(2.5u-.5thickness);
 filldraw stroke z1e--z2e;  % stem1
 pos3(thickness,90); pos4(thickness,90);
 pos5(thickness,90); pos6(thickness,90);
 x3=x5=x1l; rt x4=rt x6=hround(w-.75u+.5thickness);
 y3r=y4r=y1; y5l=y6l=y2;
 if do_top: filldraw stroke z3e--z4e; fi  % upper bar
 if do_bot: filldraw stroke z5e--z6e; fi  % lower bar
 pos7(thickness,0); pos8(thickness,0);
 y7=y1; y8=y2; x7=x8=x1+hround(0.5(w - 3.25u));
 filldraw stroke z7e--z8e;  % stem2
 penlabels(1,2,3,4,5,6,7,8); enddef;

def right_semantic_bracket(expr breadth,do_top,do_bot) =
 pickup crisp.nib;
 numeric thickness; thickness=hround breadth;
 pos1(thickness,0); pos2(thickness,0);
 top y1=h; bot y2=1-d; rt x1r=rt x2r=hround(w-2.5u+.5thickness);
 filldraw stroke z1e--z2e;  % stem1
 pos3(thickness,90); pos4(thickness,90);
 pos5(thickness,90); pos6(thickness,90);
 x3=x5=x1r; lft x4=lft x6=hround(.75u-.5thickness);
 y3r=y4r=y1; y5l=y6l=y2;
 if do_top: filldraw stroke z3e--z4e; fi  % upper bar
 if do_bot: filldraw stroke z5e--z6e; fi  % lower bar
 pos7(thickness,0); pos8(thickness,0);
 y7=y1; y8=y2; x7=x8=x1-hround(0.5(w - 3.25u));
 filldraw stroke z7e--z8e;  % stem2
 penlabels(1,2,3,4,5,6,7,8); enddef;

% The command to draw a circle (with free symmetry hacks):

def begincircle (expr n) =
   beginarithchar(n);
      pickup rule.nib;
      if .5w <> good.x .5w: change_width; fi
      lft x6=hround u-eps; x2=w-x6; y2=math_axis; y8-y2 = .5(x2-x6);
      circle_points; draw_circle  % circle
enddef;

% And to draw a box (with free symmetry hacks):

def beginbox (expr n) =
   beginarithchar(n);
      pickup rule.nib;
      if .5w <> good.x .5w: change_width; fi
      lft x1=hround 1.5u-eps; x2=w-x1; x3=x2; x4=x1;
      y1-y4 = x2-x1; .5[y1,y4]=math_axis; y1=y2; y3=y4;
      draw z1--z2--z3--z4--cycle; % box
enddef
