X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mf%2Ffeta-autometric.mf;h=9679d3050a6bdea3dcaca18b5ec0e50a5429c99e;hb=5b4b0d6e9a197e8f9eb085b7c2ad78b8be3e5cfc;hp=27703e2686242f96df83187298b49af76a504a1d;hpb=9efbad2d9487a05b04423e7e9f062968e8f8eaf4;p=lilypond.git diff --git a/mf/feta-autometric.mf b/mf/feta-autometric.mf index 27703e2686..9679d3050a 100644 --- a/mf/feta-autometric.mf +++ b/mf/feta-autometric.mf @@ -1,58 +1,112 @@ -% +% % autometric.mf -- administrative MF routines -% -% source file of the Feta (Font-En-Tja) pretty-but-neat music font -% -% (c) 1997, 1998 Han-Wen Nienhuys +% +% source file of the Feta (not an acronym for Font-En-Tja) +% pretty-but-neat music font +% +% (c) 1997--2008 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 "order of messages: "; +message " NAME/CODE/BP/WD/DP/HT/WX/WY"; +message "******************************************************"; +message ""; + + % font or database? -def fet_beginfont(expr name,size) = - font_identifier:=name&decimal size; +def fet_beginfont (expr name, size, encod) = + font_identifier := name & decimal size; font_size size; - message "@{font@:"&name&"@:"&decimal size&"@}"; + font_coding_scheme "asis"; + message "@{font@:GNU@:LilyPond@:" & name + & "@:" & decimal size + & "@:" & encod + & "@}"; message ""; - enddef; +enddef; + + +def fet_endfont = + message "@{tnof@}"; +enddef; -def fet_endfont(expr name) = - message "@{tnof@:"&name&"@}"; - message ""; - enddef; % group or table? -def fet_begingroup(expr name) = - message "@{group@:"&name&"@}"; +def fet_begingroup (expr name) = +begingroup; + save feta_group; + string feta_group; + + feta_group := name; + + message "@{group@:" & feta_group + & "@}"; message ""; - begingroup enddef; -def fet_endgroup(expr name) = - endgroup; - message "@{puorg@:"&name&"@}"; + +def fet_endgroup (expr name) = + message "@{puorg@:" & name + & "@}"; message ""; +endgroup; enddef; -def autometric_output_char= - message "@{char@:"&charnamestr&"@:"&decimal charcode&"@:"&decimal charbp&"@:"&decimal charwd&"@:"&decimal chardp&"@:"&decimal charht&"@:"&idstr&"@:"&texstr&"@}"; + +def autometric_parameter (expr name, value) = + message "@{parameter@:" & name + & "@:" & decimal value + & "@}"; 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 autometric_output_char = + message "@{char@:" & charnamestr + & "@:" & decimal charcode + & "@:" & decimal charbp + & "@:" & decimal charwd + & "@:" & decimal chardp + & "@:" & decimal charht + & "@:" & decimal charwx + & "@:" & decimal charwy + & "@:" & idstr + & "@}"; +enddef; -%breapth, width, depth, height + +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 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; @@ -63,14 +117,65 @@ 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 (`bbox' is called `glyph_dimensions' starting + % with version 2.4.2) + if known bp_per_pixel: + special "% MF2PT1: bbox " + & to_bp (-b) & " " + & to_bp (-d) & " " + & to_bp (w) & " " + & to_bp (h); + special "% MF2PT1: glyph_dimensions " + & 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; @@ -79,46 +184,72 @@ def no_dimen_beginchar(expr c) = scantokens extra_beginchar; enddef; -code:=-1; + +% +% we leave the ctrl characters alone. +% +code := 32; + % starts just as plain mf's beginchar: -% charcode, +% charcode, % and then adds: % charname see below % id index in lily's table -% texstr name of tex macro in lily's table and tex backend -% the dims are uninitialised; you should use set_char_box manually. -def fet_beginchar(expr name, id_lit, texstr_lit) = - save texstr, 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; - string texstr, idstr, charnamestr; - texstr := texstr_lit; + save w, b, h, d; + save charwx, charwy; + + string idstr, charnamestr; charnamestr := name; idstr := id_lit; - no_dimen_beginchar(incr code) name; - enddef; + % addition for mf2pt1 + if known bp_per_pixel: + if known feta_group: + special "% MF2PT1: glyph_name " + & feta_group & "." & idstr; + else: + special "% MF2PT1: glyph_name " & idstr; + fi; + fi; + + 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 := 10*(w + b); + + if proofing > 0: + makebox_with_breapth (proofrule); + fi; + + chardx := (w + b); % what the heck is chardx shipit; - endgroup +endgroup; enddef; -def fet_endchar= + +def fet_endchar = autometric_output_char; breapth_endchar; - enddef; +enddef;