% cross for l call with suffix of crossing point on stem def cross_for_l (suffix $,@) = pickup crisp.nib; x@_2-x@_1=max(4u,2.8u+stem); .5[x@_1,x@_2]=x$; y@_1-.75bar=y$-.75dot_size; y@_2+.75bar=y$+.75dot_size; numeric theta; theta=angle(z@_2-z@_1)+90; pos@_1(if monospace: bar else: 1.5bar fi,theta); pos@_2(if monospace: bar else: 1.5bar fi,theta); filldraw stroke z@_1e--z@_2e; % diagonal penlabels(1,2); enddef; % longer cross for l def cross_for_lz (suffix $,@) = pickup crisp.nib; x@_2-x@_1=max(6u,4.2u+stem); .5[x@_1,x@_2]=x$; y@_1-.75bar=y$-.75dot_size; y@_2+.75bar=y$+.75dot_size; numeric theta; theta=angle(z@_2-z@_1)+90; pos@_1(if monospace: bar else: 1.5bar fi,theta); pos@_2(if monospace: bar else: 1.5bar fi,theta); filldraw stroke z@_1e--z@_2e; % diagonal penlabels(1,2); enddef; % define reverse adjust fit for use with rotated characters def r_adjust_fit(expr adjr,adjl) = adjust_fit(adjl,adjr); enddef; def tilde_accent (suffix $,@)(expr tY_shift) = save @; forsuffixes $$=@,@_: transform $$; endfor if serifs: numeric theta; theta=angle(1/6(6u-vair),1/4(asc_height-x_height)); pickup crisp.nib; numeric mid_width; mid_width=.4[vair,stem]; pos@_1(vair,theta+90); pos@_2(vair,theta+90); pos@_3(vair,theta+90); pos@_4(vair,theta+90); z@_2-z@_1=z@_4-z@_3=(mid_width-crisp)*dir theta; rt x@_4l-x$=x$-lft x@_1r=3u; top y@_4r=asc_height; bot y@_1l=vround(bot y@_1l+min(2/3[x_height,asc_height],y@_3l-.25vair)-top y@_1r); pair delta; ypart delta=3(y@_3l-y@_1l); delta=whatever*dir theta; @ = identity shifted(0,tY_shift); for n = 1,2,3,4: forsuffixes e = l,,r: z@[n]e = z@_[n]e transformed @; endfor endfor filldraw z@1l..controls(z@1l+delta)and(z@3l-delta)..z@3l..z@4l --z@4r..controls(z@4r-delta)and(z@2r+delta)..z@2r..z@1r--cycle; % stroke else: pickup fine.nib; pos@_1(vair,180); pos@_2(vair,90); pos@_3(.5[vair,slab],90); pos@_4(vair,90); pos@_5(vair,180); rt x@_5l-x$=x$-lft x@_1r=3u; x@_2-x@_1=x@_3-x@_2=x@_4-x@_3=x@_5-x@_4; bot y@_1=bot y@_4l=vround(.75[x_height,asc_height]-vair); top y@_2r=top y@_5=asc_height; y@_3=.5[y@_2,y@_4]; @ = identity shifted(0,tY_shift); for n = 1,2,3,4,5: forsuffixes e = l,,r: z@[n]e = z@_[n]e transformed @; endfor endfor filldraw stroke z@1e{up}...z@2e{right}..z@3e..{right}z@4e...{up}z@5e; fi % stroke penlabels(@1,@2,@3,@4,@5); enddef; % flip rotates 180 degrees about the centerpoint whose suffix is passed def flip (suffix $) = picture V; transform t; %y$:=y$*aspect_ratio; z.QQ.$=z$ transformed currenttransform ; t=identity rotatedaround(z.QQ.$,180); % shifted(2y$*slant,0); V=currentpicture transformed t; currentpicture:=V; enddef; def slantswitch = slant:=-slant; if lushift: currenttransform:= identity slanted slant yscaled aspect_ratio scaled granularity shifted(0,superskip); else: currenttransform:= identity slanted slant yscaled aspect_ratio scaled granularity ; fi enddef; transform MIRROR; MIRROR=identity reflectedabout(origin,up); % produce a mirror image of current picture reflected about a vertical axis % thanks to Chris Thompson for pointing out a problem with, and solution for, % some instances of round-off problems in the mirror macro; % his improvements are reflected [that's a joke son] % in making MIRROR permanently defined as reflectionabout(origin,up) % and converting mirror into just a shifted MIRROR and mirroradd % into an addto currentpicture shifted MIRROR def mirror (expr axis) = currentpicture:=currentpicture transformed MIRROR shifted (2axis,0); slantswitch; % restore normal slant enddef; % add a mirrored image to current picture def mirroradd (expr axis) = picture V; V=currentpicture transformed MIRROR shifted (2axis,0); addto currentpicture also V; slantswitch; enddef; def caph_stroke(suffix $,@,@@,$$) = penpos$$(x@@r-x@@l,0); x$$=x@@; bot y$$=0; y@@=.5[x_height,cap_height]; penpos$''(x$r-x$l,0); x$''=x$; y$''=1/8[x_height,cap_height]; filldraw stroke z$''e--z$e; % thicken the lower left stem penpos@0(min(rt x$r-lft x$l,thin_join)-fine,180); pickup fine.nib; rt x@0l=tiny.rt x$r; y@0=y$''; pos@1(vair,90); pos@@'(x@@r-x@@l+tiny,0); z@@'=z@@; x@1=.5[rt x@0l,rt x@@'r]; top y@1r=cap_height+oo; (x@,y@1l)=whatever[z@1r,z@0l]; x@1l:=x@; filldraw stroke z@0e{up}...{right}z@1e &{{interim superness:=hein_super; super_arc.e(@1,@@')}}; % arch pickup tiny.nib; filldraw stroke z@@e--z$$e; % right stem labels(@0); penlabels(@1); enddef;