% Metafont-Example.mf
% 
% This is a sample file for the Metafont mode with Alpha. 
% 
% The features which are herein described will work only if Metafont Mode
% has been properly installed.
% 
% 
% Ñ syntax colorizing
% 
% Ñ capacity to process a source file from within Alpha with various flags,
% printer modes, input base files
% 
% - editing of the log file
% 
% - capacity to make the pk file, to make the dvi from the generic font, to
% view the dvi;
% 
% - creating and editing the property list for a font
% 
% - processing all the source files in a folder instead of a single file
% 
% - file marking
% 
% - ready to use template for a new font
% 
% - key bindings to choose the processing mode, process files etc.
% 
% - command clicking on a word leads to its definition
% 
% - option clicking on the title bar of a window brings a list of .mf and
% .log file at the same level or in a selected folder and allows to edit
% them
% 
% Please see the Metafont Help file for more information.  
% Please check for the latest version of Metafont Mode at :
% 
% <http://perso.easynet.fr/~berdesg/metafont.html>
% 
% The example below is borrowed from the OzTeX distribution.
% 
% Author:  ??

% circle.mf


fontdimen 1: 0,0,0,0,0,0,0,thickness#;
font_coding_scheme:="LaTeX circle";

let cmchar=\; % cmchar should precede each character, for testing purposes

thickness:=ceiling(thickness#*hppp); % the way rules thicknesses are done
% thickness#:=thickness/hppp; % and let thickness# round to right value
% NO, I deleted this BAD line! --- DEK, 9 Jul 87
pickup pencircle scaled thickness; nib:=savepen;

% arcs sets up the points 1, 2, ..., 8 as follows:
%
%            |1
%            |*
%            * *
%           8|  2
%          * |   *
%        7*  |    *3
%        --*-----*--
%           6|  4
%            * *
%            |5
%
%        <----w---->

pair upleft,upright,downleft,downright;
upright=-downleft=(1,1); downright=-upleft=(1,-1);

% a quarter-circle has width, height and depth set as explained on
% page 389 of the TeXbook, not the real width, height, and depth

def qbeginchar (expr c, diam_sharp) =
numeric hh, dd; hh:=.5*(diam_sharp+thickness#);
dd:=.5*(diam_sharp-thickness#);
beginchar(c,diam_sharp,hh,dd);
enddef;

def arcs =
numeric delta;
delta:=.5 round((1-sqrt.5)*w); % distance from axis to arc's 45 degree points
bot y3=0; y7=y3=.5[y5,y1]; y1-y5=w;
lft x1=0; x5=x1=.5[x7,x3]; x3-x7=w;
x2-x1=delta; x1-x8=delta; x8=x6; x2=x4;
y8-y7=delta; y7-y6=delta; y8=y2; y6=y4;
enddef;

cmchar "2pt, top right";
qbeginchar(0,4pt#);
numeric delta;
pickup nib;
arcs;
draw z7{right}..z6{downright}..z5{down};
endchar;

cmchar "2pt, bottom right";
qbeginchar(1,4pt#);
numeric delta;
pickup nib;
arcs;
draw z1{down}..z8{downleft}..z7{left};
endchar;

cmchar "2pt, bottom left";
qbeginchar(2,4pt#);
numeric delta;
pickup nib;
arcs;
draw z3{left}..z2{upleft}..z1{up};
endchar;

cmchar "2pt, top left";
qbeginchar(3,4pt#);
numeric delta;
pickup nib;
arcs;
draw z5{up}..z4{upright}..z3{right};
endchar;

cmchar "4pt, top right";
qbeginchar(4,8pt#);
numeric delta;
pickup nib;
arcs;
draw z7{right}..z6{downright}..z5{down};
endchar;

cmchar "4pt, bottom right";
qbeginchar(5,8pt#);
numeric delta;
pickup nib;
arcs;
draw z1{down}..z8{downleft}..z7{left};
endchar;

cmchar "4pt, bottom left";
qbeginchar(6,8pt#);
numeric delta;
pickup nib;
arcs;
draw z3{left}..z2{upleft}..z1{up};
endchar;

cmchar "4pt, top left";
qbeginchar(7,8pt#);
numeric delta;
pickup nib;
arcs;
draw z5{up}..z4{upright}..z3{right};
endchar;

cmchar "6pt, top right";
qbeginchar(8,12pt#);
numeric delta;
pickup nib;
arcs;
draw z7{right}..z6{downright}..z5{down};
endchar;

cmchar "6pt, bottom right";
qbeginchar(9,12pt#);
numeric delta;
pickup nib;
arcs;
draw z1{down}..z8{downleft}..z7{left};
endchar;

cmchar "6pt, bottom left";
qbeginchar(10,12pt#);
numeric delta;
pickup nib;
arcs;
draw z3{left}..z2{upleft}..z1{up};
endchar;

cmchar "6pt, top left";
qbeginchar(11,12pt#);
numeric delta;
pickup nib;
arcs;
draw z5{up}..z4{upright}..z3{right};
endchar;

cmchar "8pt, top right";
qbeginchar(12,16pt#);
numeric delta;
pickup nib;
arcs;
draw z7{right}..z6{downright}..z5{down};
endchar;

cmchar "8pt, bottom right";
qbeginchar(13,16pt#);
numeric delta;
pickup nib;
arcs;
draw z1{down}..z8{downleft}..z7{left};
endchar;

cmchar "8pt, bottom left";
qbeginchar(14,16pt#);
numeric delta;
pickup nib;
arcs;
draw z3{left}..z2{upleft}..z1{up};
endchar;

cmchar "8pt, top left";
qbeginchar(15,16pt#);
numeric delta;
pickup nib;
arcs;
draw z5{up}..z4{upright}..z3{right};
endchar;

cmchar "10pt, top right";
qbeginchar(16,20pt#);
numeric delta;
pickup nib;
arcs;
draw z7{right}..z6{downright}..z5{down};
endchar;

cmchar "10pt, bottom right";
qbeginchar(17,20pt#);
numeric delta;
pickup nib;
arcs;
draw z1{down}..z8{downleft}..z7{left};
endchar;

cmchar "10pt, bottom left";
qbeginchar(18,20pt#);
numeric delta;
pickup nib;
arcs;
draw z3{left}..z2{upleft}..z1{up};
endchar;

cmchar "10pt, top left";
qbeginchar(19,20pt#);
numeric delta;
pickup nib;
arcs;
draw z5{up}..z4{upright}..z3{right};
endchar;

cmchar "12pt, top right";
qbeginchar(20,24pt#);
numeric delta;
pickup nib;
arcs;
draw z7{right}..z6{downright}..z5{down};
endchar;

cmchar "12pt, bottom right";
qbeginchar(21,24pt#);
numeric delta;
pickup nib;
arcs;
draw z1{down}..z8{downleft}..z7{left};
endchar;

cmchar "12pt, bottom left";
qbeginchar(22,24pt#);
numeric delta;
pickup nib;
arcs;
draw z3{left}..z2{upleft}..z1{up};
endchar;

cmchar "12pt, top left";
qbeginchar(23,24pt#);
numeric delta;
pickup nib;
arcs;
draw z5{up}..z4{upright}..z3{right};
endchar;

cmchar "14pt, top right";
qbeginchar(24,28pt#);
numeric delta;
pickup nib;
arcs;
draw z7{right}..z6{downright}..z5{down};
endchar;

cmchar "14pt, bottom right";
qbeginchar(25,28pt#);
numeric delta;
pickup nib;
arcs;
draw z1{down}..z8{downleft}..z7{left};
endchar;

cmchar "14pt, bottom left";
qbeginchar(26,28pt#);
numeric delta;
pickup nib;
arcs;
draw z3{left}..z2{upleft}..z1{up};
endchar;

cmchar "14pt, top left";
qbeginchar(27,28pt#);
numeric delta;
pickup nib;
arcs;
draw z5{up}..z4{upright}..z3{right};
endchar;

cmchar "16pt, top right";
qbeginchar(28,32pt#);
numeric delta;
pickup nib;
arcs;
draw z7{right}..z6{downright}..z5{down};
endchar;

cmchar "16pt, bottom right";
qbeginchar(29,32pt#);
numeric delta;
pickup nib;
arcs;
draw z1{down}..z8{downleft}..z7{left};
endchar;

cmchar "16pt, bottom left";
qbeginchar(30,32pt#);
numeric delta;
pickup nib;
arcs;
draw z3{left}..z2{upleft}..z1{up};
endchar;

cmchar "16pt, top left";
qbeginchar(31,32pt#);
numeric delta;
pickup nib;
arcs;
draw z5{up}..z4{upright}..z3{right};
endchar;

cmchar "18pt, top right";
qbeginchar(32,36pt#);
numeric delta;
pickup nib;
arcs;
draw z7{right}..z6{downright}..z5{down};
endchar;

cmchar "18pt, bottom right";
qbeginchar(33,36pt#);
numeric delta;
pickup nib;
arcs;
draw z1{down}..z8{downleft}..z7{left};
endchar;

cmchar "18pt, bottom left";
qbeginchar(34,36pt#);
numeric delta;
pickup nib;
arcs;
draw z3{left}..z2{upleft}..z1{up};
endchar;

cmchar "18pt, top left";
qbeginchar(35,36pt#);
numeric delta;
pickup nib;
arcs;
draw z5{up}..z4{upright}..z3{right};
endchar;

cmchar "20pt, top right";
qbeginchar(36,40pt#);
numeric delta;
pickup nib;
arcs;
draw z7{right}..z6{downright}..z5{down};
endchar;

cmchar "20pt, bottom right";
qbeginchar(37,40pt#);
numeric delta;
pickup nib;
arcs;
draw z1{down}..z8{downleft}..z7{left};
endchar;

cmchar "20pt, bottom left";
qbeginchar(38,40pt#);
numeric delta;
pickup nib;
arcs;
draw z3{left}..z2{upleft}..z1{up};
endchar;

cmchar "20pt, top left";
qbeginchar(39,40pt#);
numeric delta;
pickup nib;
arcs;
draw z5{up}..z4{upright}..z3{right};
endchar;

% The full circles have height and depth 0pt because otherwise there
% are too many heights and depths for the TFM files

cmchar "1pt, circle";
beginchar(96,1pt#,0pt#,0pt#);
pickup nib;
draw fullcircle scaled w;
endchar;

cmchar "2pt, circle";
beginchar(97,2pt#,0pt#,0pt#);
pickup nib;
draw fullcircle scaled w;
endchar;

cmchar "3pt, circle";
beginchar(98,3pt#,0pt#,0pt#);
pickup nib;
draw fullcircle scaled w;
endchar;

cmchar "4pt, circle";
beginchar(99,4pt#,0pt#,0pt#);
pickup nib;
draw fullcircle scaled w;
endchar;

cmchar "5pt, circle";
beginchar(100,5pt#,0pt#,0pt#);
pickup nib;
draw fullcircle scaled w;
endchar;

cmchar "6pt, circle";
beginchar(101,6pt#,0pt#,0pt#);
pickup nib;
draw fullcircle scaled w;
endchar;

cmchar "7pt, circle";
beginchar(102,7pt#,0pt#,0pt#);
pickup nib;
draw fullcircle scaled w;
endchar;

cmchar "8pt, circle";
beginchar(103,8pt#,0pt#,0pt#);
pickup nib;
draw fullcircle scaled w;
endchar;

cmchar "9pt, circle";
beginchar(104,9pt#,0pt#,0pt#);
pickup nib;
draw fullcircle scaled w;
endchar;

cmchar "10pt, circle";
beginchar(105,10pt#,0pt#,0pt#);
pickup nib;
draw fullcircle scaled w;
endchar;

cmchar "11pt, circle";
beginchar(106,11pt#,0pt#,0pt#);
pickup nib;
draw fullcircle scaled w;
endchar;

cmchar "12pt, circle";
beginchar(107,12pt#,0pt#,0pt#);
pickup nib;
draw fullcircle scaled w;
endchar;

cmchar "13pt, circle";
beginchar(108,13pt#,0pt#,0pt#);
pickup nib;
draw fullcircle scaled w;
endchar;

cmchar "14pt, circle";
beginchar(109,14pt#,0pt#,0pt#);
pickup nib;
draw fullcircle scaled w;
endchar;

cmchar "15pt, circle";
beginchar(110,15pt#,0pt#,0pt#);
pickup nib;
draw fullcircle scaled w;
endchar;

cmchar "1pt, blob";
beginchar(112,1pt#,0pt#,0pt#);
pickup pencircle scaled w;
drawdot origin;
endchar;

cmchar "2pt, blob";
beginchar(113,2pt#,0pt#,0pt#);
pickup pencircle scaled w;
drawdot origin;
endchar;

cmchar "3pt, blob";
beginchar(114,3pt#,0pt#,0pt#);
pickup pencircle scaled w;
drawdot origin;
endchar;

cmchar "4pt, blob";
beginchar(115,4pt#,0pt#,0pt#);
pickup pencircle scaled w;
drawdot origin;
endchar;

cmchar "5pt, blob";
beginchar(116,5pt#,0pt#,0pt#);
pickup pencircle scaled w;
drawdot origin;
endchar;

cmchar "6pt, blob";
beginchar(117,6pt#,0pt#,0pt#);
pickup pencircle scaled w;
drawdot origin;
endchar;

cmchar "7pt, blob";
beginchar(118,7pt#,0pt#,0pt#);
pickup pencircle scaled w;
drawdot origin;
endchar;

cmchar "8pt, blob";
beginchar(119,8pt#,0pt#,0pt#);
pickup pencircle scaled w;
drawdot origin;
endchar;

cmchar "9pt, blob";
beginchar(120,9pt#,0pt#,0pt#);
pickup pencircle scaled w;
drawdot origin;
endchar;

cmchar "10pt, blob";
beginchar(121,10pt#,0pt#,0pt#);
pickup pencircle scaled w;
drawdot origin;
endchar;

cmchar "11pt, blob";
beginchar(122,11pt#,0pt#,0pt#);
pickup pencircle scaled w;
drawdot origin;
endchar;

cmchar "12pt, blob";
beginchar(123,12pt#,0pt#,0pt#);
pickup pencircle scaled w;
drawdot origin;
endchar;

cmchar "13pt, blob";
beginchar(124,13pt#,0pt#,0pt#);
pickup pencircle scaled w;
drawdot origin;
endchar;

cmchar "14pt, blob";
beginchar(125,14pt#,0pt#,0pt#);
pickup pencircle scaled w;
drawdot origin;
endchar;

cmchar "15pt, blob";
beginchar(126,15pt#,0pt#,0pt#);
pickup pencircle scaled w;
drawdot origin;
endchar;

bye

