% $Header: ttextit.mf,v 1.1 88/01/15 13:15:30 simpson Rel $
% $Log:	ttextit.mf,v $
% Revision 1.1  88/01/15  13:15:30  simpson
% initial release
% 
% Revision 0.2  88/01/14  10:12:30  simpson
% fixed Rule and Underscore
% 
% Revision 0.1  88/01/07  08:15:20  simpson
% beta test
% 
% The Computer Modern Text Italic family (by D. E. Knuth, 1979--1985)

mode_setup; font_setup;

input itall;  % lower case (minuscules)
if ligs>1: font_coding_scheme:="Troff text";
 input titalig;  % letter ligatures
else: font_coding_scheme:=if ligs=0: "TeX typewriter text"
  else: "TeX text without f-ligatures" fi;
 spanish_shriek=oct"016"; spanish_query=oct"017"; fi
minus=oct"004"; vertical=oct"174";

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#;
 letter_fit#:=letter_fit:=0;
else: font_normal_space 6u#+2letter_fit#;
 font_normal_stretch 3u#; font_normal_shrink 2u#;
 font_quad 18u#+4letter_fit#;
 font_extra_space 2u#; fi

% We need to create space characters with no bitmap for \| and \^.  I put
% them in oct"000" and oct"177" since these characters are not normally
% used by ditroff.
% My own creation (...creation being a generous term), for \|, 1/6 em
beginchar(oct"000", 16/6u#, 0, 0);
endchar;

% My own creation, for \^, 1/12 em
beginchar(oct"177", 16/12u#, 0, 0);
endchar;

% From the font lasy10.mf, file lasy.mf
cmchar "Box";
beginchar(oct"024",2.1math_axis#+4u#,v_center(7u#));
italcorr math_axis#*slant;
adjust_fit(0,0); pickup rule.nib;
numeric a; a=round(2.1math_axis);
x1=x4=good.x 2u; x2=x3=x1+a;
y3=y4=.5(cap_height-a); y1=y2=y3+a;
draw z1--z2--z3--z4--cycle;
labels(1,2,3,4); endchar;

% Stolen from font cmsy10, file symbol.mf
cmchar "Open bullet";
beginchar(oct"025",9u#,v_center(7u#));
adjust_fit(0,0); pickup rule.nib; autorounded;
lft x6=hround u; x2=w-x6; top y8=h; y2=math_axis;
circle_points; draw_circle;  % circle
labels(1,2,3,4,5,6,7,8); endchar;

% Stolen from the font cmr10, file accent.mf
cmchar "Umlaut (double dot) accent";
numeric dot_diam#,dot_diam;
dot_diam#=max(dot_size#,cap_curve#);
beginchar(oct"026",9u#,min(asc_height#,10/7x_height#+.5dot_diam#),0);
dot_diam=max(tiny.breadth,hround(max(dot_size,cap_curve)-2stem_corr));
italcorr h#*slant+.5dot_diam#-2.25u#;
adjust_fit(0,0);
pickup tiny.nib; pos1(dot_diam,0); pos2(dot_diam,90);
x1=x2=2.75u; top y2r=h+1;
if bot y2l<x_height+o+slab: y2l:=min(y2r-eps,x_height+o+slab+.5tiny); fi
y1=.5[y2l,y2r]; dot(1,2);  % left dot
pos3(dot_diam,0); penpos4(y2r-y2l,90); y3=y4=y1; x3=x4=w-x1;
dot(3,4);  % right dot
penlabels(1,2,3,4); endchar;

% Stolen from the font cmr10.mf, file accent.mf
cmchar "Cedilla accent";
beginchar(oct"027",8u#,0,.875desc_depth#);
adjust_fit(0,0);
x1=.5w+.5u;
if serifs: pickup crisp.nib; pos1(stem,0); pos2(stem,0);
 pos3(vair,90); pos4(stem,0); pos5(vair,-90);
 x1=x2; z3l=z2l; x4=x2+1.5u; x5=x3-1.5u;
 bot y1=-o; bot y2=-vround 2/7d-o; y4=.5[y3,y5]; bot y5=-d-o;
 filldraw stroke z1e--z2e;  % stem
 filldraw stroke z3e{right}...z4e{down}...{left}z5e;  % hook
else: pickup fine.nib; pos1(vair,0); top y1=-o-2;
 pos2(.5[vair,stem],0); bot y2=-d-o; x2=x1-1.25u;
 filldraw stroke z1e--z2e; fi  % diagonal
penlabels(1,2,3,4,5); endchar;

% My own creation, a zero width period.  Used for dots in pic(1).
cmchar "Dot for pic boxes";
numeric dot_diam#; dot_diam#=if monospace: 5/4 fi\\ dot_size#;
define_whole_blacker_pixels(dot_diam);
beginchar(oct"030",0,dot_diam#,0);
period_width#:=5u#; define_pixels(period_width);
pickup fine.nib;
pos1(dot_diam,0); pos2(dot_diam,90);
lft x1l=hround(.5period_width-.5dot_diam); bot y2l=0; z1=z2; dot(1,2);  % dot
penlabels(1,2); endchar;

% My own creation.  The fractions look like hell.
cmchar "1/4 symbol";
beginchar(oct"021", 12u#, body_height#, paren_depth#);
italcorr body_height#*slant-.5u#;
adjust_fit(0,0); pickup rule.nib;
rt x1=hround(w-u)+eps; top y1=h+eps;
lft x2=hround u-eps; bot y2=-d-eps;
draw z1--z2;  % diagonal
x3=x4=1/4w; y3=38/40h; y4=23/40h; 
draw z3--z4;  % number 1
x5=x6=32/40w; y7=y8=1/8h; y5=-.2d; y6=.37h; x7=26/40w; x8=.85w;
draw z5--z6--z7--z8;
endchar;

% My own creation
cmchar "1/2 symbol";
beginchar(oct"022", 12u#, body_height#, paren_depth#);
italcorr body_height#*slant-.5u#;
adjust_fit(0,0); pickup rule.nib;
rt x1=hround(w-u)+eps; top y1=h+eps;
lft x2=hround u-eps; bot y2=-d-eps;
draw z1--z2;  % diagonal
x3=x4=1/4w; y3=38/40h; y4=23/40h; 
draw z3--z4;  % number 1
x5=x9=.65w; x10=x7=.85w; x6=.74w;
y9=y10=-.2d; y6=.37h; y5=.32h; y7=.30h;
draw z5{dir 45}..z6..z7{dir -90}..{dir 225}z9; % number 2
draw z9--z10;
endchar;

% My own creation.
cmchar "3/4 symbol";
beginchar(oct"023", 12u#, body_height#, paren_depth#);
italcorr body_height#*slant-.5u#;
adjust_fit(0,0); pickup rule.nib;
rt x1=hround(w-u)+eps; top y1=h+eps;
lft x2=hround u-eps; bot y2=-d-eps;
draw z1--z2;  % diagonal
draw (quartercircle rotated -90 & halfcircle) scaled .1875h shifted 
(.25w,.8562h); % number 3
draw (halfcircle rotated -180 & quartercircle) scaled .1875h shifted 
(.25w,.6687h);
x5=x6=32/40w; y7=y8=1/8h; y5=-.2d; y6=.37h; x7=26/40w; x8=.85w;
draw z5--z6--z7--z8;
endchar;

% From the font cmsy10, file sym.mf
iff known vertical: cmchar "Vertical line";
beginchar(vertical,5u#,body_height#,paren_depth#);
italcorr body_height#*slant+.5rule_thickness#-2u#;
adjust_fit(0,0); pickup rule.nib;
x1=x2=good.x .5w; top y1=h+eps; bot y2=-d-eps;
draw z1--z2;  % stem
labels(1,2); endchar;

% My own creation
cmchar "Rule";
beginchar(oct"005",12u#,x_height#,.7u#);
italcorr .5x_height#*slant-.5u#;
adjust_fit(0,0);
numeric below_baseline; below_baseline#:=.2u#;
define_pixels(below_baseline);
define_blacker_pixels(thickness);
pickup crisp.nib; pos1(vair,90); pos2(vair,90);
top y1r=top y2r=vround(-below_baseline); rt x2=hround(w+6u#);
lft x1=hround(0);
filldraw stroke z1e--z2e;  % bar
penlabels(1,2); endchar;

% My own creation
cmchar "Underscore";
beginchar("_",12u#,x_height#,.7u#);
italcorr .5x_height#*slant-.5u#;
adjust_fit(0,0);
numeric below_baseline; below_baseline#:=.2u#;
define_pixels(below_baseline);
pickup crisp.nib; pos1(vair,90); pos2(vair,90);
top y1r=top y2r=vround(-below_baseline); x2=hround(w);
x1=hround 0;
filldraw stroke z1e--z2e;  % bar
penlabels(1,2); endchar;

% Hyphen from cmr10, file comlig.mf
cmchar "Hyphen";
beginchar("-",6u#,x_height#,0);
italcorr .5x_height#*slant-.5u#;
adjust_fit(0,0);
numeric thickness; thickness=if hefty:bar else:.75[hair,stem] fi;
pickup crisp.nib; pos1(thickness,90); pos2(thickness,90);
top y1r=top y2r=vround(.5h+.5thickness); rt x2=hround(w-u)+eps;
if monospace: x2=w-x1 else: lft x1=hround .2u-eps fi;
filldraw stroke z1e--z2e;  % bar
penlabels(1,2); endchar;

% My own creation
cmchar "Cent sign";
beginchar(oct"020",18u#,asc_height#,desc_depth#); autorounded;
adjust_fit(if monospace:-3u#,-3u# else: 0,0 fi); pickup rule.nib;
lft x6=hround u; x2=w-x6; top y8=h+o; bot y4=-d-o;
circle_points; 
x9=x11=.65[x6,x4]; x10=x12=.35[x4,x2]; 
y9=y10=.35[y6,y8]; y11=y12=.65[y4,y6];
x13=x14=.5[x6,x2]-.3u; y13=y4+2u; y14=y8-2u;
draw z10..z9..z11..z12; draw z13--z14;
labels(1,2,3,4,5,6,7,8,9,10,11,12,13,14); endchar;

% My own creation
cmchar "Copyright";
beginchar(oct"016",18u#,asc_height#,desc_depth#); autorounded;
adjust_fit(if monospace:-3u#,-3u# else: 0,0 fi); pickup rule.nib;
lft x6=hround u; x2=w-x6; top y8=h+o; bot y4=-d-o;
circle_points; draw_circle;  % circle
x9=x11=.65[x6,x4]; x10=x12=.35[x4,x2]; 
y9=y10=.35[y6,y8]; y11=y12=.65[y4,y6];
draw z10..z9..z11..z12;
labels(1,2,3,4,5,6,7,8,9,10,11,12); endchar;

% My own creation
cmchar "Registered";
beginchar(oct"017",18u#,asc_height#,desc_depth#); autorounded;
adjust_fit(if monospace:-3u#,-3u# else: 0,0 fi); pickup rule.nib;
lft x6=hround u; x2=w-x6; top y8=h+o; bot y4=-d-o;
circle_points; draw_circle;  % circle
x9=x11=x12=.7[x6,x8]; x10=x13=.3[x4,x2]; 
y12=y13=.5[y4,y6]; y9=.5[y6,y8]; y11=.5[y12,y9]; y10=.5[y11,y9];
x14=.08[x4,x2]; y14=y9; 
path p;
p=z9--z14{dir 0}..z10..{dir 180}z11;
z15=point 2.6 of p;
draw z12--z9; draw z13--z15; draw p;
labels(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15); endchar;

% Stolen from the font cmr10, file accent.mf (actually the acute accent)
cmchar "Footmark";
beginchar(oct"015",9u#,min(asc_height#,2x_height#),0);
italcorr h#*slant-if serifs: 1.5 fi u#;
adjust_fit(0,0);
if serifs: pickup crisp.nib; x1+.5stem=hround(w-2u); x2=2/3[x1,w-x1];
 y1+.5stem=h+eps; y2=max(2/3[h,x_height],x_height+o+hair);
 numeric theta; theta=angle(z2-z1)+90;
 pos1(stem,theta); pos2(hair,theta);
 filldraw circ_stroke z1e--z2e;  % diagonal
else: pickup fine.nib; pos1(stem,0); pos2(vair,0);
 rt x1r=hround(w-1.5u); lft x2l=hround(.5w-.25u-.5vair);
 top y1=h; bot y2=vround 2/3[h,x_height];
 filldraw stroke z1e--z2e; fi  % diagonal
penlabels(1,2); endchar;

% Stolen from the font cmsy10, file symbol.mf
cmchar "Dagger mark";
beginchar(oct"014",8u#,asc_height#,desc_depth#);
adjust_fit(0,0); pickup fine.nib;
pos1(stem,0); pos2(thin_join,0); pos3(stem,0); pos4(hair,0);
pos5(stem,90); pos2'(thin_join,90); pos6(stem,90); z2'=z2;
x1=x2=x3=x4; x1-.5stem=hround(.5w-.5stem); w:=r:=2x1;
x5-.5stem=hround u; x6=w-x5;
y1+.5stem=h+oo; y2=y5=y6; y3=.57y2; bot y4=-d-o;
y5+.5stem=floor(x_height+.5stem);
filldraw circ_stroke z1e{down}..z2e{down}..z3e{down}..z4e;  % stem
filldraw circ_stroke z5e{right}..{right}z2'e;  % left bulb
filldraw circ_stroke z6e{left}..{left}z2'e;  % right bulb
penlabels(1,2,3,4,5,6); endchar;

% Stolen from the font cmr10, file accent.mf (the Scandinavian circle accent)
cmchar "Degree";
beginchar(oct"013",13u#+4/3(asc_height#-x_height#)*slant,asc_height#,0);
adjust_fit(cap_serif_fit#,cap_serif_fit#);
numeric circ_hair,circ_vair;
circ_hair=hround min(hair,u+.5); circ_vair=vround min(vair,(h-x_height)/6+.5);
penpos1(circ_vair,90); penpos3(circ_vair,-90);
penpos2(circ_hair,180); penpos4(circ_hair,0);
x2r=hround(.5w-1.5u-.5circ_hair);
x4r=w-x2r; x1=x3=.5w; y1r=h+apex_o; y2=y4=.5[y1,y3];
y3r=vround(1/3[x_height,h]+apex_o);
penstroke pulled_arc.e(1,2) & pulled_arc.e(2,3)
 & pulled_arc.e(3,4) & pulled_arc.e(4,1) & cycle;  % bowl
penlabels(1,2,3,4); endchar;

% My own creation
cmchar "Square";
beginchar(oct"010",9u#,v_center(7u#));
italcorr math_axis#*slant;
adjust_fit(0,0); pickup rule.nib;
draw unitsquare scaled 7u shifted (.5w-7u/2,math_axis-7u/2);
endchar;

% Stolen from the font cmsy10, file symbol.mf
cmchar "Bullet";
beginchar(oct"007",9u#,v_center(7u#));
adjust_fit(0,0); pickup rule.nib; autorounded;
lft x6=hround u; x2=w-x6; top y8=h; y2=math_axis; circle_points;
filldraw z8{right}...z1{z2-z8}...z2{down}...z3{z4-z2}...z4{left}
  ...z5{z6-z4}...z6{up}...z7{z8-z6}...cycle;  % circle and interior
labels(1,2,3,4,5,6,7,8); endchar;

% Stolen from the font cmsy10, file sym.mf
iff known minus: cmchar "Minus sign";
beginarithchar(minus); pickup rule.nib;
lft x1=hround 1.5u-eps; x2=w-x1; y1=y2=math_axis;
draw z1--z2;  % bar
labels(1,2); endchar;

input romanu;  % upper case (majuscules)
input itald;  % numerals
input titalp;  % ampersand, question marks, currency sign
input tpunct;  % punctuation symbols common to roman and italic text
if ligs>0: input tcomlig; fi  % ligatures common with roman text
if ligs<=1: input romsub; fi  % substitutes for ligatures

if not monospace:
 k#:=-.5u#; kk#:=-1.5u#; kkk#:=-2u#; % three degrees of kerning
 ligtable "d": "w": "l": "l" kern +u#;
 ligtable "F": "V": "o" kern kk#, "e" kern kk#,
   "u" kern kk#, "r" kern kk#, "a" kern kk#, "A" kern kkk#,
  "K": "X": "O" kern k#, "C" kern k#, "G" kern k#, "Q" kern k#;
 ligtable "T": "y" kern kk#,
  "Y": "e" kern kk#, "o" kern kk#, "r" kern kk#, "a" kern kk#, "u" kern kk#,
  "P": "W": "A" kern kk#;
 ligtable "O": "D": "X" kern k#, "W" kern k#, "A" kern k#,
   "V" kern k#, "Y" kern k#;
 ligtable "A": "R": "n" kern k#, "l" kern k#, "r" kern k#, "u" kern k#,
   "m" kern k#, "t" kern k#, "i" kern k#, "C" kern k#, "O" kern k#, "G" kern k#,
   "h" kern k#, "b" kern k#, "U" kern k#, "k" kern k#, "v" kern k#, "w" kern k#,
   "Q" kern k#, "L": "T" kern kk#, "Y" kern kk#, "V" kern kkk#, "W" kern kkk#,
  "b": "c": "e": "o": "p": "r": "e" kern -u#, "a" kern -u#, "o" kern -u#,
   "d" kern -u#, "c" kern -u#, "g" kern -u#, "q" kern -u#;
 fi
% there are ligature/kern programs for |"f"| in the {\tt romlig} file
% and for |"-"|, |"`"|, and |"'"| in the {\tt comlig} file
bye.