
  %% serifs.mf
  %% Copyright 2005 Laurie Field
  %
  % This work is LFB, version 1.0.
  %
  % This work may be distributed and/or modified under the
  % conditions of the LaTeX Project Public License, either version 1.3
  % of this license or (at your option) any later version.
  % The latest version of this license is in
  %   http://www.latex-project.org/lppl.txt
  % and version 1.3 or later is part of all distributions of LaTeX
  % version 2003/12/01 or later.
  %
  % This work has the LPPL maintenance status "maintained".
  % 
  % This Current Maintainer of this work is Laurie Field.
  %
  % This work consists of the files:
  %   
  %   example.tex
  %   lfbacc.tex
  %   
  %   accents.mf
  %   alpha.mf
  %   beta.mf
  %   capitals.mf
  %   charmap.mf
  %   delta.mf
  %   epsilon.mf
  %   eta.mf
  %   gamma.mf
  %   iota.mf
  %   kappa.mf
  %   khi.mf
  %   lambda.mf
  %   lfb.mf
  %   lfb5.mf
  %   lfb6.mf
  %   lfb7.mf
  %   lfb8.mf
  %   lfb9.mf
  %   lfb10.mf
  %   lfb11.mf
  %   lfb12.mf
  %   lfbb5.mf
  %   lfbb6.mf
  %   lfbb7.mf
  %   lfbb8.mf
  %   lfbb9.mf
  %   lfbb10.mf
  %   lfbb11.mf
  %   lfbb12.mf
  %   ligature.mf
  %   mu.mf
  %   nu.mf
  %   omega.mf
  %   omikron.mf
  %   others.mf
  %   phi.mf
  %   pi.mf
  %   psi.mf
  %   rho.mf
  %   serifs.mf
  %   sigma.mf
  %   sigmafin.mf
  %   tau.mf
  %   theta.mf
  %   upsilon.mf
  %   xi.mf
  %   zeta.mf
  %   
  % and the derived files:
  %   
  %   lfb5.tfm
  %   lfb6.tfm
  %   lfb7.tfm
  %   lfb8.tfm
  %   lfb9.tfm
  %   lfb10.tfm
  %   lfb11.tfm
  %   lfb12.tfm
  %   lfbb5.tfm
  %   lfbb6.tfm
  %   lfbb7.tfm
  %   lfbb8.tfm
  %   lfbb9.tfm
  %   lfbb10.tfm
  %   lfbb11.tfm
  %   lfbb12.tfm
  %   
  %   lfb5.600pk
  %   lfb6.600pk
  %   lfb7.600pk
  %   lfb8.600pk
  %   lfb9.600pk
  %   lfb10.600pk
  %   lfb11.600pk
  %   lfb12.600pk
  %   lfbb5.600pk
  %   lfbb6.600pk
  %   lfbb7.600pk
  %   lfbb8.600pk
  %   lfbb9.600pk
  %   lfbb10.600pk
  %   lfbb11.600pk
  %   lfbb12.600pk
  %

def stem
	(suffix stop, sbot, stoplft, stoprt, stopdish, sbotlft, sbotrt, sbotdish)
	(expr thetop, thebot, toptilt, bottilt, breadth, slabwidth, jut)
=	numeric stemangle;
	stemangle=angle(thetop-thebot);
	numeric endinset;
	endinset=3/4jut;
	penpos stop(breadth, stemangle-90);
	penpos sbot(breadth, stemangle-90);
	penpos stoplft(slabwidth, stemangle+toptilt);
	penpos stoprt(slabwidth, stemangle+toptilt);
	penpos sbotlft(slabwidth, stemangle+bottilt);
	penpos sbotrt(slabwidth, stemangle+bottilt);
	z[stoplft].r=thetop+(1/2breadth+jut)*dir(stemangle+toptilt+90);
	z[stoprt].r=thetop+(1/2breadth+jut)*dir(stemangle+toptilt-90);
	z[stopdish]=thetop+dishdepth*dir(stemangle+toptilt+180);
	z[sbotlft].l=thebot+(1/2breadth+jut)*dir(stemangle+bottilt+90);
	z[sbotrt].l=thebot+(1/2breadth+jut)*dir(stemangle+bottilt-90);
	z[sbotdish]=thebot+dishdepth*dir(stemangle+bottilt);
	z[stop]=thetop+whatever*dir(stemangle+180);
	if toptilt>0:
		z[stop].l=thetop+whatever*dir(stemangle+toptilt+90)
			+endinset*dir(stemangle+toptilt+180);
	else:
		z[stop].r=thetop+whatever*dir(stemangle+toptilt-90)
			+endinset*dir(stemangle+toptilt+180);
	fi;
	z[sbot]=thebot+whatever*dir(stemangle);
	if bottilt>0:
		z[sbot].r=thebot+whatever*dir(stemangle+bottilt-90)
			+endinset*dir(stemangle+bottilt);
	else:
		z[sbot].l=thebot+whatever*dir(stemangle+bottilt+90)
			+endinset*dir(stemangle+bottilt);
	fi;
	fill z[stop].l---z[sbot].l..{dir(stemangle+bottilt+90)}z[sbotlft].r
		--z[sbotlft].l..z[sbotdish]..z[sbotrt].l--z[sbotrt].r
		{dir(stemangle+bottilt+90)}..z[sbot].r---z[stop].r
		..{dir(stemangle+toptilt-90)}z[stoprt].l--z[stoprt].r
		..z[stopdish]..z[stoplft].r--z[stoplft].l{dir(stemangle+toptilt-90)}
		..cycle;
	fill z[stoplft].r--z[stoprt].r
		--z[stoprt].l+((0,0) rotated(stemangle+toptilt-90))
		--z[stoplft].l+((0,0) rotated(stemangle+toptilt-90))--cycle;
	fill z[sbotlft].l--z[sbotrt].l
		--z[sbotrt].r+((0,0) rotated(stemangle+bottilt-90))
		--z[sbotlft].r+((0,0) rotated(stemangle+bottilt-90))--cycle;
enddef;


def singlestem % bottom only has serif
	(suffix stop, sbot, sbotlft, sbotrt, sbotdish)
	(expr thetop, thebot, bottilt, breadth, slabwidth, jut)
=	numeric stemangle;
	stemangle=angle(thetop-thebot);
	numeric endinset;
	endinset=3/4jut;
	penpos stop(breadth, stemangle-90);
	penpos sbot(breadth, stemangle-90);
	penpos sbotlft(slabwidth, stemangle+bottilt);
	penpos sbotrt(slabwidth, stemangle+bottilt);
	z[stop]=thetop;
	z[sbotlft].l=thebot+(1/2breadth+jut)*dir(stemangle+bottilt+90);
	z[sbotrt].l=thebot+(1/2breadth+jut)*dir(stemangle+bottilt-90);
	z[sbotdish]=thebot+dishdepth*dir(stemangle+bottilt);
	z[sbot]=thebot+whatever*dir(stemangle);
	if bottilt>0:
		z[sbot].r=thebot+whatever*dir(stemangle+bottilt-90)
			+endinset*dir(stemangle+bottilt);
	else:
		z[sbot].l=thebot+whatever*dir(stemangle+bottilt+90)
			+endinset*dir(stemangle+bottilt);
	fi;
	fill z[stop].l---z[sbot].l..{dir(stemangle+bottilt+90)}z[sbotlft].r
		--z[sbotlft].l..z[sbotdish]..z[sbotrt].l--z[sbotrt].r
		{dir(stemangle+bottilt+90)}..z[sbot].r---z[stop].r--cycle;
	fill z[sbotlft].l--z[sbotrt].l
		--z[sbotrt].r+((0,0) rotated(stemangle+bottilt-90))
		--z[sbotlft].r+((0,0) rotated(stemangle+bottilt-90))--cycle;
enddef;


def oneandlefthalfstem
	(suffix stop, sbot, stoplft, stoprt, stopdish, sbotlft, sbotrt, sbotdish)
	(expr thetop, thebot, toptilt, bottilt, breadth, slabwidth, jut)
=	numeric stemangle;
	stemangle=angle(thetop-thebot);
	numeric endinset;
	endinset=3/4jut;
	penpos stop(breadth, stemangle-90);
	penpos sbot(breadth, stemangle-90);
	penpos stoplft(slabwidth, stemangle+toptilt);
	penpos stoprt(slabwidth, stemangle);
	penpos sbotlft(slabwidth, stemangle+bottilt);
	penpos sbotrt(slabwidth, stemangle+bottilt);
	z[stoplft].r=thetop+(1/2breadth+jut)*dir(stemangle+toptilt+90);
	z[stoprt].r=thetop+(1/2breadth)*dir(stemangle+toptilt-90);
	z[stopdish]=thetop+dishdepth*dir(stemangle+toptilt+180);
	z[sbotlft].l=thebot+(1/2breadth+jut)*dir(stemangle+bottilt+90);
	z[sbotrt].l=thebot+(1/2breadth+jut)*dir(stemangle+bottilt-90);
	z[sbotdish]=thebot+dishdepth*dir(stemangle+bottilt);
	z[stop]=thetop+whatever*dir(stemangle+180);
	if toptilt>0:
		z[stop].l=thetop+whatever*dir(stemangle+toptilt+90)
			+endinset*dir(stemangle+toptilt+180);
	else:
		z[stop].r=thetop+whatever*dir(stemangle+toptilt-90)
			+endinset*dir(stemangle+toptilt+180);
	fi;
	z[sbot]=thebot+whatever*dir(stemangle);
	if bottilt>0:
		z[sbot].r=thebot+whatever*dir(stemangle+bottilt-90)
			+endinset*dir(stemangle+bottilt);
	else:
		z[sbot].l=thebot+whatever*dir(stemangle+bottilt+90)
			+endinset*dir(stemangle+bottilt);
	fi;
	fill z[stop].l---z[sbot].l..{dir(stemangle+bottilt+90)}z[sbotlft].r
		--z[sbotlft].l..z[sbotdish]..z[sbotrt].l--z[sbotrt].r
		{dir(stemangle+bottilt+90)}..z[sbot].r---z[stoprt].r
		--z[stoplft].r--z[stoplft].l{dir(stemangle+toptilt-90)}
		..cycle;
	fill z[sbotlft].l--z[sbotrt].l
		--z[sbotrt].r+((0,0) rotated(stemangle+bottilt-90))
		--z[sbotlft].r+((0,0) rotated(stemangle+bottilt-90))--cycle;
enddef;


def oneandrighthalfstem
	(suffix stop, sbot, stoplft, stoprt, stopdish, sbotlft, sbotrt, sbotdish)
	(expr thetop, thebot, toptilt, bottilt, breadth, slabwidth, jut)
=	numeric stemangle;
	stemangle=angle(thetop-thebot);
	numeric endinset;
	endinset=3/4jut;
	penpos stop(breadth, stemangle-90);
	penpos sbot(breadth, stemangle-90);
	penpos stoplft(slabwidth, stemangle);
	penpos stoprt(slabwidth, stemangle+toptilt);
	penpos sbotlft(slabwidth, stemangle+bottilt);
	penpos sbotrt(slabwidth, stemangle+bottilt);
	z[stoplft].r=thetop+(1/2breadth)*dir(stemangle+toptilt+90);
	z[stoprt].r=thetop+(1/2breadth+jut)*dir(stemangle+toptilt-90);
	z[stopdish]=thetop+dishdepth*dir(stemangle+toptilt+180);
	z[sbotlft].l=thebot+(1/2breadth+jut)*dir(stemangle+bottilt+90);
	z[sbotrt].l=thebot+(1/2breadth+jut)*dir(stemangle+bottilt-90);
	z[sbotdish]=thebot+dishdepth*dir(stemangle+bottilt);
	z[stop]=thetop+whatever*dir(stemangle+180);
	if toptilt>0:
		z[stop].l=thetop+whatever*dir(stemangle+toptilt+90)
			+endinset*dir(stemangle+toptilt+180);
	else:
		z[stop].r=thetop+whatever*dir(stemangle+toptilt-90)
			+endinset*dir(stemangle+toptilt+180);
	fi;
	z[sbot]=thebot+whatever*dir(stemangle);
	if bottilt>0:
		z[sbot].r=thebot+whatever*dir(stemangle+bottilt-90)
			+endinset*dir(stemangle+bottilt);
	else:
		z[sbot].l=thebot+whatever*dir(stemangle+bottilt+90)
			+endinset*dir(stemangle+bottilt);
	fi;
	fill z[stoplft].r---z[sbot].l..{dir(stemangle+bottilt+90)}z[sbotlft].r
		--z[sbotlft].l..z[sbotdish]..z[sbotrt].l--z[sbotrt].r
		{dir(stemangle+bottilt+90)}..z[sbot].r---z[stop].r
		..{dir(stemangle+toptilt-90)}z[stoprt].l--z[stoprt].r--cycle;
	fill z[sbotlft].l--z[sbotrt].l
		--z[sbotrt].r+((0,0) rotated(stemangle+bottilt-90))
		--z[sbotlft].r+((0,0) rotated(stemangle+bottilt-90))--cycle;
enddef;


def barrightserif
	(suffix shoulder, elbow, wrist, hand)
	(expr thestart, theend, breadth, serifwidth, jut, indent)
=	numeric thebarangle;
	thebarangle=angle(theend-thestart);
	numeric forearm;
	forearm=3/4jut;
	penpos shoulder(breadth, thebarangle+90);
	penpos elbow(breadth, thebarangle+90);
	penpos wrist(breadth, thebarangle+90);
	penpos hand(serifwidth, thebarangle);
	z[shoulder].r=thestart;
	z[elbow].r=z[wrist].r+forearm*dir(thebarangle-180);
	z[wrist].r=theend+indent*dir(thebarangle-180);
	z[hand].r=theend+(breadth+jut)*dir(thebarangle-90);
	numeric serifangle;
	serifangle=angle(z[wrist].r-z[hand].r);
	fill z[shoulder].l---z[elbow].l..{dir(serifangle-180)}z[hand].l
		--z[hand].r--z[wrist].r--z[shoulder].r--cycle;
enddef;


def barleftserif
	(suffix shoulder, elbow, wrist, hand)
	(expr thestart, theend, breadth, serifwidth, jut, indent)
=	numeric thebarangle;
	thebarangle=angle(theend-thestart);
	numeric forearm;
	forearm=3/4jut;
	penpos shoulder(breadth, thebarangle-90);
	penpos elbow(breadth, thebarangle-90);
	penpos wrist(breadth, thebarangle-90);
	penpos hand(serifwidth, thebarangle);
	z[shoulder].r=thestart;
	z[elbow].r=z[wrist].r+forearm*dir(thebarangle-180);
	z[wrist].r=theend+indent*dir(thebarangle-180);
	z[hand].r=theend+(breadth+jut)*dir(thebarangle+90);
	numeric serifangle;
	serifangle=angle(z[wrist].r-z[hand].r);
	fill z[shoulder].l---z[elbow].l..{dir(serifangle-180)}z[hand].l
		--z[hand].r--z[wrist].r--z[shoulder].r--cycle;
enddef;
