%%
%% xppffgen.mf - an alternative font for MusiXTeX \ppff 
%% font source code, letter figure definition
%%
%% Modified from official cmbxti10.mf cmbase.mf textit.mf itall.mf
%% (Computer Modern Text Italic family)
%%
%% by Hiroaki MORIMOTO <CQX05646@nifty.com>
%%
%% August, 2004.
%%

mode_setup; font_setup;

%----patches for cmbase--------------------------------------------------------
def bulb(suffix $,$$,$$$) =
pair uprevsl, dnrevsl;
uprevsl := (0,y$r-y$$r) slanted -slant;
dnrevsl := (0,y$$r-y$r) slanted -slant;
 z$$$r=z$$r;
% path_.l:=z$l{x$$r-x$r,0}...{0,y$$r-y$r}z$$l;
 path_.l:=z$l{x$$r-x$r,0}...{dnrevsl}z$$l;
% draw path_.l--z$$r{0,y$r-y$$r}...{x$r-x$$r,0}z$r--cycle; % link
 filldraw path_.l--z$$r{uprevsl}...{x$r-x$$r,0}z$r--cycle; % link
% path_.r:=z$$$l{0,y$r-y$$r}..z$$$r{0,y$$r-y$r}; % near-circle
 path_.r:=z$$$l{uprevsl}..z$$$r{dnrevsl}; % near-circle
% filldraw subpath(0,xpart(path_.r intersectiontimes path_.l)) of path_.r
%  --z$$r{0,y$$r-y$r}..cycle; % bulb
 filldraw path_.r--z$$r{dnrevsl}..cycle; % bulb
 enddef;

def hook_out(suffix $,$$,$$$)suffix modifier= % |x$| and |x$$$| (only) are known
 pos$(stem,0); pos$$(vair,90);
 x$$$:=hround(x$$$+.5hair-eps)-.5hair; pos$$$(hair,180);
 y$=1/4x_height; bot y$$l=-oo; y$$$=1/3x_height;
% if skewed.modifier: x$$=x$+1.25u;
%  filldraw stroke z$e{-u,-x_height}...z$$e{right}...{up}z$$$e;  % hook
% else: x$$=x$+1.5u;
%  filldraw stroke z$e{down}...z$$e{right}
%   ...{x$$$-(x$+2.5u),x_height}z$$$e; fi enddef;  % hook
 x$$=x$$$-u;
 filldraw stroke z$e{down}...z$$e{right}
  ...{up slanted .5slant}z$$$e;  % hook
enddef;

def hook_in(suffix $,$$,$$$)suffix modifier= % |x$| and |x$$$| (only) are known
 x$:=hround(x$-.5hair)+.5hair; pos$(hair,180);
% x$:=hround(x$-.5hair)+.5hair; pos$(vair,180);
 pos$$(vair,90); pos$$$(stem,0);
% pos$$(hair,90); pos$$$(stem,0);
% y$=2/3x_height; top y$$r=x_height+oo; y$$$=3/4x_height;
 y$=.55x_height; top y$$r=x_height+.9oo; y$$$=3/4x_height;
% if skewed.modifier: x$$=x$$$-1.25u;
  x$$=x$+u;
%  filldraw stroke z$e{up}..z$$e{right}...{-u,-x_height}z$$$e;  % hook
  filldraw stroke z$e{up slanted .5slant}...z$$e{right}...{down}z$$$e;  % hook
% else: x$$=x$$$-1.5u;
%  filldraw stroke z$e{x$$$-2.5u-x$,x_height}
%   ...z$$e{right}...{down}z$$$e; fi enddef;  % hook
enddef;

%----letter f------------------------------------------------------------------
cmchar "Italic letter f";
%beginchar("f",max(1.5u#,stem#)+max(3.5u#,2flare#),asc_height#,desc_depth#);
beginchar("f",max(1.5u#,stem#)+max(3.5u#,2flare#)-.6u#,asc_height#,desc_depth#);
%italcorr asc_height#*slant+.75u#;
italcorr asc_height#*slant;
adjust_fit(if monospace:u#,u# else: 0,0 fi); pickup fine.nib;
%numeric theta; z88=(.5w-.5u,h); z89=(.5w+.5u,-d); theta=angle(z88-z89);
numeric theta; z88=(.5w,h); z89=(.5w,-d); theta=angle(z88-z89);
pos0(flare,0); pos1(hair,0); pos2(vair,90);
%pos3(.5[hair,stem],180); pos4(stem,theta+90);
%pos3(.5[hair,stem],180); pos4(stem,270-theta);
pos3(.5[hair,stem],180); pos4(stem,180);
%pos5(stem,theta-90); pos6(.5[hair,stem],0);
%pos5(stem,90-theta); pos6(.5[hair,stem],0);
pos5(stem,0); pos6(.5[hair,stem],0);
%pos7(vair,-90); pos8(hair,-180); pos9(flare,-180);
pos7(vair,-75); pos8(hair,-180); pos9(flare,-180);
%rt x1r=hround(w+.25u); lft x8r=hround-.35u; x2=.6[x1,x4]; x7=.6[x8,x5];
rt x1r=hround(w+.25u)+.9u; lft x8r=hround-1.4u; x2=.6[x1,x4]; x7=.6[x8,x5];
%y9-.5flare=vround -.85d; y2-y0=y9-y7; top y2r=h+oo; bot y7r=-d-oo;
y9-.5flare=vround -d; y2-y0=y9-y7; top y2r=h+oo+.2hair; bot y7r=-d-oo-.2hair;
%y4=.25[x_height,h]; y5=.5[-d,y4];
y4=.2[x_height,h]; y5=.47[-d,y4];
z4=whatever[z88,z89]; z5=whatever[z88,z89];
%x3=.8[x2+x4-x88,x88]; x6=.8[x7+x5-x89,x89]; y3=.8[y4,y2]; y6=.8[y5,y7];
x3=.8[x2+x4-x88,x88]; x6=.8[x7+x5-x89,x89]; y3=.7[y4,y2]; y6=.7[y5,y7];
bulb(2,1,0); bulb(7,8,9);  % bulbs
filldraw stroke z2e{left}...z3e...{z89-z88}z4e;  % upper arc
filldraw z4r--z5l--z5r--z4l--cycle;  % stem
filldraw stroke z5e{z89-z88}...z6e...{left}z7e;  % lower arc
pickup crisp.nib; pos20(bar,90); pos21(bar,90);
%top y20r=top y21r=x_height;
top y20r=top y21r=x_height;
%lft x20=lft x4r-.5stem-u; rt x21=rt x4l+.5stem+1.5u;
lft x20=lft x4r-.5stem-1.1u; rt x21=rt x4l+.5stem+1.1u;
filldraw stroke z20e--z21e;  %  crossbar
math_fit(desc_depth#*slant+u#,x_height#*slant);
penlabels(0,1,2,3,4,5,6,7,8,9,20,21,88,89); 
currentpicture:=currentpicture shifted (.3u,.025x_height);
endchar;


%----letter p------------------------------------------------------------------
cmchar "Italic letter p";
%beginchar("p",9u#,x_height#,desc_depth#);
%beginchar("p",6.7u#,x_height#,desc_depth#);
beginchar("p",7u#,x_height#,desc_depth#);
italcorr .7x_height#*slant+.5curve#-u# if math_fitting:-.5u# fi;
adjust_fit(0,0); pickup fine.nib;
x0=0-.1u; x2-.5stem=hround(2.5u-.5stem); hook_in(0,1,2);  % opening hook
pos4(hair,-180); pos5(vair,-90); pos6(curve,0); pos7(vair,90);
%x4=x2; rt x6r=hround(w-1.5u+.5curve); x5=x7=.5[x4,x6];
%x4=.4[x2,x2r]; rt x6r=hround(w+.25u+.5curve); x5=.55[x4,x6]; x7=.4[x4,x6];
x4=.4[x2,x2r]; rt x6r=hround(w-.05u+.5curve); x5=.55[x4,x6]; x7=.4[x4,x6];
%bot y5r=-oo+.5hair; top y7r=h+oo+.25hair; y4=.55[y5,y7]; y6=.45[y5,y7];
bot y5r=-oo+hair; top y7r=h+oo+.1hair; y4=.55[y5,y7]; y6=.45[y5,y7];
filldraw stroke super_arc.e(4,5) & pulled_arc.e(5,6)
 & pulled_arc.e(6,7) & super_arc.e(7,4);  % bowl
filldraw stroke super_arc.e(4,5) & super_arc.e(5,6)
 & super_arc.e(6,7) & super_arc.e(7,4);  % bowl
pickup tiny.nib; pos2'(stem,0); pos3(stem,0);
z2=z2'; x3=x2; bot y3=-d; filldraw stroke z2'e--z3e;  % stem
dish_serif(3,2',a,1/3,.75jut,b,1/3,jut);  % serif
math_fit(-min(2/3x_height#*slant-.5hair#-.5u#,
 2u#-.5stem#-desc_depth#*slant),ic#);
penlabels(0,1,2,3,4,5,6,7); 
currentpicture:=currentpicture shifted (.25u,.025x_height);
endchar;


%----letter m------------------------------------------------------------------
cmchar "Italic letter m";
beginchar("m",9u#,x_height#,0);
%italcorr 1/3x_height#*slant;
italcorr 1/3x_height#*slant+.5hair#+.5u#;
x_height_o:=x_height; x_height:=.8x_height;
adjust_fit(if monospace:-1.5u#,-2u# else: 0,0 fi); pickup fine.nib;
%w := .9w;
numeric shaved_stem; %shaved_stem=mfudged.stem;
shaved_stem=.2[ess,stem];
save stem; stem=shaved_stem;
pos2(stem,0); x1=x2;
%if monospace: pos1(stem,0); lft x1l=hround(2.5u-.5stem); top y1=h;
%else:% x0=0; lft x2l=hround(2.5u-.5stem);
% x0=0; lft x2l=hround(2.5u-.5stem);
% x0=0+.08w; lft x2l=hround(2.5u-.5stem);
 x0=0-.5hair+.5stem; lft x2l=hround(2.5u-.5stem);
 hook_in(0,a,1);% fi  % opening hook
y2-.5stem=-oo; filldraw circ_stroke z2e--z1e;  % left stem
%x4+.5stem=hround(.5w+.5stem); ital_arch(2,3,4);  % left arch
%x4+.5stem=hround(.675w+.5stem); ital_arch(2,3,4);  % left arch
x4+.5stem=hround(.58w+.5stem); ital_arch(2,3,4);  % left arch
pos5(stem,0); y5=y2; x5=x4;
filldraw circ_stroke z5e--z4e;  % middle stem
%x7+.5stem=hround(w-2.5u+.5stem);
%x7+.5stem=hround(1.35w-2.5u+.5stem);
x7+.5stem=hround(1.16w-2.5u+.5stem);
%x8=x7-.25u; ital_arch(5,6,7);  % right arch
x8=x7; ital_arch(5,6,7);  % right arch
%if monospace: pos9(vair,90); x9=good.x .5[x8,w]; bot y9l=0; y8=1/3h;
% pos8(stem,0); filldraw stroke z8e{-u,-x_height}...{right}z9e; % terminal
%else:% x9=w; hook_out(8,b,9)(skewed); fi  % closing hook
%x9=1.25w; hook_out(8,b,9)(skewed);% fi  % closing hook
x9=w+1u; hook_out(8,b,9)(skewed);% fi  % closing hook
%filldraw stroke z7e{down}..{-u,-x_height}z8e;  % right stem
%filldraw stroke z7e{down}--{down}z8e;  % right stem
filldraw stroke z7e--z8e;  % right stem
math_fit(-2/3x_height#*slant+.5hair#+.5u#,ic#);
penlabels(0,a,1,2,3,4,5,6,7,8,b,9); 
x_height:=x_height_o;
currentpicture:=currentpicture shifted (.6u,.19x_height);
endchar;


%----letter s------------------------------------------------------------------
cmchar "Italic letter s";
%beginchar("s",5.25u#+max(1.75u#,flare#),x_height#,0);
beginchar("s",4.8u#,x_height#,0);
%italcorr x_height#*slant-.5u#;
italcorr 1/3x_height#*slant+.5hair#+.5u#;
adjust_fit(0,0); pickup fine.nib;
%numeric theta; theta=90-angle(40u,h); slope:=-h/40u;  % angle at middle
numeric theta; theta=90-angle(16u,h); slope:=-h/16u;  % angle at middle
pos2(vair,-90); pos0(max(fine.breadth,ess),theta); pos7(vair,-90);
%x2l=x0=x7=.5w; top y2l=h+oo; bot y7r=-oo;
%x2l+.08w=x0=x7-.08w=.5w; top y2l=h+oo-.1x_height; bot y7r=-oo+.1x_height;
x0=.5w; top y2l=h+oo-.1x_height; bot y7r=-oo+.1x_height;
x2=.4w; x7=.6w;
y0-.5ess=y7l+.55(y2r-y7l-ess);
%lft x3l=hround u-eps; rt x6r=hround(w-.5u)+eps;
%lft x3l=hround u-eps+.2u; rt x6r=hround(w-.5u)+eps-.2u;
lft x3l=0-.1u; rt x6r=w+.2u;
x3r-x3l=x6r-x6l=hround .5[vair,ess]-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;
interim superness:=more_super;
filldraw stroke super_arc.e(2,3) & z3e{down}
 ..z4e---z5e..z6e{down} & super_arc.e(6,7);  % main stroke
pos1(hair,0); pos10(hround .75[hair,flare],0);
pos2'(vair,90); z2'=z2;
pos8(hair,-180); pos9(flare,-180);
%rt x10r=hround(w-u)+2eps; lft x9r=hround .5u-2eps; y10=.78h; y9=.25h;
%rt x10r=hround(w-u)+2eps-.5u; lft x9r=hround 1u-2eps+.5u; y10=.78h; y9=.25h;
lft x9r=+.35u; rt x10r=w-.55u; y9=.25h; y10=.75h; 
bulb(2',1,10); bulb(7,8,9);  % bulbs
math_fit(0,ic#); penlabels(0,1,2,3,4,5,6,7,8,9,10); 
currentpicture:=currentpicture shifted (u,.09x_height);
endchar;

%----letter z------------------------------------------------------------------
cmchar "Italic letter z";
%beginchar("z",5.5u#+max(1.5u#,stem#),x_height#,0);
beginchar("z",5.2u#,x_height#,0);
%italcorr x_height#*slant+.5hair#;
italcorr 1/3x_height#*slant+.5hair#+.5u#;
adjust_fit(if monospace:.5u#,.5u# else: 0,0 fi); pickup fine.nib;
%pos1(hair,0); pos2(stem,-90); pos3(vair,-90); pos4(hair,0);
%pos1(hair,0); pos2(ess,-90); pos3(vair,-90); pos4(hair,0);
pos1(hair,-0); pos2(.3[ess,stem],-80); pos3(.7[vair,ess],-90); pos4(hair,-30);
%lft x1l=hround(u-.5hair); x2=2.5u; x3=w-2u; rt x4r=hround(w-.5u);
%lft x1l=hround(.5u-.5hair); x2=2.2u; x3=w-2u; rt x4r=hround(w-.5u);
lft x1l=hround(.0u-.5hair); x2=1.2u; x3=2.9u; rt x4r=hround(1.1w-.6u)-.2u;
%top y1=.78h; top y2l=top y4=h+oo; y3=.825h;
%top y1=.78h-.1x_height; top y2l=top y4=h+oo-.1x_height; y3=.825h-.1x_height;
%top y1=.78h-.1x_height; top y2l=top y4=h+oo-.1x_height; y3=.825h-.04x_height;
top y1=.76h-.1x_height; top y2l=top h+oo-.1x_height; y4l=h-.1x_height; y3=.85h-.1x_height;
%pos5(hair,0); pos6(vair,-90); pos7(stem,-90); pos8(hair,0);
%pos5(hair,0); pos6(vair,-90); pos7(ess,-90); pos8(hair,0);
pos5(hair,-30); pos6(.7[vair,ess],-90); pos7(.5[ess,stem],-80); pos8(hair,-0);
%x5=x1; x6=2.5u; x7=w-2u; x8+.5hair=hround(w+.5hair-eps);
%x5=x1+u; x6=3.5u; x7=w-1u; x8+.5hair=hround(w+.5hair-eps)+u;
%x5=x1+.5u; x6=2.5u; x7=.87w; x8+.5hair=hround(1.1w+.5hair-eps);
x5=x1+.5u; x6=2.5u; x7=.95w; x8+.5hair=hround(1.1w+.5hair-eps);
%bot y5=bot y7r=-oo; y6=.175h; bot y8=.31h;
%bot y5=.1x_height; y7r=-oo; y6=.175h+.1x_height; bot y8=.31h;
bot y5=.1x_height; y7r=-oo; y6=.175h+.03x_height; bot y8=.31h;
pair p; p=(z4-z5) yscaled 2;
filldraw stroke z1e{up}...z2e{right}..z3e{right}...{p}z4e;  % upper bar
filldraw stroke z5e{p}...z6e{right}..{right}z7e...{up}z8e;  % lower bar
filldraw stroke z5e{p}..{p}z4e;  % diagonal
math_fit(0,1/3x_height#*slant+.5hair#+.5u#);
penlabels(1,2,3,4,5,6,7,8); 
currentpicture:=currentpicture shifted (.7u,.09x_height);
endchar;


%----font dimensions-----------------------------------------------------------
font_slant slant; font_x_height x_height#;
% font_normal_space 6u#+2letter_fit#;
font_normal_space 4u#+2letter_fit#;
font_normal_stretch 3u#; font_normal_shrink 2u#;
font_quad 18u#+4letter_fit#;
font_extra_space 2u#;

ligtable "f": "f" kern -.7u#;
ligtable "p": "f" kern +.5u#;

bye.

