% %M% 3.%I% %E% -- a clone of some of Knuth's Computer Modern faces % Copyright (c) 1992 Damian Cugley. % This is a generic driver file, intended for use with METAFONT % or with programs like mff (which acts as a front end to METAFONT). % Unlike most driver files, it is named for the family (or "super-family") % it describes rather than an individual font within that family. % It is intended to produce approximations to some of % Donald E Knuth's Computer Modern typefaces. % INITIALIZATION -- read in CMBASE.MF and set the meta-parameters % if they are not already set: if unknown cmbase: SLANT := slant; input cmbase; slant := SLANT; fi if unknown hratio: hratio := 1; fi if unknown italicness: italicness := 0; fi if unknown weight: weight := 1; fi if unknown serifness: serifness := 1; fi if unknown monospaceness: monospaceness := 0; fi if unknown stress: stress := serifness * (1 - monospaceness); fi font_identifier:="Computer Modern" if stress > 0: & " Bright" & decimal stress fi % use Lucida's term if serifness = 0: & " Sanserif" fi if monospaceness > 0: & " Typewriter" fi if italicness > 0: & " italic" elseif slant > 0: & " oblique" & decimal slant fi if weight > 1: & " bold" & decimal weight elseif weight < 1: & " light" & decimal weight fi if hratio > 1: & " extended" & decimal hratio elseif hratio < 1: & " condensed" & decimal hratio fi; message font_identifier_; v# := 1/18 designsize; u# := hratio * v# * italicness[1,0.92] * if (designsize < 10 pt#): (0.75 + 2.5/(designsize/pt#)) elseif designsize > 10pt#: (0.88 + 1.2/(designsize/pt#)) else: 1 fi; % Spacing width_adj# := (weight - 1) * 0.77u#; serif_fit# := 0pt#; cap_serif_fit# := 0.25v# * 1/3[1,weight]; letter_fit# := italicness[0v#,0.451v#]; % heights of letters body_height# := monospaceness[13.5v#,12.5v#]; asc_height# := monospaceness[12.5v#,11.0v#]; cap_height# := monospaceness[12.3v#,11.0v#]; fig_height# := monospaceness[11.6v#,11.0v#]; x_height# := monospaceness[ 7.75v# * 1/20[1,weight], 8.0v#]; math_axis# := monospaceness[ 4.50v#, 5.5v#]; bar_height# := monospaceness[ 4.35v# * 1/25[1,weight], 3.95v#]; comma_depth# := monospaceness[ 3.50v#, 2.5v#]; desc_depth# := 3.50v#; % thickness of strokes % This is an abbrev for a complex mixture of sans and italic tendencies % turn_knob(S,BR,IT,WF) means that the medium-sanserif face has % dimension S, medium-bright has BR and medium-italic has IT; % the "weight factor" adjuusts the amout the difference due to weight % is exaggerated. def turn_knob(expr sans, br, it, wfact) = stress[sans * weight, wfact[1,weight] * italicness[br, it] ] enddef; hair# := turn_knob(1.125v#,0.45v#, 0.55v#, 2); stem# := turn_knob(1.25v#, 1.25v#, 1.15v#, 1); curve# := turn_knob(1.25v#, 1.50v#, 1.40v#, 4/5); ess# := turn_knob(1.00v#, 1.35v#, 1.35v#, 2/3); cap_flare# := turn_knob(1.40v#, 1.65v#, 1.45v#, 2/3); flare# := turn_knob(1.40v#, 1.65v#, 1.45v#, 2/3); dot_size# := turn_knob(1.75v#, 1.90v#, 1.90v#, 4/5); cap_hair# := turn_knob(1.125v#,0.55v#, 0.55v#, 6/5); cap_stem# := turn_knob(1.25v#, 1.60v#, 1.45v#, 1); cap_curve# := turn_knob(1.25v#, 1.85v#, 1.70v#, 4/5); cap_ess# := turn_knob(1.25v#, 1.75v#, 1.55v#, 0.85); rule_thickness# := stress[1.125v#, 0.72v#]; dish# := stress * 0.05v#; bracket# := stress * 1.00v# * 5/3[1,weight]; jut# := turn_knob(monospaceness * 1.7u#, 1.40v#, 1.50v#, (-1/6)); cap_jut# := turn_knob(monospaceness * 1.7u#, 1.85v#, 1.70v#, (-1/6)); beak_jut# := turn_knob(0v#, 0.50v#, 0.45v#, 1/6); beak# := serifness * 3.50v#; cap_vair# := vair# := turn_knob(1.00v#, 0.40v#, 0.40v#, 1); notch_cut# := 1.25v#; bar# := cap_slab# := slab# := cap_bar# := cap_band# := turn_knob(1.00v#, 0.55v#, 0.55v#, 9/10); cap_notch_cut# := 1.25v#; serif_drop# := turn_knob(0v#, 0.20v#, 0.20v#, 1/2); stem_corr# := turn_knob(0v#, 0.05v#, 0.05v#, 5/3); vair_corr# := turn_knob(0v#, 0.05v#, 0.05v#, 5/6); apex_corr# := 0v#; % size of pens crisp# := min(vair#, (monospaceness*serifness) [italicness * 0.40v#, 0.88stem#]); tiny# := min(vair#, (monospaceness*serifness) [0.40v# * weight, 0.88stem#]); fine# := min(vair#, (monospaceness*serifness) [0.35v# * 2/3[1,weight], 0.84stem#]); thin_join# := min(vair#, stress[0.82stem#, 0.35v# * 2/3[1,weight] ]); % overshoots o# := turn_knob(0.2v#, 0.4v#, 0.4v#, (-5/6)); apex_o# := turn_knob(0.15v#, 0.4v#, 0.4v#, (-5/6)); % misc fudge := stress[0.81, 1]; math_spread := max(0, weight - 2 + stress); if superness = 0: superness := 1/sqrt2 if weight > 1: * 1/20[1,weight] fi; fi superpull := 1/6 * 1/20[1,weight]; beak_darkness := stress * serifness * 11/30 * 1/6[1,weight]; ligs := if monospaceness>0: 0 elseif designsize > 5.5pt#: 2 else: 1 fi; square_dots := stress < 0.5; hefty := stress < 0.5; serifs := serifness > 0; monospace := monospaceness > 0; variant_g := false; low_asterisk := monospaceness > 0; math_fitting := false; if hratio < 1: scantokens "input cmchar"; % can't use input direct because cmchar is outer dontwant "Per cent sign"; % doesn't work for hratio < 1 fi string driver; if italicness > 0: driver = "textit"; else: driver = "roman"; fi scantokens ("input " & driver); % What can I say?