home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / useful / dist / text / tex / pastex / mf / inputs / cyrmax.mf < prev    next >
Text File  |  1991-07-03  |  8KB  |  207 lines

  1. %% @metafontfile{
  2. %%     filename="cyrmax.mf",
  3. %%     version="2.1",
  4. %%     date="30-MAY-1991",
  5. %%     filetype="Metafont: driver",
  6. %%     copyright="Copyright (C) Humanities and Arts Computing Center,
  7. %%            University of Washington;
  8. %%            all rights reserved.  Copying of this file is
  9. %%            authorized only if either:
  10. %%            (1) you make absolutely no changes to your copy
  11. %%                including name; OR
  12. %%            (2) if you do make changes, you first rename it to some
  13. %%                other name.",
  14. %%     author="American Mathematical Society",
  15. %%     address="American Mathematical Society,
  16. %%            Technical Support Group,
  17. %%            P. O. Box 6248,
  18. %%            Providence, RI 02940,
  19. %%            USA",
  20. %%     telephone="401-455-4080 or (in the USA) 800-321-4AMS",
  21. %%     email="Internet: Tech-Support@Math.AMS.com",
  22. %%     codetable="ISO/ASCII",
  23. %%     checksumtype="line count",
  24. %%     checksum="207",
  25. %%     keywords="amsfonts, tex, metafont , cyrillic ",
  26. %%     abstract="This is the driver file for use with 
  27. %%            the cyrillic fonts in AMSFonts 2.1."
  28. %%     }
  29. %
  30. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  31. def slantswitch =
  32. slant:=-slant;
  33. currenttransform:= identity slanted slant yscaled aspect_ratio scaled granularity;
  34. enddef; %reverse slant so that mirror() will work
  35.  
  36. def lowerfit = 0 enddef;
  37.  
  38. def mirror (expr axis) =
  39. x._qa=x._qb=axis; y._qa=h; y._qb=0; picture V; transform MIRROR;
  40. MIRROR=identity reflectedabout(z._qa,z._qb); 
  41. V=currentpicture transformed MIRROR; currentpicture:=V;
  42. slantswitch;
  43. enddef;
  44.  
  45. vardef armup(suffix $,$$,@)(expr darkness,jut) =  % arm from |z$| to |z$$|
  46.  x@0=good.x(x$$r-jut); y@0=y$l;
  47.  if serifs: y@1=y$r; z@1=z$$r-whatever*(z@0-z$$r);
  48.   z@2=.5[z$r,z@1];
  49.   filldraw z$$l{z@1-z$$l}...darkness[z@1,.5[z@2,z$$l] ]...z@2
  50.    ---z$r--z$l--z@0--z$$r--cycle; % arm and beak
  51.  else: filldraw z$l--z$r--z@0--z$$r--cycle; fi  % sans-serif arm
  52.  penlabels(@0,@1,@2); enddef;
  53.  
  54. def varwid =
  55.   if serifs: if hefty: vair else: 1.5cap_hair fi else: vair fi
  56.   enddef;
  57.  
  58.  
  59. vardef cyrsanserif(suffix $) =
  60.  x$.css.r=x$r; x$.css.l=x$l; x$.css=x$;
  61.   y$.css.r=y$r-2slab; y$.css.l=y$l-2slab; y$.css=y$-2slab; 
  62.  filldraw stroke z$e--z$.css.e;
  63. enddef;
  64.  
  65. vardef lcyrsanserif(suffix $) =
  66.  numeric cssdif; cssdif=.5(x$r-x$l); if cssdif<0: cssdif:=-cssdif; fi
  67.  x$'.css.r=x$r+cssdif; x$'.css.l=x$l+cssdif; x$'.css=x$+cssdif;
  68.   y$'.css.r=y$'.css.l=y$'.css=bot y$ + slab; 
  69.  x$.css.r=x$r+cssdif; x$.css.l=x$l+cssdif; x$.css=x$+cssdif;
  70.   y$.css.r=y$r-2slab; y$.css.l=y$l-2slab; y$.css=y$-2slab; 
  71.  filldraw stroke z$'.css.e--z$.css.e;
  72. enddef;
  73.  
  74. vardef rcyrsanserif(suffix $) =
  75.  numeric cssdif; cssdif=.5(x$r-x$l); if cssdif<0: cssdif:=-cssdif; fi
  76.  x$'.css.r=x$r-cssdif; x$'.css.l=x$l-cssdif; x$'.css=x$-cssdif;
  77.   y$'.css.r=y$'.css.l=y$'.css=bot y$ + slab; 
  78.  x$.css.r=x$r-cssdif; x$.css.l=x$l-cssdif; x$.css=x$-cssdif;
  79.   y$.css.r=y$r-2slab; y$.css.l=y$l-2slab; y$.css=y$-2slab; 
  80.  filldraw stroke z$'.css.e--z$.css.e;
  81. enddef;
  82.  
  83. numeric flouradjust; flouradjust=.09designsize;
  84. vardef cyr_serif(suffix $,$$,@)  % serif at |z$| for stroke from |z$$|
  85.   (expr darkness,jut) suffix modifier =
  86.  pickup crisp.nib; numeric bracket_height; pair downward; 
  87.  bracket_height=if dark.modifier: 1.5 fi\\ bracket;
  88.  if y$<y$$: y@2=min(y$+bracket_height,y$$);
  89.   top y@1-slab=bot y@0+eps=tiny.bot y$; downward=z$-z$$;
  90.   if y@1>y@2: y@2:=y@1; fi
  91.  else: y@2=max(y$-bracket_height,y$$);
  92.   bot y@1+slab=top y@0-eps=tiny.top y$; downward=z$$-z$;
  93.   if y@1<y@2: y@2:=y@1; fi fi
  94.  y@3=y@2; z@3=whatever[z$,z$$];
  95.  if jut<0: z@2+penoffset downward of currentpen =
  96.    z$l+penoffset downward of pen_[tiny.nib]+whatever*downward;
  97.   lft x@0=lft x@1=tiny.lft x$l+jut;
  98.   if x@3<x@2+eps: x@3:=x@2+eps; fi
  99.  else: z@2-penoffset downward of currentpen =
  100.    z$r-penoffset downward of pen_[tiny.nib]+whatever*downward;
  101.    rt x@0=rt x@1=tiny.rt x$r+jut;
  102.    if x@3>x@2-eps: x@3:=x@2-eps; fi fi
  103.  pair corner; ypart corner=y@1; corner=z@2+whatever*downward;
  104.  pair flourish; xpart flourish= x@0 if jut > 0: + cyrflwd else: - cyrflwd fi;
  105.  ypart flourish= y@0 - cyrflht;
  106. if (designsize < 15pt): 
  107.    pair flourishcorner; xpart flourishcorner=flouradjust[x@2,(xpart flourish)];
  108.     ypart flourishcorner=ypart flourish; %if jut > 0: -1.5 else: +1.5 fi;
  109.    filldraw z@2{z$-z$$}
  110.   ...darkness[corner,.5[z@1,z@2] ]{z@1-z@2}
  111.   ...{jut,0}z@1--z@0{down}...{jut,-1}flourish--flourishcorner{-jut,0}
  112.    ...{-jut,0}(x$,y@0)--z@3--cycle; % the serif
  113. else: filldraw z@2{z$-z$$}
  114.   ...darkness[corner,.5[z@1,z@2] ]{z@1-z@2}
  115.   ...{jut,0}z@1--z@0{down}...{jut,-1}flourish{-jut,0}
  116.    ...{-jut,0}(x$,y@0)--z@3--cycle; % the serif
  117. fi
  118.  labels (@0,@1,@2,@3); enddef;
  119.  
  120.  
  121. def dish_cyr_serif(suffix $,$$,@)(expr left_darkness,left_jut)
  122.   (suffix @@)(expr right_darkness,right_jut) suffix modifier =
  123.  cyr_serif($,$$,@,left_darkness,-left_jut) modifier;
  124.  cyr_serif($,$$,@@,right_darkness,right_jut) modifier;
  125. enddef;
  126.  
  127. def l_cyr_serif(suffix $,$$,@)(expr left_darkness,left_jut)
  128.   (suffix @@)(expr right_darkness,right_jut) suffix modifier =
  129.  cyr_serif($,$$,@,left_darkness,-left_jut) modifier;
  130.  serif($,$$,@@,right_darkness,right_jut) modifier;
  131. enddef;
  132.  
  133. def r_cyr_serif(suffix $,$$,@)(expr left_darkness,left_jut)
  134.   (suffix @@)(expr right_darkness,right_jut) suffix modifier =
  135.  serif($,$$,@,left_darkness,-left_jut) modifier;
  136.  cyr_serif($,$$,@@,right_darkness,right_jut) modifier;
  137. enddef;
  138.  
  139. % cyrbrev is called with suffix, dummy_suffix e.g.
  140. % cyrbrev(2,q) where the breve will be centered
  141. % above x2 using dummy suffixes q_1, q_2 etc.
  142. def cyrbrev (suffix $,@) =
  143. pickup crisp.nib; pos@_1(vair,-180); pos@_3(vair,0);
  144. top y@_1=top y@_3=h;
  145. lft x@_1r=hround(x$-4u-.5vair); rt x@_3r=hround(x$+4u+.5vair);
  146. numeric mid_thickness; mid_thickness=vround 1/3[vair,stem];
  147. pos@_2(mid_thickness,-90); x@_2=x$;
  148. bot y@_2r=y$+dot_size;
  149. filldraw stroke z@_1e{down}...z@_2e{right}...{up}z@_3e;  % stroke
  150. pos@_11(dot_size,0); pos@_12(dot_size,90);
  151. pos@_13(dot_size,0); pos@_14(dot_size,90);
  152. lft x@_11l=lft x@_1r; rt x@_13r=rt x@_3r; y@_11=y@_12=y@_13=y@_14=h;
  153. x@_12=x@_11; x@_14=x@_13; dot(@_11,@_12); dot(@_13,@_14);
  154. penlabels(@_1,@_2,@_3,@_11,@_13); enddef;
  155.  
  156. boolean altaccent; altaccent=false;   % altaccent inhibits right side dot
  157. def nucyrbrev (suffix $,@) =
  158. pickup crisp.nib; pos@_1(vair,-180); pos@_3(vair,0);
  159. top y@_1=top y@_3=y@_2r+cyrspread;
  160. lft x@_1r=hround(x$-4u-.5vair); rt x@_3r=hround(x$+4u+.5vair);
  161. numeric mid_thickness; mid_thickness=vround 1/3[vair,stem];
  162. pos@_2(mid_thickness,-90); x@_2=x$;
  163. bot y@_2r=y$+.5dot_size;
  164. filldraw stroke z@_1e{down}...z@_2e{right}...{up}z@_3e;  % stroke
  165.  
  166. if square_dots: % relax
  167. else:
  168.   pos@_11(dot_size,0); pos@_12(dot_size,90); 
  169.   pos@_13(dot_size,0); pos@_14(dot_size,90);
  170.   lft x@_11l=lft x@_1r; rt x@_13r=rt x@_3r; 
  171.   y@_11=y@_12=y@_13=y@_14=y@_2r+cyrspread;
  172.   x@_12=x@_11; x@_14=x@_13; dot(@_11,@_12); 
  173.   if altaccent: % relax
  174.   else: dot(@_13,@_14); fi
  175. fi
  176. penlabels(@_1,@_2,@_3,@_11,@_13); enddef;
  177.  
  178. % flip rotates 180 degrees about the centerpoint whose suffix is passed
  179. def flip (suffix $) =
  180. picture V; transform FLIP;
  181. y$:=y$*aspect_ratio;
  182. FLIP=identity rotatedaround(z$,180) shifted(2slant*y$,0);
  183. V=currentpicture transformed FLIP; currentpicture:=V;
  184. enddef;
  185.  
  186. def dot_sharp_values =
  187. numeric dot_diam#; dot_diam#=max(dot_size#,cap_curve#);
  188. numeric dot_top#; dot_top#=min(asc_height#,10/7x_height#+.5dot_diam#);
  189. enddef;
  190.  
  191.  
  192. % umlaut
  193. % calling specification is (xx,q) where xx is a point over which to center
  194. %                                 the umlaut, q is a dummy suffix which may be used
  195. def umlaut (suffix $,@) =
  196. dot_sharp_values;
  197. define_whole_blacker_pixels(dot_diam);
  198. pickup tiny.nib; pos@_1(dot_diam,0); pos@_2(dot_diam,90);
  199. x@_1=x@_2=x$-dot_diam; top y@_2r=2dot_diam+y$;
  200. y@_1=.5[y@_2l,y@_2r];  
  201. dot(@_1,@_2);  % dot
  202. pos@_3(dot_diam,0); pos@_4(dot_diam,90);
  203. x@_3=x@_4=x$+1.75u; top y@_4r=2dot_diam+y$;
  204. y@_3=.5[y@_4l,y@_4r];  
  205. dot(@_3,@_4);  % dot
  206. enddef;
  207.