]> git.donarmstrong.com Git - lilypond.git/commitdiff
Separate flags into their own sub-font.
authorCarl Sorensen <c_sorensen@byu.edu>
Sat, 25 Jun 2011 03:38:00 +0000 (21:38 -0600)
committerCarl Sorensen <c_sorensen@byu.edu>
Sat, 9 Jul 2011 21:03:15 +0000 (15:03 -0600)
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.

20 files changed:
mf/GNUmakefile
mf/bigcheese.pe.in [deleted file]
mf/feta-flags-generic.mf [new file with mode: 0644]
mf/feta-flags11.mf [new file with mode: 0644]
mf/feta-flags13.mf [new file with mode: 0644]
mf/feta-flags14.mf [new file with mode: 0644]
mf/feta-flags16.mf [new file with mode: 0644]
mf/feta-flags18.mf [new file with mode: 0644]
mf/feta-flags20.mf [new file with mode: 0644]
mf/feta-flags23.mf [new file with mode: 0644]
mf/feta-flags26.mf [new file with mode: 0644]
mf/feta-generic.mf
mf/feta-noteheads-generic.mf
mf/feta-noteheads-test-generic.mf [deleted file]
mf/feta-noteheads.mf
mf/feta-params.mf
mf/feta-scripts.mf
mf/parmesan-noteheads.mf
scripts/build/gen-emmentaler-scripts.py
scripts/build/mf-to-table.py

index c47b2697d359dcc63e775d5af6802887a82dcbd4..1fa0a73790cc0f27f7ca178b018035168195458a 100644 (file)
@@ -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 (file)
index e1d1843..0000000
+++ /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
-       <Peter.Anvin@linux.org>.
-*/
-  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 (file)
index 0000000..173125b
--- /dev/null
@@ -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 <hanwen@xs4all.nl>
+%
+%
+% 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 <http://www.gnu.org/licenses/>.
+
+
+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 (file)
index 0000000..30cd7f0
--- /dev/null
@@ -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 (file)
index 0000000..3210b1a
--- /dev/null
@@ -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 (file)
index 0000000..9a5449c
--- /dev/null
@@ -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 (file)
index 0000000..d029937
--- /dev/null
@@ -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 (file)
index 0000000..dcaefd4
--- /dev/null
@@ -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 (file)
index 0000000..b7b834e
--- /dev/null
@@ -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 (file)
index 0000000..dcd640c
--- /dev/null
@@ -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 (file)
index 0000000..b2a1fe6
--- /dev/null
@@ -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.
+
index f78895d0f29af8a59e1713505615eb63f1833317..6c00aa5784e3c43d85bab4315001f3127cb4e87c 100644 (file)
@@ -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:
index 4a952ed407102b7df242e22f3e9222e092d664b3..b63158bbe842817f46c244bdb82c5c6d69a1b4f0 100644 (file)
@@ -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 (file)
index 0e381bd..0000000
+++ /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;
index 54a51f622a04aade22a479a7d84f6c4617dab2ae..c72522072195d2b9751158e12cd0014a333294c2 100644 (file)
@@ -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;
 
index 4d0a5eb4b527b873f9fcbc9b75e9c5e77a30fd64..244c262ec3fefbfbe20e1591c8e9bb4a6e5b8a57 100644 (file)
@@ -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);
+
+
index b3843960c27329119fadc6d7b0b932894b3088dd..d04ed18b7b5e99c2641079b77e6af9a459a634ad 100644 (file)
@@ -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;
 
 
index 682dc8bc3c149b46d3f21e015e13b530e3ec8cd2..130c3c50d4b5ed25a2748dc3770eaf420a0b7424 100644 (file)
@@ -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);
index 46fb8163dd7e74d0d5e9c785c1999e89da47b726..8d7d08b214a9fdd7c145cdcd40bfa8d0235de480 100644 (file)
@@ -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.
index 3f7b3cbb2fc88ff969711bcb2a478e5dee09df09..4f8f92dbc5e4e0bc9442e760ca9b0c4b0943a320 100644 (file)
@@ -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):