From be9804f8347b5e8c9394136e64851a458ac1d09d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 19 Jan 2005 08:03:46 +0000 Subject: [PATCH] * mf/feta-accordion.mf, mf/feta-klef.mf, mf/feta-pendaal.mf, mf/feta-schrift.mf: s/p/pat/ if a path variable. * mf/feta-autometric.mf (set_char_box): Add code which emits specials for mf2pt1 if run with metapost. (to_bp): New macro for mf2pt1. --- ChangeLog | 13 ++- mf/feta-accordion.mf | 29 ++++--- mf/feta-autometric.mf | 189 +++++++++++++++++++++++++++++++----------- mf/feta-klef.mf | 84 +++++++++---------- mf/feta-pendaal.mf | 32 +++---- mf/feta-schrift.mf | 22 ++--- 6 files changed, 232 insertions(+), 137 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ef093036b..ad762f4030 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-01-19 Werner Lemberg + + * mf/feta-accordion.mf, mf/feta-klef.mf, mf/feta-pendaal.mf, + mf/feta-schrift.mf: s/p/pat/ if a path variable. + + * mf/feta-autometric.mf (set_char_box): Add code which emits + specials for mf2pt1 if run with metapost. + (to_bp): New macro for mf2pt1. + 2005-01-18 Graham Percival * Documentation/user/changing-defaults: added info on @@ -181,10 +190,6 @@ Make it work with `filldraw' (but only circular pens). (hfloor, vfloor, hceiling, vceiling): New macros. - * mf/feta-params.mf (to_bp): New macro for mf2pt1. - (set_char_box): Updated. - Add code which emits specials for mf2pt1 if run with metapost. - * mf/feta-accordion.mf ("accDiscant", "accFreebase", "accStdbase"): Use `draw' again in mf mode to have good pixel dropout control. Fix intersection points of horizontal lines with circle. diff --git a/mf/feta-accordion.mf b/mf/feta-accordion.mf index e362826faa..6581390a13 100644 --- a/mf/feta-accordion.mf +++ b/mf/feta-accordion.mf @@ -16,8 +16,8 @@ define_pixels (accreg_dot_size, accreg_linethickness, accreg_lh); fet_beginchar ("accDiscant", "accDiscant") - save r, p, lh, lt; - path p; + save r, pat, lh, lt; + path pat; r# = 3/2 accreg_lh#; define_pixels (r); @@ -61,15 +61,15 @@ fet_beginchar ("accDiscant", "accDiscant") .. cycle; fi; - p := z4{right} - .. z1{up} - .. {left}z2; + pat := z4{right} + .. z1{up} + .. {left}z2; pickup penrazor scaled lt rotated 90; - top z5 = p intersectionpoint ((0, lh + lt) -- (w, lh + lt)); + top z5 = pat intersectionpoint ((0, lh + lt) -- (w, lh + lt)); z6 = z5 xscaled -1; - bot z7 = p intersectionpoint ((0, 2 lh) -- (w, 2 lh)); + bot z7 = pat intersectionpoint ((0, 2 lh) -- (w, 2 lh)); z8 = z7 xscaled -1; labels (5, 6, 7, 8); @@ -95,8 +95,7 @@ fet_endchar; fet_beginchar ("accFreebase", "accFreebase") - save r, p, lh, lt; - path p; + save r, lh, lt; r# = accreg_lh#; define_pixels (r); @@ -149,7 +148,7 @@ fet_endchar; fet_beginchar ("accStdbase", "accStdbase") save r, p, lh, lt; - path p; + path pat; r# = 2 accreg_lh#; define_pixels (r); @@ -193,15 +192,15 @@ fet_beginchar ("accStdbase", "accStdbase") .. cycle; fi; - p := z4{right} - .. z1{up} - .. {left}z2; + pat := z4{right} + .. z1{up} + .. {left}z2; pickup penrazor scaled lt rotated 90; - top z5 = p intersectionpoint ((0, lh + lt) -- (w, lh + lt)); + top z5 = pat intersectionpoint ((0, lh + lt) -- (w, lh + lt)); z6 = z5 xscaled -1; - bot z7 = p intersectionpoint ((0, 3 lh) -- (w, 3 lh)); + bot z7 = pat intersectionpoint ((0, 3 lh) -- (w, 3 lh)); z8 = z7 xscaled -1; labels (5, 6, 7, 8); diff --git a/mf/feta-autometric.mf b/mf/feta-autometric.mf index 3279ff1b29..77b551e30c 100644 --- a/mf/feta-autometric.mf +++ b/mf/feta-autometric.mf @@ -1,69 +1,106 @@ -% +% % autometric.mf -- administrative MF routines -% +% % source file of the Feta (not an acronym for Font-En-Tja) % pretty-but-neat music font -% +% % (c) 1997--2004 Han-Wen Nienhuys % Jan Nieuwenhuizen -% +% % these macros help create ascii logging output % to automate generation of lily tables and tex backend % The output should be parsed by the mf-to-table script + message "******************************************************"; -message "Using feta Autometric macros. "; -message "Do not worry about the @ signs in the output, they are not errors. "; +message "Using feta Autometric macros."; +message "Do not worry about the @ signs in the output, they are not errors."; message "******************************************************"; +message ""; + % font or database? -def fet_beginfont(expr name,size,encod) = - font_identifier:=name&decimal size; +def fet_beginfont (expr name, size, encod) = + font_identifier := name & decimal size; font_size size; font_coding_scheme encod; - message "@{font@:GNU@:LilyPond@:"&name&"@:"&decimal size&"@:"&encod&"@}"; + message "@{font@:GNU@:LilyPond@:" & name + & "@:" & decimal size + & "@:" & encod + & "@}"; message ""; - enddef; +enddef; + def fet_endfont = message "@{tnof@}"; - enddef; +enddef; + % group or table? -def fet_begingroup(expr name) = - message "@{group@:"&name&"@}"; +def fet_begingroup (expr name) = + message "@{group@:" & name + & "@}"; message ""; - begingroup +begingroup enddef; -def fet_endgroup(expr name) = - endgroup; - message "@{puorg@:"&name&"@}"; + +def fet_endgroup (expr name) = +endgroup; + message "@{puorg@:" & name + & "@}"; message ""; enddef; + def autometric_parameter (expr name, value) = - message "@{parameter@:"&name&"@:"&decimal value&"@}"; + message "@{parameter@:" & name + & "@:" & decimal value + & "@}"; enddef; def autometric_output_char= - message "@{char@:"&charnamestr&"@:"&decimal charcode&"@:"&decimal charbp&"@:"&decimal charwd&"@:"&decimal chardp&"@:"&decimal charht&"@:"&decimal charwx&"@:"&decimal charwy&"@:"&idstr&"@}"; + message "@{char@:" & charnamestr + & "@:" & decimal charcode + & "@:" & decimal charbp + & "@:" & decimal charwd + & "@:" & decimal chardp + & "@:" & decimal charht + & "@:" & decimal charwx + & "@:" & decimal charwy + & "@:" & idstr + & "@}"; +enddef; + + +def hround_pixels (expr sharped) = + hround (sharped * hppp) enddef; -def hround_pixels(expr sharped) = hround(sharped * hppp) enddef; -def vround_pixels(expr sharped) = vround(sharped * vppp) enddef; -def tand(expr alpha) = - (sind alpha/cosd alpha) - enddef; +def vround_pixels (expr sharped) = + vround (sharped * vppp) +enddef; + -%breapth, width, depth, height +def tand (expr alpha) = + (sind alpha / cosd alpha) +enddef; + + +def to_bp (expr num) = + decimal (num * bp_per_pixel) +enddef; + + +% breapth, width, depth, height % breapth x-depth -def set_char_box(expr b_sharp, w_sharp, d_sharp,h_sharp) = +def set_char_box (expr b_sharp, w_sharp, d_sharp, h_sharp) = save scharbp, scharht, scharwd, schardp; - % some paranoia if someone calls set_char_box(charwd, charbp, .. ) + % some paranoia if someone calls set_char_box (charwd, charbp, ...) scharbp := b_sharp; scharht := h_sharp; schardp := d_sharp; @@ -74,17 +111,59 @@ def set_char_box(expr b_sharp, w_sharp, d_sharp,h_sharp) = chardp := schardp; charwd := scharwd; - w := hround(w_sharp *hppp); - b := hround(b_sharp *hppp); - h := hround(h_sharp *vppp); - d := hround(d_sharp *vppp); + w := hround (w_sharp * hppp); + b := hround (b_sharp * hppp); + h := vround (h_sharp * vppp); + d := vround (d_sharp * vppp); charwx := charwd; charwy := 0; + + % additions for mf2pt1 + if known bp_per_pixel: + special "% MF2PT1: bbox " + & to_bp (-b) & " " + & to_bp (-d) & " " + & to_bp (w) & " " + & to_bp (h); + special "% MF2PT1: font_size " & decimal designsize; + special "% MF2PT1: font_slant " & decimal font_slant_; + + for fvar = "font_identifier", + "font_coding_scheme", + "font_version", + "font_comment", + "font_family", + "font_weight", + "font_unique_id", + "font_name": + if known scantokens (fvar & "_"): + special "% MF2PT1: " + & fvar & " " + & scantokens (fvar & "_"); + fi; + endfor; + + for fvar = "font_underline_position", + "font_underline_thickness": + if known scantokens (fvar & "_"): + special "% MF2PT1: " + & fvar & " " + & scantokens ("decimal " & fvar & "_"); + fi; + endfor; + + special "% MF2PT1: font_fixed_pitch " + & (if font_fixed_pitch_: "1" else: "0" fi); + + % this must come after the `font_size' special + special "% MF2PT1: charwd " & decimal charwd; + fi; enddef; -def no_dimen_beginchar(expr c) = - begingroup + +def no_dimen_beginchar (expr c) = +begingroup charcode := if known c: byte c else: 0; fi; charic := 0; clearxy; @@ -97,46 +176,58 @@ enddef; % % we leave the ctrl characters alone. % -code:=32; +code := 32; + % starts just as plain mf's beginchar: -% charcode, +% charcode, % and then adds: % charname see below % id index in lily's table -% the dims are uninitialised; you should use set_char_box manually. -def fet_beginchar(expr name, id_lit) = - save idstr, charnamestr; +% The dimensions are uninitialised; you should use set_char_box manually. +def fet_beginchar (expr name, id_lit) = + save idstr, charnamestr; save charbp; - save w,b,h,d; + save w, b, h, d; save charwx, charwy; string idstr, charnamestr; charnamestr := name; idstr := id_lit; - no_dimen_beginchar(incr code) name; - enddef; + no_dimen_beginchar (incr code) name; +enddef; + +def makebox_with_breapth (text r) = + for y = -d, 0, h: + r ((-b, y), (w, y)); + endfor; -def makebox_with_breapth(text r) = - for y = -d, 0, h: r((-b, y),(w,y)); endfor - for x = -b, 0, w: r((x, -d),(x, h)); endfor + for x = -b, 0, w: + r ( (x, -d), (x, h)); + endfor; enddef; + % -% override plain endchar. We want a different box. +% override plain endchar. We want a different box. % def breapth_endchar = scantokens extra_endchar; - if proofing > 0: makebox_with_breapth(proofrule); fi - chardx := (w + b); %what the hack is chardx + + if proofing > 0: + makebox_with_breapth (proofrule); + fi; + + chardx := (w + b); % what the heck is chardx shipit; - endgroup +endgroup enddef; + def fet_endchar= autometric_output_char; breapth_endchar; - enddef; +enddef; diff --git a/mf/feta-klef.mf b/mf/feta-klef.mf index f2580490d6..99ae048dd9 100644 --- a/mf/feta-klef.mf +++ b/mf/feta-klef.mf @@ -72,23 +72,23 @@ def draw_c_clef (expr reduction) = save t; t = 0.833; - save p; - path p; - - p = z5l{curl 1} - .. z4l{up} - .. z4r{down} - .. z3r{right} - ..tension t.. z2r{up} - ..tension t.. flare_path (top z1l, 180, 90, - hair, hfloor (norm - 1/2 hair), -1) - ..tension t.. z2l{down} - .. z3l{left} - .. z6 - .. z5r{down}; - - filldraw p shifted (0, feta_shift) - -- reverse p yscaled -1 shifted (0, -feta_eps) + save pat; + path pat; + + pat = z5l{curl 1} + .. z4l{up} + .. z4r{down} + .. z3r{right} + ..tension t.. z2r{up} + ..tension t.. flare_path (top z1l, 180, 90, + hair, hfloor (norm - 1/2 hair), -1) + ..tension t.. z2l{down} + .. z3l{left} + .. z6 + .. z5r{down}; + + filldraw pat shifted (0, feta_shift) + -- reverse pat yscaled -1 shifted (0, -feta_eps) -- cycle; penlabels (1, 2, 3, 4, 5, 6); @@ -125,10 +125,10 @@ def new_bulb (expr start_point, start_angle, big_radius, bulb_radius, flare, direction, turning_dir) = begingroup; - save p, before, after; + save pat, before, after; save center; save u, v; - path p, before, after; + path pat, before, after; pair center; clearxy; @@ -151,16 +151,16 @@ begingroup; .. end_point{dir (end_angle)}; (u, v) = before intersectiontimes after; - p := start_point{dir (start_angle)} - .. outer_tangent_point{dir (-turning_dir * 90)} - ..tension 0.97.. subpath (0, u) of before - .. subpath (v, infinity) of after; + pat := start_point{dir (start_angle)} + .. outer_tangent_point{dir (-turning_dir * 90)} + ..tension 0.97.. subpath (0, u) of before + .. subpath (v, infinity) of after; if direction = 0: - p := reverse p' + pat := reverse pat; fi -p +pat endgroup enddef; @@ -295,8 +295,8 @@ def draw_gclef (expr reduction) = save breapth_factor, inner_thick_end, thinness, thickness, thinnib; save start_angle, inner_start_angle, thinness; save upward_swoosh_angle, bot_angle; - save p; - path p; + save pat; + path pat; pair downstroke_dir, center; reduced_ss# = staff_space# * reduction; @@ -393,17 +393,17 @@ def draw_gclef (expr reduction) = -- z1l ..tension 0.85.. cycle; - p := z10{down} - .. z6 - .. z11{dir (start_angle)}; + pat := z10{down} + .. z6 + .. z11{dir (start_angle)}; - penpos6 (thinnib, angle (direction 1 of p) + 90); + penpos6 (thinnib, angle (direction 1 of pat) + 90); % two auxiliary points to simulate `draw' with `penstroke' - z10' = point 0.5 of p; - penpos10' (thinnib, angle (direction 0.5 of p) + 90); - z11' = point 1.5 of p; - penpos11' (thinnib, angle (direction 1.5 of p) + 90); + z10' = point 0.5 of pat; + penpos10' (thinnib, angle (direction 0.5 of pat) + 90); + z11' = point 1.5 of pat; + penpos11' (thinnib, angle (direction 1.5 of pat) + 90); penstroke z9e .. z10e{down} @@ -527,9 +527,9 @@ enddef; def draw_tab_A (expr pos, siz, slant) = begingroup; - save vx, vy, p; + save vx, vy, pat; pair vx, vy; - path p; + path pat; clearxy; @@ -554,12 +554,12 @@ begingroup; penpos8 (.75 penh, -70); z8r = (xpart (pos + siz), y7r + .075 ypart (siz)); - p := z2 - .. z3 - .. z4; + pat := z2 + .. z3 + .. z4; - penpos10 (penh, angle (direction 1.2 of p) - 180); - z10 = point 1.2 of p; + penpos10 (penh, angle (direction 1.2 of pat) - 180); + z10 = point 1.2 of pat; penpos11 (.9 penh, -90); z11 = .4 [z10, z6] - 0.05 vy; penpos12 (.75 penh, -75); diff --git a/mf/feta-pendaal.mf b/mf/feta-pendaal.mf index 2a31d293f1..af8e842b46 100644 --- a/mf/feta-pendaal.mf +++ b/mf/feta-pendaal.mf @@ -31,7 +31,7 @@ define_pixels (pedalh, pedalbh); fet_beginchar ("Pedal asterisk", "*"); save bulb, p, radius, thin, inner_r; - path p; + path pat; set_char_box (0, 7/9 pedalh#, 0, pedalh#); @@ -61,24 +61,24 @@ fet_beginchar ("Pedal asterisk", "*"); penlabels (0, 1, 2, 3, 4); - p := z3r{up} - .. z1l{up} - .. z2l{down} - .. z3l{down} - .. z4l{dir (180 + 360/16)}; + pat := z3r{up} + .. z1l{up} + .. z2l{down} + .. z3l{down} + .. z4l{dir (180 + 360/16)}; for i = 1 upto 7: - p := p - .. ((z3r{up} - .. z1l{up} - .. z2l{down} - .. z3l{down} - .. z4l{dir (180 + 360/16)}) rotatedaround (z0, - 360/8 i)); + pat := pat + .. ((z3r{up} + .. z1l{up} + .. z2l{down} + .. z3l{down} + .. z4l{dir (180 + 360/16)}) + rotatedaround (z0, 360/8 i)); endfor; - p := p - .. cycle; - fill p; + pat := pat + .. cycle; + fill pat; pickup pencircle scaled (7/8 inner_r); diff --git a/mf/feta-schrift.mf b/mf/feta-schrift.mf index 6e36b003a4..60470d5a96 100644 --- a/mf/feta-schrift.mf +++ b/mf/feta-schrift.mf @@ -1445,10 +1445,10 @@ input feta-slag; fet_beginchar ("Caesura", "caesura"); save slant, space_between, clearance; - save alpha, p; + save alpha, pat; save botthick, topthick; save krom; - path p; + path pat; botthick = 1.5 linethickness; topthick = 2.5 linethickness; @@ -1485,15 +1485,15 @@ fet_beginchar ("Caesura", "caesura"); penlabels (1, 2, 3, 4); - p := z3r{(z1r - z1l)} - .. z4r{z2r-z2l} - .. z2r{z4l-z4r} - .. z4l{z2l-z2r} - .. z3l{z1l-z1r} - .. z1l{z3r-z3l} - .. cycle; - fill p; - fill p shifted (space_between, 0); + pat := z3r{(z1r - z1l)} + .. z4r{z2r-z2l} + .. z2r{z4l-z4r} + .. z4l{z2l-z2r} + .. z3l{z1l-z1r} + .. z1l{z3r-z3l} + .. cycle; + fill pat; + fill pat shifted (space_between, 0); fet_endchar; -- 2.39.5