% dxsign.mf
%
% (c) Copyright 1995, 1996 J"org Knappen
% (c) Copyright 1990, 1992 Norbert Schwarz
%
% This file is part of dcfonts version 1.3
%
% Please read the files 00readme.txt, 00inst.txt, 00error.txt, and
% copyrite.txt for further information
%
% You find some documentation in dcdoc.tex (needs LaTeX2e)
%
% Content:
%
%   special characters common to roman and italic style fonts

version_check(0,9);  % |version_check| was introduced in dc1.3

dcchar "Zero for p mille sign";
beginchar(oct"030",if serifs:
   if monospace: 9u#+max(6u#,2fudge*(hair#+stem#)) else: 7u# fi else: 8u# fi,
  body_height#,body_height#-asc_height#);
italcorr if hefty: .4asc_height#*slant-.5u# else: h#*slant-u# fi;
adjust_fit(0,0); pickup fine.nib;
numeric left_curve,right_curve;
left_curve=hround 5/6[fudged.hair,fudged.stem];
right_curve=max(fine.breadth,hround(fudged.hair if hefty:-2stem_corr fi));
pos1(vair,90);
pos2(left_curve,180);
pos3(vair,270);
pos4(right_curve,360);
bot y3r=-d;
rt x4r=hround(.5w +2.5u );
lft x2r=hround(.5w -2.5u ) ;
top y1r=vround(if monospace: .3 else: .5 fi\\ asc_height);
x1=x3=.5[x2,x4]; y2=y4=.5[y1,y3];
filldraw stroke pulled_super_arc.e(1,2)(superpull)
 & pulled_super_arc.e(2,3)(superpull);  % left half of lower bowl
filldraw stroke super_arc.e(3,4) & super_arc.e(4,1); % right half of lower bowl
penlabels(1,2,3,4); endchar;


dcchar "Straight double quotes";
beginchar(oct"042",9u#,asc_height#,0);
numeric top_width#,spread#;
top_width#=if serifs: flare# else: stem# fi;
spread#=max(3u#,top_width#+.5u#); define_pixels(spread);
italcorr asc_height#*slant+.5top_width#+.5spread#-4u#;
adjust_fit(0,0);
x1=x2; x3=x4=w-x1; x3-x1=spread+2; y1=y3;
y2=y4=max(.5[bar_height,x_height]+.5vair,h-x_height);
if serifs: pickup crisp.nib; pos1(flare,0); pos2(vair,0);
 pos3(flare,0); pos4(vair,0);
 y1+.5stem=h; filldraw circ_stroke z1e--z2e;  % left stem and bulb
 filldraw circ_stroke z3e--z4e;  % right stem and bulb
else: pickup fine.nib; pos1(stem,0); pos2(vair,0);
 pos3(stem,0); pos4(vair,0);
 top y1=h; filldraw stroke z1e--z2e;  % left stem
 filldraw stroke z3e--z4e; fi  % right stem
penlabels(1,2,3,4); endchar;


dcchar "Hash mark (number sign)";
if monospace: compute_spread(.6x_height#,.7x_height#);
else: compute_spread(.45x_height#,.55x_height#); fi
beginchar("#",15u#,asc_height#,asc_depth#);
italcorr (math_axis#+.5(spread#+rule_thickness#))*slant-.5u#;
adjust_fit(0,0);
pickup extra_rule.nib; lft x1=hround u-eps; x3=x1; x2=x4=w-x1;
y1=y2; y3=y4; y1-y3=spread; .5[y1,y3]=math_axis;
draw z1--z2;  % upper bar
draw z3--z4;  % lower bar
lft x6=hround 3u; rt x7=hround(w-3u); x5-x6=x7-x8;
x8=good.x if monospace: .6 else: .5 fi\\w;
top y5=top y7=h+eps; bot y6=bot y8=-d-eps;
y15=y1; z15=whatever[z5,z6]; y36=y3; z36=whatever[z5,z6];
y27=y2; z27=whatever[z7,z8]; y48=y4; z48=whatever[z7,z8];
draw z5--if x5>x6+1:(good.x(x15+.5),y1)--(good.x(x15-.5),y1)
 --(good.x(x36+.5),y3)--(good.x(x36-.5),y3)--fi\\z6;  % left diagonal
draw z7--if x7>x8+1:(good.x(x27+.5),y2)--(good.x(x27-.5),y2)
 --(good.x(x48+.5),y4)--(good.x(x48-.5),y4)--fi\\z8;  % right diagonal
labels(1,2,3,4,5,6,7,8,15,27,36,48); endchar;

dcchar "Dollar sign";
beginchar("$",9u#,body_height#,body_height#-asc_height#);
italcorr fig_height#*slant-.5u#; % same as for digits
adjust_fit(0,0);
numeric theta; theta=90-angle(50u,asc_height); slope:=-asc_height/50u;
pickup fine.nib; pos2(slab,-90);
pos0(cap_stem,theta); pos7(slab,-90);
x2=x0=x7=.5w; top y2l=asc_height+oo; bot y7r=-oo;
y0=.52asc_height; lft x3l=hround u; rt x6r=hround(w-u);
x3r-x3l=x6r-x6l=hround .35[slab,cap_stem]-fine;
ellipse_set(2l,3l,4l,0l); ellipse_set(2r,3r,4r,0r); y3=y3r;
ellipse_set(7l,6l,5l,0l); ellipse_set(7r,6r,5r,0r); y6=y6r;
filldraw stroke super_arc.e(2,3) & z3e{down}
 ..z4e---z5e..z6e{down} & super_arc.e(6,7);  % main stroke
if serifs: pos1(hair,0); pos8(hair,180);
 pos10(flare,0); pos9(flare,180);
 rt x1r=hround(w-u); lft x8r=hround u; y1=.5[y0,y2]; y8=.5[y0,y7];
 {{less_tense; pos2'(slab,90); z2'=z2; bulb(2',1,10);  % upper arc and bulb
 bulb(7,8,9)}};  % lower arc and bulb
else: pos1(.6[slab,flare],-100); pos8(flare,-100);
 rt x1l=hround(w-1.3u); lft x8r=hround .8u;
 top y1l=vround .92asc_height+oo; bot y8r=vround .1asc_height-oo;
 filldraw stroke term.e(2,1,right,.9,4);  % upper arc and terminal
 filldraw stroke term.e(7,8,left,1,4); fi  % lower arc and terminal
pickup crisp.nib; pos12(bar,0); pos11(bar,0);
lft x12l=lft x11l=hround(.5w-.5bar); top y12=h; bot y11=-d;
filldraw stroke z12e--z11e;  % vertical crossbar
penlabels(0,1,2,3,4,5,6,7,8,9,10,11,12); endchar;



dcchar "Per cent sign";
beginchar("%",9u#+max(6u#,2fudge*(hair#+stem#)),
  body_height#,body_height#-asc_height#);
italcorr if hefty: .4asc_height#*slant-.5u# else: h#*slant-u# fi;
adjust_fit(0,0); pickup fine.nib;
numeric left_curve,right_curve;
left_curve=hround 5/6[fudged.hair,fudged.stem];
right_curve=max(fine.breadth,hround(fudged.hair if hefty:-2stem_corr fi));
pos1(vair,90); pos2(left_curve,180); pos3(vair,270); pos4(right_curve,360);
top y1r=h; lft x2r=hround u; rt x4r=hround(.5w-1.5u);
bot y3r=floor(if monospace: .7 else: .5 fi\\ asc_height);
x1=x3=.5[x2,x4]; y2=y4=.5[y1,y3];
filldraw stroke pulled_super_arc.e(1,2)(superpull)
 & pulled_super_arc.e(2,3)(superpull);  % left half of upper bowl
filldraw stroke super_arc.e(3,4) & super_arc.e(4,1); % right half of upper bowl
pos5(vair,90); pos6(left_curve,180); pos7(vair,270); pos8(right_curve,360);
bot y7r=-d; rt x8r=hround(w-u); lft x6r=hround(.5w+1.5u);
top y5r=vround(if monospace: .3 else: .5 fi\\ asc_height);
x5=x7=.5[x6,x8]; y6=y8=.5[y5,y7];
filldraw stroke pulled_super_arc.e(5,6)(superpull)
 & pulled_super_arc.e(6,7)(superpull);  % left half of lower bowl
filldraw stroke super_arc.e(7,8) & super_arc.e(8,5); % right half of lower bowl
pickup rule.nib; top y9=h; bot y10=-d;
if hefty: x9=good.x(x5-eps); x10=good.x(x1+eps);
 draw z9--z10;  % diagonal
else: rt x9=hround(w-2.5u); lft x10=hround 2.5u; draw z9--z10;  % diagonal
 pickup fine.nib; pos9(rule_thickness,angle(z9-z10)+90);
 pos11(vair,angle(z1r-z4r)-90); pos12(vair,angle(z9-z10)+90);
 path p; p=super_arc.r(1,4); z11r=point 2/3 of p; z12r=z9r;
 filldraw stroke z11e{direction 2/3 of p}...{z9-z10}z12e; fi  % link
penlabels(1,2,3,4,5,6,7,8,9,10,11,12); endchar;

dcchar "At sign";
beginchar("@",14u#,asc_height#,0);
italcorr .7asc_height#*slant-.5u#;
adjust_fit(0,if hefty or monospace:-2u# else: 0 fi);
pickup fine.nib; pos0(fudged.hair,0); pos1(vair,90);
pos2(fudged.stem,180); pos3(vair,270);
pos4(fudged.stem,-180); pos5(fudged.stem,-180);
pos6(vair,-90); pos7(fudged.hair,0);
pos8(vair,90); pos9(fudged.hair,180);
pos10(vair,270); pos11(.5[vair,flare],360);
x1=x3=.5[x0,x2]; y0=y2=.5[y1,y3];
x8=x10=.5w; y7=y9=.5[y8,y10];
lft x9r=hround u; x7=w-x9; top y8r=h+oo; bot y10r=-oo;
top y1r=vround(.8[y10,y8]+.5vair); bot y3r=vround(.2[y10,y8]-.5vair);
x6l=1/3[x5l,x7l]; y6=y3; y11=good.y(.1[y10,y8]-.5);
x0=x4=x5; y4=.8[y3,y1]; y5=2/3[y7,y6];
if hefty or monospace: lft x2r=hround(5u-.5fudged.stem);
 rt x0r=hround(w-3u); x11r=x0r;
else: lft x2r=hround 3.4u; x0=w-x2; x11r=x7r; fi
filldraw stroke super_arc.e(1,2) & super_arc.e(2,3);  % left inner bowl
filldraw stroke super_arc.e(3,0) & super_arc.e(0,1);  % right inner bowl
filldraw stroke super_arc.e(8,9) & super_arc.e(9,10)
 & term.e(10,11,right,1,4);  % left outer bowl and terminal
if hefty or monospace: {{interim superness:=hein_super;
  filldraw stroke super_arc.e(0,8)}};  % link
else: (x,y6r)=whatever[z6l,z7l]; x6r:=x;
 filldraw stroke z4e---z5e...z6e{right}...{up}z7e
  & super_arc.e(7,8); fi % stem and link
penlabels(0,1,2,3,4,5,6,7,8,9,10,11); endchar;

dcchar "Sterling sign";
beginchar(oct"277",12u#,asc_height#,0);
adjust_fit(0,.75asc_height#*slant-.5u#); pickup fine.nib;
pos0(flare,0); pos1(hair,0); pos2(vair,90); pos3(stem,180);
pos4(stem,180); pos4'(stem,0); pos5(vair,-90); z4'=z4;
x2=2/3w-.5u; rt x3l=rt x4l=hround(.5w-u+.5stem); x5=2.5u;
y1=y3=.75h; top y2=h+oo; y4=.25h; bot y5r=-oo;
rt x1r=hround(w-1.5u); bulb(2,1,0);  % bulb
filldraw stroke pulled_arc.e(2,3)..z4e;  % stem
numeric light_stem; light_stem=2/3[vair,vstem];
pos6(.5[hair,light_stem],-180); pos7(light_stem,-300);
pos8(light_stem,-300); pos9(hair,-180);
lft x6r=hround u; x7=3u; x8=w-3.5u; rt x9l=hround(w-u);
y6=.4[y5,y7]; top y7r=vround .2h; bot y8l=-oo; y9=good.y .2h;
filldraw stroke pulled_arc.e(4',5)...z6e{up}...z7e{right}
 ..{right}z8e...{up}z9e;  % loop and arm
pos10(bar,90); pos11(bar,90); x10=3u; x11=w-4.5u;
top y10r=top y11r=vround(.5h+.5bar); filldraw stroke z10e--z11e;  % bar
penlabels(1,2,3,4,5,6,7,8,9,10,11); endchar;


dcchar "Section sign"; % renovated (jk)
beginchar(oct"237",6.5u#+max(1.5u#,stem#),asc_height#,desc_depth#);
adjust_fit(0,0); pickup fine.nib;
numeric s_slab; s_slab=if serifs:slab else:vround .2[slab,cap_stem] fi;
numeric ess'; ess'=max(fine.breadth,cap_ess);
numeric sstem; sstem=hround .5[s_slab,ess']-fine;
if sstem < fine.breadth: sstem:=fine.breadth; fi
pos2(vair,90); pos3(sstem,180); 
pos4(ess',270); pos4'(vair,270);
pos5'(sstem,0); pos5(sstem,180);
pos6(ess',90); pos6'(vair,90); pos7(sstem,0); 
pos8(vair,-90);
top y2r=h+oo; bot y8r=-d-oo;
y3=.52[y4,y2]; y5=.52[y4,y6]; y7=.52[y6,y8]; y5'=.52[y6,y4];
y2-y4=y4-y6=y6-y8;
bot z4'=bot z4; top z6'=top z6;
lft x3r=hround 1.25u;
x2=x4=x6=x8=.5w; x5=x7=w-x3; x5'=x3;
if serifs:
 pos0(stem,0); pos1(hair,0); pos9(hair,-180); pos10(stem,-180);
 rt x1r=hround(w-1.5u); x9=w-x1; y2-y1=y9-y8=(y2-y8)/8;
 bulb(2,1,0); bulb(8,9,10);  % bulbs
else:
 pos1(.6[slab,flare],-100); pos9(flare,-100); pos2'(vair,-90);
 rt x1l=hround(w-1.3u); lft x9r=hround .8u; z2'=z2;
 top y1l=vround .92asc_height+oo; bot y9r=vround .1asc_height-d-oo;
 filldraw stroke term.e(2',1,right,.9,4);  % upper arc and terminal
 filldraw stroke term.e(8,9,left,.9,4);   % lower arc and terminal
fi
filldraw stroke z2e{left}...z3e{down}...z4e{3(x5-x3),y5-y3}
 ...z5e{down}...{left}z6'e;  % upper stroke
filldraw stroke z4'e{left}...z5'e{down}...z6e{3(x7-x5'),y7-y5'}
 ...z7e{down}...{left}z8e;  % upper stroke
penlabels(0,1,2,3,4,5,6,7,8,9,10); endchar;

endinput;
