%*****************************************************************************
% Copyright (c) 1989 by N. N. Billawala
%*****************************************************************************
% punct.mf punctuation: common in all character sets
% 21 characters
iff OK "!": "Exclamation point";
beginchar("!",I_w*width#+a_mono#,cap#,0);
min_limit(join_radius)(.5thin_stem.uc);
bot z1=(round(.5w),0);
z0=bot z1+(0,.5accent_dot_diameter);
top z3=(x1,h)//; pos3(stem.uc,-oblique);
onaline(0,3)(2); bot y2=max(bot y1+accent_dot_diameter+2,.3y3);
pos2(thin_stem.uc,-oblique);
p1=dot.b(z1,accent_dot_diameter);
p2=(z3--z3l)softjoin(z3l--z2l)softjoin(z2l--z2r)softjoin(z2r--z3r)
softjoin(z3r--z3)--cycle;
showpoints(0,1,2,3);
adjust(v_a*fitbasis.uc#+m_a*a_mfit#,v_a*fitbasis.uc#+m_a*a_mfit#);
show_character; endchar;
% rotation of shape and slant of position with obliqueness
iff OK "#": "Sharp/number/hash/pound";
beginchar("#",.5width#+b_mono#,ascender#,descender#);
min_limit(join_radius)(.375stem.uc);
multpos(1,2,3,4)(max(1,.75stem.uc),90);
bot lft z3l=(0,round(1.05math_axis-.2h-.5*max(1,.75stem.uc)))//;
z4l=(x3l+.9w,y3l);
bot rt z2l=(w,y3l+round .4h)//;
z1l=(x2l-.9w,y2l);
onaline(1,2)(11); x11=round(.27[x1,x2]);
onaline(3,4)(12); x12=round(.27[x3,x4]);
onaline(11,12)(5,6); top y5=h-mathlines; bot y6=-d+mathlines;
pickup mathpen rotated (angle(z5-z6)-90);
draw z5--z6;
draw (z5--z6) shifted
(max(round .5mathlines+2,round(abs(x2-x1))-2*round(.27(x2-x1))),0);
p1=(z1 soften(z1l,z2l,z2r,z1r) z1)--cycle;
p2=(z3 soften(z3l,z4l,z4r,z3r) z3)--cycle;
showpoints(1,2,3,4,5,6,11,12);
adjust(v_G*fitbasis.uc#+m_a*b_mfit#,v_G*fitbasis.uc#+m_a*b_mfit#);
show_character; endchar;
iff OK "$": "Dollar sign";
beginchar("$",num_width_b#+b_mono#,ascender#,0);
top y2l=bot y2r+max(1,.75minor_curve.uc)=round(.9(h+d));
bot y6r=top y6l-max(1,.75minor_curve.uc)=round(.12(h+d));
rt z1=(.93w,y2r-.05(y2r-y6r))//;
lft z7=(0,y6r+.1(y2r-y6r))//;
z4=(.5w,.52[y6r,y2l])//;
lft z3l=(if narrow_condition:0 else:round(.05w) fi,.5[y4,y2l])//;
rt z5r=(w,.5[y6r,y4])//;
good_x_for(2l)(z3l,z1,.5)a; good_x_for(2r)(z3r,z1-(bulb_thickness,0),.4)b;
good_x_for(6r)(z7,z5r,.5)c; good_x_for(6l)(z7+(bulb_thickness,0),z5l,.6)d;
z3=z3l+(.5stem.uc,0); z5=z5r-(.5stem.uc,0);
ref1=z3..z4..z5;
pos4(stem.uc,(angle (postcontrol 1 of ref1-precontrol 1 of ref1))+90);
rt z3r=(lft x3l+max(1,.75stem.uc),(1-v_stress)[y4r,y2r]);
lft z5l=(rt x5r-.75stem.uc,v_stress[y6l,y4l]);
bot z10=(.5w,-ov_b.uc); multpos(10,11)(max(1,.75thin_stem.uc),-oblique);
top z11=(.5w,h+ov_t.uc)//;
p1=bulb.tr(z1,z2r,z2l,cs,bulb_thickness,90)
o_t z3l{downward} o_t z4l i_t z5l i_t
bulb.bl(z7,z6l,z6r,cs,bulb_thickness,90)
o_t z5r{upward} o_t z4r i_t z3r i_t cycle;
p2=(.5[z10l,z11l] soften(z11l,z11r,z10r,z10l) .5[z10l,z11l])--cycle;
showpoints(1,2,3,4,5,6,7,8,10,11);
adjust(.5num_fit_b#+m_a*b_mfit#,.5num_fit_b#+m_a*b_mfit#);
show_character; endchar;
% currently same width as the lining numbers
iff OK "%": "Percent sign";
beginchar("%",.5width#+d_mono#,ascender#,0);
top y1r=h; bot y1l=top y1r-max(1,.5major_curve.lc);
bot y3r=.6h; top y3l=bot y3r+max(1,.5major_curve.lc);
lft z2r=(0,(1-v_stress)[y3r,y1r])//;
rt z2l=(lft x2r+max(1,.5bowlstem.lc),(1-v_stress)[y3r,y1r]);
rt z4r=(round(.5w),v_stress[y3r,y1r])//;
lft z4l=(rt x4r-max(1,.5bowlstem.lc),v_stress[y3r,y1r]);
good_x_for(1r)(z2r,z4r,.52)a; good_x_for(1l)(z2l,z4l,.48)b;
good_x_for(3r)(z2r,z4r,.48)c; good_x_for(3l)(z2l,z4l,.52)d;
pickup mathpen rotated angle((w,h)//-(0,0)//);
z10=(round(.5w),round(-.6h))//;
top rt z11=(w,h)//;
bot lft z12=(0,0)//;
draw z11--z12;
p1 =z1r{left} o_t z2r{downward} o_t z3r{right} o_t z4r{upward} o_t cycle;
p1'=z1l{left} i_t z2l{downward} i_t z3l{right} i_t z4l{upward} i_t cycle;
p2 =p1 shifted z10;
p2'=p1' shifted z10;
z13r= point 3.5 of p1; pos13(max(1,.5major_curve.lc),90-oblique);
z14r= (.5[x13,x11],y13); pos14(max(1,.35bowlstem.lc),90-oblique);
z15=z11+(.5mathlines,0)rotated (angle((w,h)//-(0,-d)//)+90);
p3=z13l...z14l{right}...z15--z15...z14r{left}...z13r--cycle;
showpoints(1,2,3,4,11,12,13,14,15);
adjust(v_C*fitbasis.uc#+m_a*d_mfit#,v_C*fitbasis.uc#+m_a*d_mfit#);
show_character; endchar;
iff OK "&": "Ampersand";
beginchar("&",.65width#+d_mono#,cap#,0);
bot y6r=top y6l-thin_stem.uc=-ov_b.uc;
top y2l=y2r+max(1,.9thin_stem.uc)=h+ov_t.uc;
z4=.65[z6r,z2l];
rt z1l=(.75w if narrow_condition:+.05w fi,.5[y4,y2r])//;
pos1(max(1,.9thin_stem.uc),180);
lft z3l=(round(.25w),.5[y4,y2r])//;
pos3(max(1,.9stem.uc),0);
z5=(if narrow_condition:.93w else:.9w fi,.8[y6r,y4])//;
z11=(.95[x6l,x5],y5-terminal_thickness-.07h);
multpos(5,11)(max(1,if narrow_condition:.8 else:.9 fi *thin_stem.uc),0);
lft z7r=(0,.45[y6r,y4])//; rt z7l=z7r+(bowlstem.uc,0); z7=.5[z7l,z7r];
z8=.5[z7r,z1l];
good_x_for(2r)(z3r,z1r,.5)a; good_x_for(2l)(z3l,z1l,.5)b;
good_x_for(6l)(z7l,z11l,.4)c; good_x_for(6r)(z7r,z11r,.4)d;
x6l:=min(x6l,x6r+thin_stem.uc);
z9l=z8;
bot rt z10=(.9w,0); pos10(max(1,.57stem.uc),10);
ref0=z1{downward}..z8..z7{downward};
pos8(max(1,thin_stem.uc),angle(direction 1 of ref0)+90);
pos9(max(1,.9stem.uc),angle(direction 1 of ref0)+180);
ref1=z2r{left} i_t z3r{downward}...
subpath(0,4)of reverse terminalserif.r(z10,z9,z9l,z9r,.5ts,0)soft;
ref2=subpath(4,20)of reverse terminalserif.r(z10,z9,z9l,z9r,.5ts,0)soft
...z3l{upward} o_t z2l{right};
ref3=z6r{left} o_t z7r{upward} o_t z8l i_t z1r{upward} i_t z2r{left};
ref4=z6l{left} i_t z7l{upward} i_t z8r o_t z1l{upward} o_t z2l{left};
ref5=z5l..z11l i_t z6l{left};
ref6=reverse terminalserif(z5,z11,z11l,z11r,.75hs,0) o_t z6r{left};
(t1,t2)=ref1 intersectiontimes ref3; (t3,t4)=ref2 intersectiontimes ref3;
(t5,t6)=ref1 intersectiontimes ref4; (t7,t8)=ref2 intersectiontimes ref4;
(t9,t10)=ref1 intersectiontimes ref5; (t11,t12)=ref2 intersectiontimes ref5;
(t13,t14)=ref1 intersectiontimes ref6;(t15,t16)=ref2 intersectiontimes ref6;
p1 =reverse(subpath(0,t14)of ref6--subpath(t13,infinity)of ref1--
subpath(0,t15)of ref2--subpath(t16,infinity)of ref6--
subpath(0,t4)of ref3--subpath(t3,infinity)of ref2--
subpath(infinity,t6)of ref4--subpath(t5,t9)of ref1--
subpath(t10,1)of ref5)--cycle;
p1'=subpath(0,t1)of ref1--subpath(t2,infinity)of ref3--cycle;
p2'=subpath(0,t8)of ref4--subpath(t7,t11)of ref2--
subpath(t12,infinity)of ref5--cycle;
showpoints(1,2,3,4,5,6,7,8,9,10,11,41,42,43,44,45,46,47,48,100);
adjust(v_C*fitbasis.uc#+m_a*d_mfit#,v_G*fitbasis.uc#+m_a*d_mfit#);
show_character; endchar;
iff OK "'": "Single right quote or apostrophe";
beginchar(oct"047",I_w*width#+a_mono#,cap#,0);
save_num(head)=accent_dot_diameter;
top z1=(.5w,.75[xheight,cap]-.5head)//;
ref1=comma(z1,head,min(.6xheight,1.5pt),accent_thin_end,0);
p1=ref1 rotatedaround (z1,if prime:prime_angle fi -oblique);
showpoints(1);
adjust(v_a*fitbasis.lc#+m_a*a_mfit#,v_a*fitbasis.lc#+m_a*a_mfit#);
show_character; endchar;
% rotation and slant of position with obliqueness
iff OK "(": "Left parenthesis"; % need to add shift if w>.45h
beginchar("(",.25width#+b_mono#,maxheight#,maxdepth#);
save_num(width_limit)=min(w,.4(h+d));
parenthesis_curl:=2; def p_c={curl parenthesis_curl} enddef;
min_limit(join_radius)(max(.5,.37thin_stem.uc));
top z1l=(width_limit,h)//;
bot z3l=(width_limit,-d)//;
lft z2l=.5[z1l,z3l]+(width_limit,0)rotated(180-oblique);
pos2(max(1,.75stem.uc),-oblique);
ref1=z1l...z2l{downward}...z3l;
pos1(max(1,.75thin_stem.uc),angle(direction 0 of ref1)+90);
pos3(max(1,.75thin_stem.uc),angle(direction 2 of ref1)+90);
ref2=z1l p_c..z2l{downward}..p_c z3l; ref3=z3r p_c..z2r{upward}..p_c z1r;
if softpath:p1=(z2l{downward}..p_c z3l)softjoin(z3l--z3r)softjoin
ref3 softjoin(z1r--z1l)softjoin(z1l p_c..z2l{downward})--cycle;
else:p1=ref2--ref3--cycle; fi
showpoints(1,2,3);
adjust(v_C*fitbasis.uc#+m_c*b_mfit#,v_H*fitbasis.uc#+m_cc*b_mfit#);
show_character; endchar;
iff OK ")": "Right parenthesis"; % need to add shift if w>.45h
beginchar(")",.25width#+b_mono#,maxheight#,maxdepth#);
save_num(width_limit)=min(w,.4(h+d));
parenthesis_curl:=2; def p_c={curl parenthesis_curl} enddef;
min_limit(join_radius)(max(.5,.37thin_stem.uc));
top z1l=(0,h)//;
bot z3l=(0,-d)//;
lft z2l=.5[z1l,z3l]+(width_limit,0)rotated(-oblique);
pos2(max(1,.75stem.uc),180-oblique);
ref1=z1l...z2l{downward}...z3l;
pos1(max(1,.75thin_stem.uc),angle(direction 0 of ref1)-90);
pos3(max(1,.75thin_stem.uc),angle(direction 2 of ref1)-90);
ref2=z1l p_c..z2l{downward}..p_c z3l; ref3=z3r p_c..z2r{upward}..p_c z1r;
if softpath:p1=(z2l{downward}..p_c z3l)softjoin(z3l--z3r)softjoin
ref3 softjoin(z1r--z1l)softjoin(z1l p_c..z2l{downward})--cycle;
else:p1=ref2--ref3--cycle; fi
showpoints(1,2,3);
adjust(v_H*fitbasis.uc#+m_cc*b_mfit#,v_C*fitbasis.uc#+m_c*b_mfit#);
show_character; endchar;
iff OK "*": "Asterisk";
beginchar("*",.35width#+d_mono#,cap#,0);
save_num(w_h)=min(w,h); save_bool(softpath)=true;
save_num(join_radius)=.3stem.uc;
z1=(.5w,if singlepitch:math_axis else:h-.5w_h fi)//;
top z3=z1+(0,.5w_h);
z2=whatever[z1,z3]; y2=.7[bot y1,top y3];
multpos(2,3)(inlimit(.75stem.uc)(1,abs(z2-z1)-2),0);
pickup pencircle scaled 1.5; draw z1;
ref1=(z1 soften(z2r,z3r,z3l,z2l) z1)--cycle;
for nn:=6: for n:=1 upto nn:
p[n]=ref1 rotatedaround (z1,(1-n)*(360/nn)-oblique); endfor endfor
showpoints(1,2,3);
adjust(v_d*fitbasis.uc#+m_a*d_mfit#,v_d*fitbasis.uc#+m_a*d_mfit#);
show_character; endchar;
% rotation of shape and slant of position with obliqueness
iff OK "+": "Plus sign";
beginchar("+",.5width#+b_mono#,cap#,0);
save_num(w_h)=min(w,h);
pickup mathpen;
z0=(.5w,math_axis)//;
lft z1=round(z0-(.5w_h,0));
rt z2=lft z1+(w_h,0);
top z3=round(z0+(0,.5w_h));
bot z4=z3-(0,1.01w_h);
x2:=(x2 if(x3-x1)>(x2-x3):+1 elseif(x3-x1)<(x2-x3):-1 fi);
draw z1--z2;
draw z3--z4;
adjust(v_a*fitbasis.uc#+m_a*b_mfit#,v_a*fitbasis.uc#+m_a*b_mfit#);
show_character; endchar;
% use different mathpen for softness
% character position, but not shape slants with obliqueness
% must make sure that the plus/minus have the same widths
iff OK ",": "Comma";
beginchar(",",1.15I_w*width#+a_mono#,xheight#,descender#);
save_num(head)=round_dot_diameter;
top z1=(round(.5w),.5round_dot_diameter)//;
ref1=comma(z1,head,min(.8d,.6xheight),accent_thin_end,0);
p1=ref1 rotatedaround (z1,if prime:prime_angle fi -oblique);
showpoints(1);
adjust(v_a*fitbasis.lc#+m_a*a_mfit#,v_a*fitbasis.lc#+m_a*a_mfit#);
show_character; endchar;
iff OK ".": "Period";
beginchar(".",1.5I_w*width#+a_mono#,xheight#,0);
bot z1=(.5w,0);
p1=dot.b(z1,round_dot_diameter);
showpoints(1);
adjust(v_a*fitbasis.lc#+m_a*a_mfit#,v_a*fitbasis.lc#+m_a*a_mfit#);
show_character; endchar;
% no slant of shape with obliqueness
iff OK "/": "Right leaning slash"; % need to add shift if w>.45h
beginchar("/",.45width#+b_mono#,maxheight#,maxdepth#);
pickup mathpen rotated angle((min(w,.5(h+d)),h)//-(0,-d)//);
top rt z1=(min(w,.5(h+d)),h)//;
bot lft z2=(0,-d)//;
draw z1--z2;
adjust(v_H*fitbasis.uc#+m_a*b_mfit#,v_H*fitbasis.uc#+m_a*b_mfit#);
show_character; endchar;
% use different mathpen for softness
iff OK ":": "Colon";
beginchar(":",I_w*width#+a_mono#,xheight#,0);
bot z1=(round(.5w),0);
top z2=(x1,if singlepitch:h
else:max(.85xheight,top y1+round_dot_diameter+2) fi)//;
p1=dot.b(z1,round_dot_diameter);
p2=dot.t(z2,round_dot_diameter);
showpoints(1,2);
adjust(v_a*fitbasis.lc#+m_a*a_mfit#,v_a*fitbasis.lc#+m_a*a_mfit#);
show_character; endchar;
% no slant of shape, but slant of position of top dot with obliqueness
iff OK ";": "Semi-colon";
beginchar(";",I_w*width#+a_mono#,xheight#,descender#);
save_num(head)=round_dot_diameter;
top z1=(round(.5w),.5round_dot_diameter)//;
top z2=(x1,if singlepitch:h
else:max(.85xheight,top y1+round_dot_diameter+2) fi)//;
ref1=comma(z1,head,min(.8d,.6xheight),accent_thin_end,0);
p1=ref1 rotatedaround (z1,if prime:prime_angle fi -oblique);
p2=dot.t(z2,round_dot_diameter);
showpoints(1,2);
adjust(v_a*fitbasis.lc#+m_a*a_mfit#,v_a*fitbasis.lc#+m_a*a_mfit#);
show_character; endchar;
% no slant of shape, but slant of position of top dot with obliqueness
iff OK "=": "Equals sign";
beginchar("=",.5width#+b_mono#,cap#,0);
pickup mathpen;
bot lft z1=(0,math_axis+.15h)//;
rt z2=(lft x1+w,y1);
top lft z3=(0,math_axis-.15h)//;
rt z4=(lft x3+w,y3);
draw z1--z2;
draw z3--z4;
adjust(v_a*fitbasis.uc#+m_a*b_mfit#,v_a*fitbasis.uc#+m_a*b_mfit#);
show_character; endchar;
% use different mathpen for softness
% character position, but not shape slants with obliqueness
iff OK "?": "Question mark";
beginchar("?",.35width#+b_mono#,cap#,0); %.4width
min_limit(join_radius)(.5thin_stem.uc);
lft z1=(0,.9h)//;
rt z3r=(w,.75h)//; lft z3l=z3r-(stem.uc,0);
top y2r=bot y2l+max(1,major_curve.uc)=h+ov_t.uc;
good_x_for(2r)(z1,z3r,.5)a; good_x_for(2l)(z1+(bulb_thickness,0),z3l,.5)b;
bot z7=(.35w,0);
z8=bot z7+(0,.5accent_dot_diameter);
bot z6=(bot z7+(0,max(bot y7+accent_dot_diameter+2,.3y2r)))//;
multpos(5,6)(thin_stem.uc,-oblique);
onaline(6,8)(5); y5=max(y7+accent_dot_diameter+2,.35y2r);
z4l=.4[z5l,z3l]; z4r=.4[z5r,z3r];
p1=(bulb.tl(z1,z2l,z2r,cs,max(1,.75bulb_thickness),90)soft i_t z3l{downward}
i_t z4l o_t z5l{downward}--z6l)softjoin(z6l--z6r)softjoin
(z6r--z5r{upward} i_t z4r o_t z3r{upward} o_t z2r{left})--cycle;
p2=dot.b(z7,accent_dot_diameter);
showpoints(1,2,3,4,5,6,7,8);
adjust(v_C*fitbasis.uc#+m_a*b_mfit#,v_C*fitbasis.uc#+m_a*b_mfit#);
show_character; endchar;
iff OK "@": "Commercial at sign";
beginchar("@",.6width#+f_mono#,maxheight#,maxdepth#);
majorcurve:=max(1,.75major_curve.lc);
majorbowltip:=max(1,.75major_bowl_tip.lc);
minorcurve:=max(1,.75minor_curve.lc);
save major_curve,minor_curve,major_bowl_tip;
save_bool(ensure_min_archthickness):=false;
save_num(thinline)=max(1,.4pt);
major_curve.lc:=majorcurve; major_bowl_tip.lc:=majorbowltip;
minor_curve.lc:=minorcurve;
top rt z11r=(if narrow_condition:w else:.75w fi,.75h)//;
bot rt z13r=(if narrow_condition:w else:.75w fi,.27h)//;
multpos(11,13)(max(1,.75stem.lc),0);
onaline(11l,13l)(1l,5,6); y1l=y1r=(y11r-minor_curve.lc)-minor_ductal.lc;
onaline(11r,13r)(1r); y5=ductal[.25h+major_curve.lc,y1l];
y6=y5-major_curve.lc;
lft z3l=(if narrow_condition:.45w-.5*.75bowlstem.lc else:.25w fi,
(1-v_stress)[y13,y11r]-.15bowlstem.lc)//;
rt x3r=lft x3l+max(1,.75bowlstem.lc);
y3r=inlimit((1-v_stress)[y13r,y11r]+.15bowlstem.lc)
(.25h+major_curve.lc,.75h-minor_curve.lc);
ref1=bowl.l(z5,.25h,z1l,.75h,z3r,z3l);
ref2=bowl.l(z5,.25h,z1r,.75h,z3r,z3l);
ref3=outer_bowlpath(ref2);
ref4=terminalserif.r(z13,z11,z5,z1r,0,0);
pickup pencircle scaled thinline;
rt z20 =(w,.5h)//;
rt z21 =z1r;
top z22=(.5w,.95h)//;
lft z23=(0,.5h)//;
bot z24=(.5w,.05h)//;
z25=(.75[x24,x20],.3[y24,y13]);
draw (if narrow_condition:z20...z21{upward}else:z13{right}...z20{upward} fi
...z22{left}...z23{downward}...z24{right}...z25)
if singlepitch:shifted(0,-.5d) fi;
p1'=(bowl_counter(ref1)--cycle) if singlepitch:shifted(0,-.5d) fi; % counter
p1 =(outer_juncture_path.br(ref3,ref4,5)--cycle) % bowl
if singlepitch:shifted(0,-.5d) fi;
showpoints(1,2,3,5,6,11,13,20,21,22,23,24,25);
adjust(v_C*fitbasis.uc#+m_a*f_mfit#,v_C*fitbasis.uc#+m_a*f_mfit#);
show_character; endchar;
% this character is quite thin compared to the others and even has its own
% |arch_thickness|
iff OK "[": "Left square bracket"; % need to add shift if w>.45h
beginchar("[",.3width#+b_mono#,maxheight#,maxdepth#);
pickup mathpen;
top rt z1=(min(w,.3(h+d)),h)//;
top lft z2=(0,h)//;
bot lft z3=(0,-d)//;
bot rt z4=(min(w,.3(h+d)),-d)//;
draw z1--z2--z3--z4;
adjust(v_A*fitbasis.uc#+m_e*b_mfit#,v_H*fitbasis.uc#+m_ee*b_mfit#);
show_character; endchar;
% use different mathpen for softness
iff OK "]": "Right square bracket"; % need to add shift if w>.45h
beginchar("]",.3width#+b_mono#,maxheight#,maxdepth#);
pickup mathpen;
top lft z1=(0,h)//;
top rt z2=(min(w,.3(h+d)),h)//;
bot rt z3=(min(w,.3(h+d)),-d)//;
bot lft z4=(0,-d)//;
draw z1--z2--z3--z4;
adjust(v_H*fitbasis.uc#+m_ee*b_mfit#,v_A*fitbasis.uc#+m_e*b_mfit#);
show_character; endchar;
% use different mathpen for softness
iff OK "`": "Single left quote";
beginchar(oct"140",I_w*width#+a_mono#,cap#,0);
save_num(head)=accent_dot_diameter;
z1=(.5w,.75[xheight,cap]-.5head-min(.6xheight,2pt))//;
ref1=comma(z1,head,min(.6xheight,1.5pt),accent_thin_end,0);
p1=ref1 rotatedaround(z1,180 if prime:prime_angle fi -oblique);
showpoints(1);
adjust(v_a*fitbasis.lc#+m_a*a_mfit#,v_a*fitbasis.lc#+m_a*a_mfit#);
show_character; endchar;
% rotation and slant of position with obliqueness
|