
% The Computer Modern Math-Extension family (by D. E. Knuth, 1979--1985)
% Modification of original mathex.mf
% by Claudio Beccari (1999)

font_coding_scheme:="TeX math extension";
mode_setup; font_setup;

%correction to  heavy_rule_thickness, otherwise the curly braces turn out too thick
%heavy_rule_thickness:=ceiling(3rule_thickness#*hppp); %cmbase definition
heavy_rule_thickness:=rule_thickness+dw;
heavy_rule_thickness#:=heavy_rule_thickness/hppp;


% Input modified files for large delimiters, operators and accents

input lbigdel;  % large delimiters
input lbigop;   % large operators
input lbigacc;  % large accents


% Corrections for characters 74 to 79 that otherwise would turn out oval

cmchar "\textstyle circle-dot operator";
beginchar(oct"112",20u#,0,18u#);
adjust_fit(0,0); pickup pencircle scaled stem;
lft x6=hround u; x2=w-x6; top y8=0; bot y4=-d;
circle_points; draw_circle;  % circle
%fill fullcircle scaled(bold+4dw+eps) shifted(.5[z4,z8]);  % dot
fill fullcircle scaled(2stem) shifted(.5[z4,z8]);  % dot
labels(1,2,3,4,5,6,7,8); endchar;

cmchar "\displaystyle circle-dot operator";
beginchar(oct"113",27.2u#,0,25.2u#); padded 1/6dh#;
adjust_fit(0,0); pickup pencircle scaled curve;
lft x6=hround u; x2=w-x6; top y8=0; bot y4=-d;
circle_points; draw_circle;  % circle
%fill fullcircle scaled(bold+6dw+eps) shifted(.5[z4,z8]);  % dot
fill fullcircle scaled(2curve) shifted(.5[z4,z8]);  % dot
labels(1,2,3,4,5,6,7,8); endchar;

cmchar "\textstyle circle-plus operator";
beginchar(oct"114",20u#,0,18u#);
adjust_fit(0,0); pickup pencircle scaled stem;
lft x6=hround u; x2=w-x6; top y8=0; bot y4=-d;
circle_points; draw_circle;  % circle
draw z2--z6; draw z4--z8;  % plus
labels(1,2,3,4,5,6,7,8); endchar;

cmchar "\displaystyle circle-plus operator";
beginchar(oct"115",27.2u#,0,25.2u#); padded 1/6dh#;
adjust_fit(0,0); pickup pencircle scaled curve;
lft x6=hround u; x2=w-x6; top y8=0; bot y4=-d;
circle_points; draw_circle;  % circle
draw z2--z6; draw z4--z8;  % plus
labels(1,2,3,4,5,6,7,8); endchar;

cmchar "\textstyle circle-times operator";
beginchar(oct"116",20u#,0,18u#);
adjust_fit(0,0); pickup pencircle scaled stem;
lft x6=hround u; x2=w-x6; top y8=0; bot y4=-d;
circle_points; draw_circle;  % circle
draw z1--z5; draw z3--z7;  % times
labels(1,2,3,4,5,6,7,8); endchar;

cmchar "\displaystyle circle-times operator";
beginchar(oct"117",27.2u#,0,25.2u#); padded 1/6dh#;
adjust_fit(0,0); pickup pencircle scaled curve;
lft x6=hround u; x2=w-x6; top y8=0; bot y4=-d;
circle_points; draw_circle;  % circle
draw z1--z5; draw z3--z7;  % times
labels(1,2,3,4,5,6,7,8); endchar;

% Corrections for \prod sign that without serifs turned out
% as an inverted open box

cmchar "\textstyle product sign";
beginchar(oct"121",17u#,0,10/6dh#);
adjust_fit(0,0); pickup crisp.nib;
numeric heavy_stem,light_stem;
heavy_stem=hround(bold+dw); light_stem=rule_thickness;
pos1(heavy_stem,0);pos2(heavy_stem,0); pos1'(heavy_stem,0);pos2'(heavy_stem,0);
pos11(light_stem,90); pos12(light_stem,90); pos22(light_stem,90);
lft x11=hround u; x1l-x11=x2l-x12=x22-x2r=hround 2u;
x1=x1'=x2=x2';
top y1=0; bot y2=-d; y11r=y1; y12l=y22l=y2;
y11l-y1'=y2'-y12r=1.2bracket;
filldraw z1r--z11r--serif_arc(11l,1'l)--reverse serif_arc(12r,2'l)
 --z12l--z22l--serif_arc(22r,2'r)--cycle;  % left stem and serifs
pos3(heavy_stem,0);pos4(heavy_stem,0); pos3'(heavy_stem,0);pos4'(heavy_stem,0);
pos13(light_stem,90); pos14(light_stem,90); pos24(light_stem,90);
x3=x3'=x4=x4'=w-x1; x13=x14=w-x11; x24=w-x22;
y3=y13r=y1; y3'=y1'; y4'=y2'; y4=y14l=y24l=y2;
filldraw z3l--z13r--serif_arc(13l,3'r)--reverse serif_arc(14r,4'r)
 --z14l--z24l--serif_arc(24r,4'l)--cycle;  % right stem and serifs
filldraw stroke z11e--z13e; % bar
penlabels(1,1',2,2',3,3',4,4',11,12,13,14,22,24); endchar;

cmchar "\displaystyle product sign";
beginchar(oct"131",23u#,0,16/6dh#); padded 1/6dh#;
adjust_fit(0,0); pickup crisp.nib;
numeric heavy_stem,light_stem;
heavy_stem=hround(bold+5dw); light_stem=Vround(rule_thickness+dw);
pos1(heavy_stem,0);pos2(heavy_stem,0); pos1'(heavy_stem,0);pos2'(heavy_stem,0);
pos11(light_stem,90); pos12(light_stem,90); pos22(light_stem,90);
lft x11=hround u; x1l-x11=x2l-x12=x22-x2r=hround 2.5u;
x1=x1'=x2=x2';
top y1=0; bot y2=-d; y11r=y1; y12l=y22l=y2;
y11l-y1'=y2'-y12r=1.8bracket;
filldraw z1r--z11r--serif_arc(11l,1'l)--reverse serif_arc(12r,2'l)
 --z12l--z22l--serif_arc(22r,2'r)--cycle;  % left stem and serifs
pos3(heavy_stem,0);pos4(heavy_stem,0); pos3'(heavy_stem,0);pos4'(heavy_stem,0);
pos13(light_stem,90); pos14(light_stem,90); pos24(light_stem,90);
x3=x3'=x4=x4'=w-x1; x13=x14=w-x11; x24=w-x22;
y3=y13r=y1; y3'=y1'; y4'=y2'; y4=y14l=y24l=y2;
filldraw z3l--z13r--serif_arc(13l,3'r)--reverse serif_arc(14r,4'r)
 --z14l--z24l--serif_arc(24r,4'l)--cycle;  % right stem and serifs
filldraw stroke z11e--z13e; % bar
penlabels(1,1',2,2',3,3',4,4',11,12,13,14,22,24); endchar;

% About the same correction for the summation signs

cmchar "\textstyle summation sign";
beginchar(oct"120",17u#,0,10/6dh#);
adjust_fit(0,0); pickup tiny.nib;
numeric top_arm_thickness, bot_arm_thickness;
top_arm_thickness=Vround rule_thickness;
bot_arm_thickness=Vround .9(.5[rule_thickness,curve]);
lft x1l=hround u; x1l=x2l=x4l; x3l-x1l=4/11(w-2u);
top y1=0; bot y2=-top_arm_thickness-eps; bot y4=-d; y3=-.5d;
numeric alpha[]; alpha1=((x3l-x1l)++(y2-y3))/(y2-y3);
penpos1(alpha1*(curve-tiny),0); penpos2(alpha1*(curve-tiny),0);
penpos3(alpha1*(curve-tiny),0);
alpha2=diag_ratio(1,rule_thickness-tiny,y3-y4,x3r-x4l);
penpos4(alpha2*(rule_thickness-tiny),0);
z0=whatever[z2l,z3l]=z4l+whatever*(z3r-z4r);
filldraw z1l--z2l--z0--z4l--z4r--z3r--z2r--z1r--cycle;  % diagonals
pickup crisp.nib; pos5(top_arm_thickness,90); pos6(hair,0);
top y5r=0; x5=x1; rt x6r=hround(w-u); y6=good.y(y5l-2.5u)-eps;
arm(5,6,a,.45,17/11u);  % upper arm and beak
pos7(bot_arm_thickness,-90); pos8(hair,0);
bot y7r=-d; z7l=whatever[z4,z3]; x7r:=x4; x8=x6; y8=good.y(y7l+2.5u)+eps;
arm(7,8,b,.45,17/11u);  % lower arm and beak
penlabels(0,1,2,3,4,5,6,7,8); endchar;

cmchar "\displaystyle summation sign";
beginchar(oct"130",21u#,0,18/6dh#); padded 1/6dh#;
adjust_fit(0,0); pickup tiny.nib;
numeric top_arm_thickness, bot_arm_thickness, thick_stem, thin_stem;
thick_stem=bold+4dw; thin_stem=rule_thickness+dw;
top_arm_thickness=Vround .9thin_stem;
bot_arm_thickness=Vround .9(.5[thin_stem,thick_stem]);
lft x1l=hround u; x1l=x2l=x4l; x3l-x1l=4/11(w-2u);
top y1=0; bot y2=-top_arm_thickness-eps; bot y4=-d; y3=-.5d;
numeric alpha[]; alpha1=((x3l-x1l)++(y2-y3))/(y2-y3);
penpos1(alpha1*(thick_stem-tiny),0); penpos2(alpha1*(thick_stem-tiny),0);
penpos3(alpha1*(thick_stem-tiny),0);
alpha2=diag_ratio(1,thin_stem-tiny,y3-y4,x3r-x4l);
penpos4(alpha2*(thin_stem-tiny),0);
z0=whatever[z2l,z3l]=z4l+whatever*(z3r-z4r);
filldraw z1l--z2l--z0--z4l--z4r--z3r--z2r--z1r--cycle;  % diagonals
pickup crisp.nib; pos5(top_arm_thickness,90); pos6(hair,0);
top y5r=0; x5=x1; rt x6r=hround(w-u); y6=good.y(y5l-3u)-eps;
arm(5,6,a,.45,24/11u);  % upper arm and beak
pos7(bot_arm_thickness,-90); pos8(hair,0);
bot y7r=-d; z7l=whatever[z4,z3]; x7r:=x4; x8=x6; y8=good.y(y7l+3u)+eps;
arm(7,8,b,.45,24/11u);  % lower arm and beak
penlabels(0,1,2,3,4,5,6,7,8); endchar;


cmchar "\textstyle integral sign";
beginchar(oct"122",12u#,0,100/52dh#);
italcorr 3.5u#; % \TeX\ kerning between upper limit and lower limit
adjust_fit(0,-ic#); pickup fine.nib;
pos1(curve,0); pos2(hair,0); pos3(vair,90); pos4(stem,180);
pos5(curve,180); pos5'(curve,0); z5'=z5; pos6(stem,0);
pos7(vair,-90); pos8(hair,-180); pos9(curve,-180);
rt x1r=hround(w-u); x9=w-x1; x7=w-x3=3u;
x5=.5[x4,x6]; x4-x6=1.2u; lft x5r=hround(.5w-.5curve);
top y3r=0; bot y7r=-d; y9-.5curve=vround(top y7l+.25curve);
y3-y1=y9-y7; y5=.5[y3,y7]=.5[y4,y6]; y4-y6=.6(y3-y7);
bulb(3,2,1); bulb(7,8,9);  % bulbs
filldraw stroke z3e{left}...z4e{(z5e-z4e)xscaled 1.1}
 ..tension atleast 1 and atleast .8..{z5-z4}z5e;  % upper stem
filldraw stroke z5'e{z6-z5}..tension atleast.8 and atleast 1
 ..{(z6e-z5'e)xscaled 1.1}z6e...{left}z7e;  % lower stem
penlabels(1,2,3,4,5,6,7,8,9); endchar;

cmchar "\displaystyle integral sign";
beginchar(oct"132",18u#,0,220/48dh#);
italcorr 8u#; % \TeX\ kerning between upper limit and lower limit
adjust_fit(0,-ic#); pickup fine.nib;
numeric bulb_size, max_size;
bulb_size=hround(bold+dw); max_size=hround(bold+2dw);
pos1(bulb_size,0); pos2(hair,0); pos3(vair,90); pos4(bold,180);
pos5(max_size,180); pos5'(max_size,0); z5'=z5; pos6(bold,0);
pos7(vair,-90); pos8(hair,-180); pos9(bulb_size,-180);
rt x1r=hround(w-u); x9=w-x1; x7=w-x3=3u;
x5=.5[x4,x6]; x4-x6=4.8u; lft x5r=hround(.5w-.5max_size);
top y3r=0; bot y7r=-d;
y9-.5bulb_size=vround(top y7l+.25bulb_size); y3-y1=y9-y7;
y5=.5[y3,y7]=.5[y4,y6]; y4-y6=.6(y3-y7);
bulb(3,2,1); bulb(7,8,9);  % bulbs
filldraw stroke z3e{left}...z4e{(z5e-z4e)xscaled 1.1}
 ..tension atleast 1 and atleast .8..{z5-z4}z5e;  % upper stem
filldraw stroke z5'e{z6-z5}..tension atleast.8 and atleast 1
 ..{(z6e-z5'e)xscaled 1.1}z6e...{left}z7e;  % lower stem
penlabels(1,2,3,4,5,6,7,8,9); endchar;

cmchar "\textstyle contour integral sign";
beginchar(oct"110",12u#,0,100/52dh#);
italcorr 3.5u#; % \TeX\ kerning between upper limit and lower limit
adjust_fit(0,-ic#); pickup fine.nib;
pos1(curve,0); pos2(hair,0); pos3(vair,90); pos4(stem,180);
pos5(curve,180); pos5'(curve,0); z5'=z5; pos6(stem,0);
pos7(vair,-90); pos8(hair,-180); pos9(curve,-180);
rt x1r=hround(w-u); x9=w-x1; x7=w-x3=3u;
x5=.5[x4,x6]; x4-x6=1.2u; lft x5r=hround(.5w-.5curve);
top y3r=0; bot y7r=-d; y9-.5curve=vround(top y7l+.25curve);
y3-y1=y9-y7; y5=.5[y3,y7]=.5[y4,y6]; y4-y6=.6(y3-y7);
bulb(3,2,1); bulb(7,8,9);  % bulbs
filldraw stroke z3e{left}...z4e{(z5e-z4e)xscaled 1.1}
 ..tension atleast 1 and atleast .8..{z5-z4}z5e;  % upper stem
filldraw stroke z5'e{z6-z5}..tension atleast.8 and atleast 1
 ..{(z6e-z5'e)xscaled 1.1}z6e...{left}z7e;  % lower stem
pickup rule.nib; autorounded;
draw fullcircle scaled .5w shifted z5;  % contour
penlabels(1,2,3,4,5,6,7,8,9); endchar;

cmchar "\displaystyle contour integral sign";
beginchar(oct"111",18u#,0,220/48dh#);
italcorr 8u#; % \TeX\ kerning between upper limit and lower limit
adjust_fit(0,-ic#); pickup fine.nib;
numeric bulb_size, max_size;
bulb_size=hround(bold+dw); max_size=hround(bold+2dw);
pos1(bulb_size,0); pos2(hair,0); pos3(vair,90); pos4(bold,180);
pos5(max_size,180); pos5'(max_size,0); z5'=z5; pos6(bold,0);
pos7(vair,-90); pos8(hair,-180); pos9(bulb_size,-180);
rt x1r=hround(w-u); x9=w-x1; x7=w-x3=3u;
x5=.5[x4,x6]; x4-x6=4.8u; lft x5r=hround(.5w-.5max_size);
top y3r=0; bot y7r=-d;
y9-.5bulb_size=vround(top y7l+.25bulb_size); y3-y1=y9-y7;
y5=.5[y3,y7]=.5[y4,y6]; y4-y6=.6(y3-y7);
bulb(3,2,1); bulb(7,8,9);  % bulbs
filldraw stroke z3e{left}...z4e{(z5e-z4e)xscaled 1.1}
 ..tension atleast 1 and atleast .8..{z5-z4}z5e;  % upper stem
filldraw stroke z5'e{z6-z5}..tension atleast.8 and atleast 1
 ..{(z6e-z5'e)xscaled 1.1}z6e...{left}z7e;  % lower stem
pickup rule.nib; autorounded;
draw fullcircle scaled .5w shifted z5;  % contour
penlabels(1,2,3,4,5,6,7,8,9); endchar;






% Changed height of folllowing chars so as to be coherent with the rest



cmchar "Horizontal curly brace tip---down and left";
beginchar(oct"172",.75dh#,heavy_rule_thickness#,0);
adjust_fit(0,0); pickup fine.nib;
numeric min_breadth; min_breadth=vround(rule_thickness+.6dw);
pos1(min_breadth,90); pos1'(min_breadth,90);
pos2(1.2h,90);
bot y2l=0; bot y1l=bot y1'l=vround(y2-4.5u-.5min_breadth);
.5[x1,x1']=-eps; x2=w+shrink_fit+eps; x1'-x1=min_breadth-fine;
filldraw z1r{x2-x1,3(y2r-y1r)}...{right}z2r
 --z2l{left}...{x1'-x2,3(y1-y2)}z1'l--z1l--cycle;  % stroke
penlabels(1,2); endchar;

cmchar "Horizontal curly brace tip---down and right";
beginchar(oct"173",.75dh#,heavy_rule_thickness#,0);
adjust_fit(0,0); pickup fine.nib;
numeric min_breadth; min_breadth=vround(rule_thickness+.6dw);
pos1(min_breadth,90); pos1'(min_breadth,90);
pos2(1.2h,90);
bot y2l=0; bot y1l=bot y1'l=vround(y2-4.5u-.5min_breadth);
.5[x1,x1']=w+shrink_fit+eps; x2=-eps; x1-x1'=min_breadth-fine;
filldraw z1r{x2-x1,3(y2r-y1r)}...{left}z2r
 --z2l{right}...{x1'-x2,3(y1-y2)}z1'l--z1l--cycle;  % stroke
penlabels(1,2); endchar;

cmchar "Horizontal curly brace tip---up and left";
beginchar(oct"174",.75dh#,heavy_rule_thickness#,0);
adjust_fit(0,0); pickup fine.nib;
numeric min_breadth; min_breadth=vround(rule_thickness+.6dw);
pos1(min_breadth,90); pos1'(min_breadth,90);
pos2(1.2h,90);
bot y2l=0; top y1r=top y1'r=vround(y2+4.5u+.5min_breadth);
.5[x1,x1']=-eps; x2=w+shrink_fit+eps; x1'-x1=min_breadth-fine;
filldraw z1l{x2-x1,3(y2l-y1l)}...{right}z2l
 --z2r{left}...{x1'-x2,3(y1-y2)}z1'r--z1r--cycle;  % stroke
penlabels(1,2); endchar;

cmchar "Horizontal curly brace tip---up and right";
beginchar(oct"175",.75dh#,heavy_rule_thickness#,0);
adjust_fit(0,0); pickup fine.nib;
numeric min_breadth; min_breadth=vround(rule_thickness+.6dw);
pos1(min_breadth,90); pos1'(min_breadth,90);
pos2(1.2h,90);
bot y2l=0; top y1r=top y1'r=vround(y2+4.5u+.5min_breadth);
.5[x1,x1']=w+shrink_fit+eps; x2=-eps; x1-x1'=min_breadth-fine;
filldraw z1l{x2-x1,3(y2l-y1l)}...{left}z2l
 --z2r{right}...{x1'-x2,3(y1-y2)}z1'r--z1r--cycle;  % stroke
penlabels(1,2); endchar;



font_x_height x_height#;
font_quad 18u#+4letter_fit#;
% (The calling file should give the other math extension font parameters.)
bye.
