home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1999 April / VPR9904A.BIN / Wintex / Ams / jamstex.lzh / AMSFONTS / SOURCES / CYRILLIC / CYRMAX.MF < prev    next >
Text File  |  1993-04-21  |  8KB  |  209 lines

  1. %% @metafontfile{
  2. %%     filename="cyrmax.mf",
  3. %%     version="2.1a",
  4. %%     date="21-APR-1993",
  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 Department,
  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.org",
  22. %%     codetable="ISO/ASCII",
  23. %%     checksumtype="line count",
  24. %%     checksum="208",
  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. transform MIRROR;
  39. MIRROR=identity reflectedabout(origin,up);
  40.  
  41. % produce a mirror image of current picture reflected about a vertical axis
  42. def mirror (expr axis) =
  43. currentpicture:=currentpicture transformed MIRROR shifted (2axis,0);
  44. slantswitch; % restore normal slant
  45. enddef;
  46.  
  47. vardef armup(suffix $,$$,@)(expr darkness,jut) =  % arm from |z$| to |z$$|
  48.  x@0=good.x(x$$r-jut); y@0=y$l;
  49.  if serifs: y@1=y$r; z@1=z$$r-whatever*(z@0-z$$r);
  50.   z@2=.5[z$r,z@1];
  51.   filldraw z$$l{z@1-z$$l}...darkness[z@1,.5[z@2,z$$l] ]...z@2
  52.    ---z$r--z$l--z@0--z$$r--cycle; % arm and beak
  53.  else: filldraw z$l--z$r--z@0--z$$r--cycle; fi  % sans-serif arm
  54.  penlabels(@0,@1,@2); enddef;
  55.  
  56. def varwid =
  57.   if serifs: if hefty: vair else: 1.5cap_hair fi else: vair fi
  58.   enddef;
  59.  
  60.  
  61. vardef cyrsanserif(suffix $) =
  62.  x$.css.r=x$r; x$.css.l=x$l; x$.css=x$;
  63.   y$.css.r=y$r-2slab; y$.css.l=y$l-2slab; y$.css=y$-2slab; 
  64.  filldraw stroke z$e--z$.css.e;
  65. enddef;
  66.  
  67. vardef lcyrsanserif(suffix $) =
  68.  numeric cssdif; cssdif=.5(x$r-x$l); if cssdif<0: cssdif:=-cssdif; fi
  69.  x$'.css.r=x$r+cssdif; x$'.css.l=x$l+cssdif; x$'.css=x$+cssdif;
  70.   y$'.css.r=y$'.css.l=y$'.css=bot y$ + slab; 
  71.  x$.css.r=x$r+cssdif; x$.css.l=x$l+cssdif; x$.css=x$+cssdif;
  72.   y$.css.r=y$r-2slab; y$.css.l=y$l-2slab; y$.css=y$-2slab; 
  73.  filldraw stroke z$'.css.e--z$.css.e;
  74. enddef;
  75.  
  76. vardef rcyrsanserif(suffix $) =
  77.  numeric cssdif; cssdif=.5(x$r-x$l); if cssdif<0: cssdif:=-cssdif; fi
  78.  x$'.css.r=x$r-cssdif; x$'.css.l=x$l-cssdif; x$'.css=x$-cssdif;
  79.   y$'.css.r=y$'.css.l=y$'.css=bot y$ + slab; 
  80.  x$.css.r=x$r-cssdif; x$.css.l=x$l-cssdif; x$.css=x$-cssdif;
  81.   y$.css.r=y$r-2slab; y$.css.l=y$l-2slab; y$.css=y$-2slab; 
  82.  filldraw stroke z$'.css.e--z$.css.e;
  83. enddef;
  84.  
  85. numeric flouradjust; flouradjust=.09designsize;
  86. vardef cyr_serif(suffix $,$$,@)  % serif at |z$| for stroke from |z$$|
  87.   (expr darkness,jut) suffix modifier =
  88.  pickup crisp.nib; numeric bracket_height; pair downward; 
  89.  bracket_height=if dark.modifier: 1.5 fi\\ bracket;
  90.  if y$<y$$: y@2=min(y$+bracket_height,y$$);
  91.   top y@1-slab=bot y@0+eps=tiny.bot y$; downward=z$-z$$;
  92.   if y@1>y@2: y@2:=y@1; fi
  93.  else: y@2=max(y$-bracket_height,y$$);
  94.   bot y@1+slab=top y@0-eps=tiny.top y$; downward=z$$-z$;
  95.   if y@1<y@2: y@2:=y@1; fi fi
  96.  y@3=y@2; z@3=whatever[z$,z$$];
  97.  if jut<0: z@2+penoffset downward of currentpen =
  98.    z$l+penoffset downward of pen_[tiny.nib]+whatever*downward;
  99.   lft x@0=lft x@1=tiny.lft x$l+jut;
  100.   if x@3<x@2+eps: x@3:=x@2+eps; fi
  101.  else: z@2-penoffset downward of currentpen =
  102.    z$r-penoffset downward of pen_[tiny.nib]+whatever*downward;
  103.    rt x@0=rt x@1=tiny.rt x$r+jut;
  104.    if x@3>x@2-eps: x@3:=x@2-eps; fi fi
  105.  pair corner; ypart corner=y@1; corner=z@2+whatever*downward;
  106.  pair flourish; xpart flourish= x@0 if jut > 0: + cyrflwd else: - cyrflwd fi;
  107.  ypart flourish= y@0 - cyrflht;
  108. if (designsize < 15pt): 
  109.    pair flourishcorner; xpart flourishcorner=flouradjust[x@2,(xpart flourish)];
  110.     ypart flourishcorner=ypart flourish; %if jut > 0: -1.5 else: +1.5 fi;
  111.    filldraw z@2{z$-z$$}
  112.   ...darkness[corner,.5[z@1,z@2] ]{z@1-z@2}
  113.   ...{jut,0}z@1--z@0{down}...{jut,-1}flourish--flourishcorner{-jut,0}
  114.    ...{-jut,0}(x$,y@0)--z@3--cycle; % the serif
  115. else: filldraw z@2{z$-z$$}
  116.   ...darkness[corner,.5[z@1,z@2] ]{z@1-z@2}
  117.   ...{jut,0}z@1--z@0{down}...{jut,-1}flourish{-jut,0}
  118.    ...{-jut,0}(x$,y@0)--z@3--cycle; % the serif
  119. fi
  120.  labels (@0,@1,@2,@3); enddef;
  121.  
  122.  
  123. def dish_cyr_serif(suffix $,$$,@)(expr left_darkness,left_jut)
  124.   (suffix @@)(expr right_darkness,right_jut) suffix modifier =
  125.  cyr_serif($,$$,@,left_darkness,-left_jut) modifier;
  126.  cyr_serif($,$$,@@,right_darkness,right_jut) modifier;
  127. enddef;
  128.  
  129. def l_cyr_serif(suffix $,$$,@)(expr left_darkness,left_jut)
  130.   (suffix @@)(expr right_darkness,right_jut) suffix modifier =
  131.  cyr_serif($,$$,@,left_darkness,-left_jut) modifier;
  132.  serif($,$$,@@,right_darkness,right_jut) modifier;
  133. enddef;
  134.  
  135. def r_cyr_serif(suffix $,$$,@)(expr left_darkness,left_jut)
  136.   (suffix @@)(expr right_darkness,right_jut) suffix modifier =
  137.  serif($,$$,@,left_darkness,-left_jut) modifier;
  138.  cyr_serif($,$$,@@,right_darkness,right_jut) modifier;
  139. enddef;
  140.  
  141. % cyrbrev is called with suffix, dummy_suffix e.g.
  142. % cyrbrev(2,q) where the breve will be centered
  143. % above x2 using dummy suffixes q_1, q_2 etc.
  144. def cyrbrev (suffix $,@) =
  145. pickup crisp.nib; pos@_1(vair,-180); pos@_3(vair,0);
  146. top y@_1=top y@_3=h;
  147. lft x@_1r=hround(x$-4u-.5vair); rt x@_3r=hround(x$+4u+.5vair);
  148. numeric mid_thickness; mid_thickness=vround 1/3[vair,stem];
  149. pos@_2(mid_thickness,-90); x@_2=x$;
  150. bot y@_2r=y$+dot_size;
  151. filldraw stroke z@_1e{down}...z@_2e{right}...{up}z@_3e;  % stroke
  152. pos@_11(dot_size,0); pos@_12(dot_size,90);
  153. pos@_13(dot_size,0); pos@_14(dot_size,90);
  154. lft x@_11l=lft x@_1r; rt x@_13r=rt x@_3r; y@_11=y@_12=y@_13=y@_14=h;
  155. x@_12=x@_11; x@_14=x@_13; dot(@_11,@_12); dot(@_13,@_14);
  156. penlabels(@_1,@_2,@_3,@_11,@_13); enddef;
  157.  
  158. boolean altaccent; altaccent=false;   % altaccent inhibits right side dot
  159. def nucyrbrev (suffix $,@) =
  160. pickup crisp.nib; pos@_1(vair,-180); pos@_3(vair,0);
  161. top y@_1=top y@_3=y@_2r+cyrspread;
  162. lft x@_1r=hround(x$-4u-.5vair); rt x@_3r=hround(x$+4u+.5vair);
  163. numeric mid_thickness; mid_thickness=vround 1/3[vair,stem];
  164. pos@_2(mid_thickness,-90); x@_2=x$;
  165. bot y@_2r=y$+.5dot_size;
  166. filldraw stroke z@_1e{down}...z@_2e{right}...{up}z@_3e;  % stroke
  167.  
  168. if square_dots: % relax
  169. else:
  170.   pos@_11(dot_size,0); pos@_12(dot_size,90); 
  171.   pos@_13(dot_size,0); pos@_14(dot_size,90);
  172.   lft x@_11l=lft x@_1r; rt x@_13r=rt x@_3r; 
  173.   y@_11=y@_12=y@_13=y@_14=y@_2r+cyrspread;
  174.   x@_12=x@_11; x@_14=x@_13; dot(@_11,@_12); 
  175.   if altaccent: % relax
  176.   else: dot(@_13,@_14); fi
  177. fi
  178. penlabels(@_1,@_2,@_3,@_11,@_13); enddef;
  179.  
  180. % flip rotates 180 degrees about the centerpoint whose suffix is passed
  181. def flip (suffix $) =
  182. picture V; transform FLIP;
  183. y$:=y$*aspect_ratio;
  184. FLIP=identity rotatedaround(z$,180) shifted(2slant*y$,0);
  185. V=currentpicture transformed FLIP; currentpicture:=V;
  186. enddef;
  187.  
  188. def dot_sharp_values =
  189. numeric dot_diam#; dot_diam#=max(dot_size#,cap_curve#);
  190. numeric dot_top#; dot_top#=min(asc_height#,10/7x_height#+.5dot_diam#);
  191. enddef;
  192.  
  193.  
  194. % umlaut
  195. % calling specification is (xx,q) where xx is a point over which to center
  196. %                                 the umlaut, q is a dummy suffix which may be used
  197. def umlaut (suffix $,@) =
  198. dot_sharp_values;
  199. define_whole_blacker_pixels(dot_diam);
  200. pickup tiny.nib; pos@_1(dot_diam,0); pos@_2(dot_diam,90);
  201. x@_1=x@_2=x$-dot_diam; top y@_2r=2dot_diam+y$;
  202. y@_1=.5[y@_2l,y@_2r];  
  203. dot(@_1,@_2);  % dot
  204. pos@_3(dot_diam,0); pos@_4(dot_diam,90);
  205. x@_3=x@_4=x$+1.75u; top y@_4r=2dot_diam+y$;
  206. y@_3=.5[y@_4l,y@_4r];  
  207. dot(@_3,@_4);  % dot
  208. enddef;
  209.