From: Carl Sorensen Date: Sat, 25 Jun 2011 03:38:00 +0000 (-0600) Subject: Separate flags into their own sub-font. X-Git-Tag: release/2.15.5-1~15 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=15f4f4c7c1d0e8c2f904981586145f478a31b65c;p=lilypond.git Separate flags into their own sub-font. When we have lots of flag sizes, there will be lots of glyphs. With a maximum of 256-32 = 234 glyphs per sub font, we wanted to have flags in their own sub font. But flags depend on notehead widths, so they needed to be in the same subfont as the noteheads. This patch moves the notehead parameters from feta-noteheads.mf to feta-params.mf, so the basic notehead parameters are available to all subfonts. Also, AFAICS, bigcheese.pe.in is no longer used -- it doesn't show up anywhere in a git grep, except as having been renamed. It doesn't show up in GNUmakefile. So I deleted it. --- diff --git a/mf/GNUmakefile b/mf/GNUmakefile index c47b2697d3..1fa0a73790 100644 --- a/mf/GNUmakefile +++ b/mf/GNUmakefile @@ -17,6 +17,7 @@ FETA_MF_FILES = $(call src-wildcard,feta[0-9]*.mf) \ $(call src-wildcard,feta-braces-[a-z].mf) \ $(call src-wildcard,feta-alphabet*[0-9].mf) \ $(call src-wildcard,feta-notehead*[0-9].mf) \ + $(call src-wildcard,feta-flags*[0-9].mf) \ $(call src-wildcard,parmesan[0-9]*.mf) STAFF_SIZES = 11 13 14 16 18 20 23 26 @@ -65,6 +66,7 @@ $(outdir)/emmentaler-%.otf\ $(outdir)/emmentaler-%.woff: $(outdir)/emmentaler-%.pe \ $(outdir)/feta%.pfb \ $(outdir)/feta-noteheads%.pfb \ + $(outdir)/feta-flags%.pfb \ $(outdir)/feta-alphabet%.pfb \ $(outdir)/parmesan%.pfb \ $(outdir)/feta%.otf-table \ @@ -83,40 +85,49 @@ $(outdir)/%.pfb: $(outdir)/%.log $(outdir)/%.otf-table: $(outdir)/%.lisp cat $< $(if $(findstring brace,$<),,$(subst feta,parmesan,$<)) \ $(if $(findstring brace,$<),,$(subst feta,feta-noteheads,$<)) \ + $(if $(findstring brace,$<),,$(subst feta,feta-flags,$<)) \ $(if $(findstring brace,$<),,$(subst feta,feta-alphabet,$<)) > $@ ## ugh -- we want this to prevent failing -j2 compiles. $(outdir)/feta26.otf-table: $(outdir)/feta26.lisp \ $(outdir)/feta-noteheads26.lisp \ + $(outdir)/feta-flags26.lisp \ $(outdir)/parmesan26.lisp \ $(outdir)/feta-alphabet26.lisp $(outdir)/feta23.otf-table: $(outdir)/feta23.lisp \ $(outdir)/feta-noteheads23.lisp \ + $(outdir)/feta-flags23.lisp \ $(outdir)/parmesan23.lisp \ $(outdir)/feta-alphabet23.lisp $(outdir)/feta20.otf-table: $(outdir)/feta20.lisp \ $(outdir)/feta-noteheads20.lisp \ + $(outdir)/feta-flags20.lisp \ $(outdir)/parmesan20.lisp \ $(outdir)/feta-alphabet20.lisp $(outdir)/feta18.otf-table: $(outdir)/feta18.lisp \ $(outdir)/feta-noteheads18.lisp \ + $(outdir)/feta-flags18.lisp \ $(outdir)/parmesan18.lisp \ $(outdir)/feta-alphabet18.lisp $(outdir)/feta16.otf-table: $(outdir)/feta16.lisp \ $(outdir)/feta-noteheads16.lisp \ + $(outdir)/feta-flags16.lisp \ $(outdir)/parmesan16.lisp \ $(outdir)/feta-alphabet16.lisp $(outdir)/feta14.otf-table: $(outdir)/feta14.lisp \ $(outdir)/feta-noteheads14.lisp \ + $(outdir)/feta-flags14.lisp \ $(outdir)/parmesan14.lisp \ $(outdir)/feta-alphabet14.lisp $(outdir)/feta13.otf-table: $(outdir)/feta13.lisp \ $(outdir)/feta-noteheads13.lisp \ + $(outdir)/feta-flags13.lisp \ $(outdir)/parmesan13.lisp \ $(outdir)/feta-alphabet13.lisp $(outdir)/feta11.otf-table: $(outdir)/feta11.lisp \ $(outdir)/feta-noteheads11.lisp \ + $(outdir)/feta-flags11.lisp \ $(outdir)/parmesan11.lisp \ $(outdir)/feta-alphabet11.lisp diff --git a/mf/bigcheese.pe.in b/mf/bigcheese.pe.in deleted file mode 100644 index e1d1843ba4..0000000000 --- a/mf/bigcheese.pe.in +++ /dev/null @@ -1,45 +0,0 @@ -#!@FONTFORGE@ - - - -New(); - -# Separate Feta versioning? -# Naming: * expose LilyPond20/LilyPond rather than bigcheese -# * using 20 as Weight works for gnome-font-select widget: gfs -SetFontNames("bigcheese20", "LilyPond", "LilyPond BigCheese 20", "20", "GNU GPL", "@TOPLEVEL_VERSION@"); - -MergeFonts("feta20.pfa"); -MergeFonts("feta-noteheads20.pfa"); -MergeFonts("parmesan20.pfa"); - -# load nummer/din after setting PUA. -i = 0; -while (i < CharCnt()) - Select(i); -# crashes fontforge, use PUA for now -- jcn -# SetUnicodeValue(i + 0xF0000, 0); -/* -PRIVATE AREA - In the BMP, the range 0xe000 to 0xf8ff will never be assigned to any - characters by the standard and is reserved for private usage. For the - Linux community, this private area has been subdivided further into the - range 0xe000 to 0xefff which can be used individually by any end-user - and the Linux zone in the range 0xf000 to 0xf8ff where extensions are - coordinated among all Linux users. The registry of the characters - assigned to the Linux zone is currently maintained by H. Peter Anvin - . -*/ - SetUnicodeValue(i + 0xE000, 0); - ++i; -endloop - - -MergeFonts("feta-nummer10.pfa"); -MergeFonts("feta-din14.pfa"); -MergeKern("feta-din14.tfm"); - -LoadTableFromFile("LILC", "feta20.otf-table") - -Generate("bigcheese20.otf"); -Generate("bigcheese20.cff"); diff --git a/mf/feta-flags-generic.mf b/mf/feta-flags-generic.mf new file mode 100644 index 0000000000..173125bd2f --- /dev/null +++ b/mf/feta-flags-generic.mf @@ -0,0 +1,47 @@ +% Feta (not the Font-En-Tja) music font -- generic stuff: include lots of files, but don't +% This file is part of LilyPond, the GNU music typesetter. +% +% Copyright (C) 1997--2011 Han-Wen Nienhuys +% +% +% LilyPond is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% LilyPond is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with LilyPond. If not, see . + + +if test = -1: + mode := smoke; +fi + +staffsize# := design_size * pt#; + +mode_setup; + +input feta-macros; + +input feta-params; + +font_x_height staff_space#; + +fet_beginfont ("feta", design_size, "fetaMusic"); + +input feta-flags; + +autometric_parameter ("staffsize", staffsize#); +autometric_parameter ("stafflinethickness", stafflinethickness#); +autometric_parameter ("staff_space", staff_space#); +autometric_parameter ("linethickness", linethickness#); +autometric_parameter ("black_notehead_width", black_notehead_width#); +autometric_parameter ("ledgerlinethickness", ledgerlinethickness#); +autometric_parameter ("blot_diameter", blot_diameter#); + +fet_endfont; diff --git a/mf/feta-flags11.mf b/mf/feta-flags11.mf new file mode 100644 index 0000000000..30cd7f0976 --- /dev/null +++ b/mf/feta-flags11.mf @@ -0,0 +1,13 @@ +% feta-flags11.mf +% part of LilyPond's pretty-but-neat music font + +input feta-autometric; + +design_size := 11.22; +test := 0; + + +input feta-flags-generic; + +end. + diff --git a/mf/feta-flags13.mf b/mf/feta-flags13.mf new file mode 100644 index 0000000000..3210b1abc1 --- /dev/null +++ b/mf/feta-flags13.mf @@ -0,0 +1,13 @@ +% feta-flags13.mf +% part of LilyPond's pretty-but-neat music font + +input feta-autometric; + +design_size := 12.60; +test := 0; + + +input feta-flags-generic; + +end. + diff --git a/mf/feta-flags14.mf b/mf/feta-flags14.mf new file mode 100644 index 0000000000..9a5449cc5d --- /dev/null +++ b/mf/feta-flags14.mf @@ -0,0 +1,13 @@ +% feta-flags14.mf +% part of LilyPond's pretty-but-neat music font + +input feta-autometric; + +design_size := 14.14; +test := 0; + + +input feta-flags-generic; + +end. + diff --git a/mf/feta-flags16.mf b/mf/feta-flags16.mf new file mode 100644 index 0000000000..d02993736a --- /dev/null +++ b/mf/feta-flags16.mf @@ -0,0 +1,13 @@ +% feta-flags16.mf +% part of LilyPond's pretty-but-neat music font + +input feta-autometric; + +design_size := 15.87; +test := 0; + + +input feta-flags-generic; + +end. + diff --git a/mf/feta-flags18.mf b/mf/feta-flags18.mf new file mode 100644 index 0000000000..dcaefd440d --- /dev/null +++ b/mf/feta-flags18.mf @@ -0,0 +1,13 @@ +% feta-flags18.mf +% part of LilyPond's pretty-but-neat music font + +input feta-autometric; + +design_size := 17.82; +test := 0; + + +input feta-flags-generic; + +end. + diff --git a/mf/feta-flags20.mf b/mf/feta-flags20.mf new file mode 100644 index 0000000000..b7b834ecc4 --- /dev/null +++ b/mf/feta-flags20.mf @@ -0,0 +1,13 @@ +% feta-flags20.mf +% part of LilyPond's pretty-but-neat music font + +input feta-autometric; + +design_size := 20; +test := 0; + + +input feta-flags-generic; + +end. + diff --git a/mf/feta-flags23.mf b/mf/feta-flags23.mf new file mode 100644 index 0000000000..dcd640c8a9 --- /dev/null +++ b/mf/feta-flags23.mf @@ -0,0 +1,13 @@ +% feta-flags23.mf +% part of LilyPond's pretty-but-neat music font + +input feta-autometric; + +design_size := 22.45; +test := 0; + + +input feta-flags-generic; + +end. + diff --git a/mf/feta-flags26.mf b/mf/feta-flags26.mf new file mode 100644 index 0000000000..b2a1fe616f --- /dev/null +++ b/mf/feta-flags26.mf @@ -0,0 +1,13 @@ +% feta-flags26.mf +% part of LilyPond's pretty-but-neat music font + +input feta-autometric; + +design_size := 25.20; +test := 0; + + +input feta-flags-generic; + +end. + diff --git a/mf/feta-generic.mf b/mf/feta-generic.mf index f78895d0f2..6c00aa5784 100644 --- a/mf/feta-generic.mf +++ b/mf/feta-generic.mf @@ -32,10 +32,6 @@ input feta-params; font_x_height staff_space#; -%% this is a fallback so we can run the font without including feta-noteheads. -black_notehead_width# := 1.0 staff_space#; - - fet_beginfont ("feta", design_size, "fetaMusic"); if test = 0: diff --git a/mf/feta-noteheads-generic.mf b/mf/feta-noteheads-generic.mf index 4a952ed407..b63158bbe8 100644 --- a/mf/feta-noteheads-generic.mf +++ b/mf/feta-noteheads-generic.mf @@ -32,19 +32,9 @@ input feta-params; font_x_height staff_space#; -%% this is a fallback so we can run the font without -%% including feta-noteheads. -black_notehead_width# := 1.0 staff_space#; - - fet_beginfont ("feta", design_size, "fetaMusic"); -if test = 0: - input feta-noteheads; - input feta-flags; -else: - input feta-noteheads-test-generic.mf; -fi +input feta-noteheads; autometric_parameter ("staffsize", staffsize#); autometric_parameter ("stafflinethickness", stafflinethickness#); diff --git a/mf/feta-noteheads-test-generic.mf b/mf/feta-noteheads-test-generic.mf deleted file mode 100644 index 0e381bd4b5..0000000000 --- a/mf/feta-noteheads-test-generic.mf +++ /dev/null @@ -1,7 +0,0 @@ -% -% test stuff. -% in a separate file to avoid tainting non-test font files for testing. -% - -input feta-noteheads; -%input feta-flags; diff --git a/mf/feta-noteheads.mf b/mf/feta-noteheads.mf index 54a51f622a..c725220721 100644 --- a/mf/feta-noteheads.mf +++ b/mf/feta-noteheads.mf @@ -36,94 +36,20 @@ picture remember_pic; % NOTE HEAD VARIABLES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -save black_notehead_width, noteheight; -save half_notehead_width, whole_notehead_width, slash_thick; -save slash_slope, overdone_heads, solfa_noteheight; +save half_notehead_width, whole_notehead_width; +save solfa_noteheight; -numeric noteheight; -numeric slash_thick; -numeric black_notehead_width; numeric whole_notehead_width; numeric half_notehead_width; - fet_begingroup ("noteheads"); -% Slope of slash. From scm/grob-description.scm. How to auto-copy? -slash_slope := 1.7; - -% Thickness of slash lines. Quarter notes get 1.5slt width. -slash_thick# := 2/3 * 0.48 staff_space#; - - -% -% Hand-engraved music often has balls extending above and below -% the lines. If you like that, modify overdone heads (unit: -% stafflinethickness). -% -overdone_heads = 0.0; -noteheight# := staff_space# + (1 + overdone_heads) * stafflinethickness#; - - % % solfa heads should not overlap on chords. % solfa_noteheight# := staff_space# - stafflinethickness#; -define_pixels (slash_thick); -define_whole_vertical_pixels (noteheight); - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% SLANT moves both extrema on the long axis (by SLANT * ELLIPTICITY, -% so SLANT = -1, puts the extreme on the long axis next to the short -% axis one). -% - -def draw_outside_ellipse (expr ellipticity, tilt, superness, slant) = - save attachment_y; - save pat; - path pat; - - pat := superellipse ((ellipticity, 0), (-slant * ellipticity, 1.0), - (-ellipticity, 0), (slant * ellipticity, -1.0), - superness); - pat := pat rotated tilt; - - save top_point, right_point; - pair top_point, right_point; - - top_point := directionpoint left of pat; - right_point := directionpoint up of pat; - - save scaling, width; - - scaling# = noteheight# / (2 ypart (top_point)); - width# := 2 xpart (right_point) * scaling#; - define_pixels (scaling, width); - - set_char_box (0, width#, noteheight# / 2, noteheight# / 2); - - d := d - feta_space_shift; - - % attachment Y - charwy := ypart (right_point) * scaling#; - charwx := width#; - - pat := pat scaled scaling shifted (w / 2, .5 (h - d)); - - width := hround width; - - if test_outlines = 1: - draw pat; - else: - fill pat; - fi; -enddef; - - def undraw_inside_ellipse (expr ellipticity, tilt, superness, clearance) = begingroup save pat; @@ -344,10 +270,7 @@ fi; fet_beginchar ("Quarter notehead", "s2"); - % used to have 32. With 31, they are slightly bolder. - draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31, 0.707, 0); - black_notehead_width# := charwd; - + draw_quarter_path; draw_staff (-2, 2, 0); fet_endchar; diff --git a/mf/feta-params.mf b/mf/feta-params.mf index 4d0a5eb4b5..244c262ec3 100644 --- a/mf/feta-params.mf +++ b/mf/feta-params.mf @@ -222,3 +222,89 @@ else: fi; feta_fillpen := savepen; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Notehead width and height are defined here. +% +% +% Slope of slash. From scm/grob-description.scm. How to auto-copy? +slash_slope := 1.7; + +% Thickness of slash lines. Quarter notes get 1.5slt width. +slash_thick# := 2/3 * 0.48 staff_space#; + +% +% Hand-engraved music often has balls extending above and below +% the lines. If you like that, modify overdone heads (unit: +% stafflinethickness). +% +overdone_heads = 0.0; +noteheight# := staff_space# + (1 + overdone_heads) * stafflinethickness#; + +define_pixels (slash_thick); +define_whole_vertical_pixels (noteheight); + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% This is used to draw all elliptical notes; it also sets +% black_notehead_width, so it should be called in any file that +% needs the value of black_notehead_width. +% +% SLANT moves both extrema on the long axis (by SLANT * ELLIPTICITY, +% so SLANT = -1, puts the extreme on the long axis next to the short +% axis one). +% + +def draw_outside_ellipse (expr ellipticity, tilt, superness, slant) = + save attachment_y; + save pat; + path pat; + + pat := superellipse ((ellipticity, 0), (-slant * ellipticity, 1.0), + (-ellipticity, 0), (slant * ellipticity, -1.0), + superness); + pat := pat rotated tilt; + + save top_point, right_point; + pair top_point, right_point; + + top_point := directionpoint left of pat; + right_point := directionpoint up of pat; + + save scaling, width; + + scaling# := noteheight# / (2 ypart (top_point)); + width# := 2 xpart (right_point) * scaling#; + define_pixels (scaling, width); + set_char_box (0, width#, noteheight# / 2, noteheight# / 2); + + d := d - feta_space_shift; + + % attachment Y + charwy := ypart (right_point) * scaling#; + charwx := width#; + + pat := pat scaled scaling shifted (w / 2, .5 (h - d)); + + width := hround width; + + if test_outlines = 1: + draw pat; + else: + fill pat; + fi; +enddef; + + +def draw_quarter_path = + draw_outside_ellipse (1.49 - puff_up_factor / 3.0, 31, 0.707, 0); +enddef; + +test_outlines := 0; +draw_quarter_path; +black_notehead_width# := charwd; + +define_pixels (slash_thick); +define_whole_vertical_pixels (noteheight); + + diff --git a/mf/feta-scripts.mf b/mf/feta-scripts.mf index b3843960c2..d04ed18b7b 100644 --- a/mf/feta-scripts.mf +++ b/mf/feta-scripts.mf @@ -1447,17 +1447,18 @@ enddef; fet_beginchar ("Arpeggio", "arpeggio"); + begingroup; save height, overshoot, width; - height# = staff_space#; - width# = 0.8 height#; - overshoot# = 0.25 staff_space#; + height# := staff_space#; + width# := 0.8 * height#; + overshoot# := 0.25 * staff_space#; define_pixels (height, overshoot, width); - set_char_box (0, width#, 0, height#); draw_arpeggio; penlabels (range 1 thru 9); draw_staff (-2, 2, 0.0); + endgroup; fet_endchar; @@ -1468,7 +1469,8 @@ fet_endchar; % fet_beginchar ("Trill_element", "trill_element"); - save height, overshoot; + begingroup; + save height, overshoot, width; height# = staff_space#; width# = 0.8 height#; overshoot# = 0.25 staff_space#; @@ -1480,6 +1482,7 @@ fet_beginchar ("Trill_element", "trill_element"); currentpicture := currentpicture shifted -(width / 2, height / 2); currentpicture := currentpicture rotated 90; currentpicture := currentpicture shifted (height / 2, width / 2); + endgroup; fet_endchar; diff --git a/mf/parmesan-noteheads.mf b/mf/parmesan-noteheads.mf index 682dc8bc3c..130c3c50d4 100644 --- a/mf/parmesan-noteheads.mf +++ b/mf/parmesan-noteheads.mf @@ -46,6 +46,8 @@ fet_begingroup ("noteheads"); % % TODO: should depth/height include appendages/stems? +save overdone_heads, noteheight; + overdone_heads = 0; noteheight# := staff_space# + (1 + overdone_heads) * stafflinethickness#; define_pixels (noteheight); diff --git a/scripts/build/gen-emmentaler-scripts.py b/scripts/build/gen-emmentaler-scripts.py index 46fb8163dd..8d7d08b214 100644 --- a/scripts/build/gen-emmentaler-scripts.py +++ b/scripts/build/gen-emmentaler-scripts.py @@ -42,6 +42,7 @@ SetFontNames("%(name)s-%(design_size)d", "%(name)s-%(design_size)d", "%(name)s-% MergeFonts("feta%(design_size)d.pfb"); MergeFonts("feta-noteheads%(design_size)d.pfb"); +MergeFonts("feta-flags%(design_size)d.pfb"); MergeFonts("parmesan%(design_size)d.pfb"); # load nummer/din after setting PUA. diff --git a/scripts/build/mf-to-table.py b/scripts/build/mf-to-table.py index 3f7b3cbb2f..4f8f92dbc5 100644 --- a/scripts/build/mf-to-table.py +++ b/scripts/build/mf-to-table.py @@ -244,6 +244,8 @@ for filenm in files: enc_name = 'ParmesanEncoding' elif re.search ('feta-noteheads', filenm): enc_name = 'FetaNoteheadsEncoding' + elif re.search ('feta-flags', filenm): + enc_name = 'FetaFlagsEncoding' elif re.search ('feta-brace', filenm): enc_name = 'FetaBraceEncoding' elif re.search ('feta-alphabet', filenm):