]> git.donarmstrong.com Git - lilypond.git/commitdiff
Unifies mensural ligatures with blot-diameter.
authorBertrand Bordage <bordage.bertrand@gmail.com>
Sat, 17 Sep 2011 19:48:07 +0000 (21:48 +0200)
committerBertrand Bordage <bordage.bertrand@gmail.com>
Thu, 22 Sep 2011 08:19:45 +0000 (10:19 +0200)
Reverts some changes of commit 0dcc93c0a5a97d048db2f7631966f41ae0059ab5

Use blot-diameter either in C and MetaFont.

lily/mensural-ligature.cc
mf/parmesan-noteheads.mf

index 4b43c686077eb5a2dbfdb1917f600694150f95e7..4fcd9be5d3faab15d38b5a4a6198a48ad33e0745 100644 (file)
@@ -70,14 +70,17 @@ brew_flexa (Grob *me,
   Real ypos_correction = -0.1 * staff_space * sign (slope);
   Real slope_correction = 0.2 * staff_space * sign (slope);
   Real corrected_slope = slope + slope_correction / width;
+  Real blotdiameter
+    = me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"));
+  width += 2 * blotdiameter;
 
   if (solid) // colorated flexae
     {
-      stencil = Lookup::beam (corrected_slope, width * 0.5, staff_space, 0.0);
+      stencil = Lookup::beam (corrected_slope, width * 0.5, staff_space, blotdiameter);
     }
   else // outline
     {
-      stencil = Lookup::beam (corrected_slope, thickness, height, 0.0);
+      stencil = Lookup::beam (corrected_slope, thickness, height, blotdiameter);
       if (!begin)
         {
           stencil.translate_axis (width * 0.5 - thickness, X_AXIS);
@@ -87,13 +90,13 @@ brew_flexa (Grob *me,
 
       Stencil bottom_edge
         = Lookup::beam (corrected_slope, width * 0.5, horizontal_line_thickness,
-                        0.0);
+                        blotdiameter);
       bottom_edge.translate_axis (-0.5 * height, Y_AXIS);
       stencil.add_stencil (bottom_edge);
 
       Stencil top_edge
         = Lookup::beam (corrected_slope, width * 0.5, horizontal_line_thickness,
-                        0.0);
+                        blotdiameter);
       top_edge.translate_axis (+0.5 * height, Y_AXIS);
       stencil.add_stencil (top_edge);
     }
@@ -102,7 +105,7 @@ brew_flexa (Grob *me,
     stencil.translate_axis (ypos_correction, Y_AXIS);
   else
     {
-      stencil.translate_axis (0.5 * thickness, X_AXIS);
+      stencil.translate_axis (0.5 * thickness - blotdiameter, X_AXIS);
 
       stencil.translate_axis (interval / -4.0 * staff_space, Y_AXIS);
     }
@@ -166,11 +169,8 @@ internal_brew_primitive (Grob *me)
     case MLP_BREVIS:
       duration_log--;
       suffix = to_string (duration_log) + color
-                      + (duration_log == -3 ? "lig" : "") + "mensural";
+                      + (duration_log < -1 ? "lig" : "") + "mensural";
       index = prefix + "s";
-      out = fm->find_by_name (index + suffix);
-      if (out.is_empty ())
-        index = prefix + "d";
       out = fm->find_by_name (index + "r" + suffix);
       if (!out.is_empty ()
           && !Staff_symbol_referencer::on_line
@@ -190,18 +190,27 @@ internal_brew_primitive (Grob *me)
       return Lookup::blank (Box (Interval (0, 0), Interval (0, 0)));
     }
 
-  Real blotdiameter
-    = (me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter")));
+  /*
+    we use thickness because the stem end of the glyph
+    "noteheads.sM2ligmensural" is round.
+  */
+  Real blotdiameter = thickness;
+  /*
+    instead of 2.5 the length of a longa stem should be used
+    Font_interface::get_default_font (???)->find_by_name
+    ("noteheads.sM2ligmensural").extent (Y_AXIS).length () * 0.5
+  */
+  Real stem_length = 2.5 * staff_space;
 
   if (primitive & MLP_STEM)
     {
       // assume MLP_UP
-      Real y_bottom = 0.5 * staff_space, y_top = 2.5 * staff_space;
+      Real y_bottom = 0.0, y_top = stem_length;
 
       if (primitive & MLP_DOWN)
         {
           y_bottom = -y_top;
-          y_top = -0.5 * staff_space;
+          y_top = 0.0;
         }
 
       Interval x_extent (0, thickness);
@@ -231,12 +240,7 @@ internal_brew_primitive (Grob *me)
                 to serve as stem as well
               */
               if (primitive & MLP_LONGA)
-                /*
-                  instead of 3.0 the length of a longa stem should be used
-                  Font_interface::get_default_font (???)->find_by_name
-                  ("noteheads.s-2mensural").extent (Y_AXIS).length () * 0.5
-                */
-                y_bottom -= 2.5 * staff_space;
+                y_bottom -= stem_length + 0.25 * blotdiameter;
             }
 
           Interval x_extent (width - thickness, width);
index f496c03c72f278a7d5dd16d0f9c49eebfcab2914..23049f6f1b369d607b8b42bafa596c45760cbc48 100644 (file)
@@ -75,7 +75,7 @@ def draw_neomensural_brevis (expr brevwid, holeheight, open, full) =
                      head_height# / 2, head_height# / 2);
 
        2 beamheight + holeheight = head_height;
-       serif_size := .75 linethickness;
+       serif_size := blot_diameter;
        serif_protrude := .15 head_height;
 
        z1l = (0, 0);
@@ -166,14 +166,13 @@ def draw_neomensural_longa (expr wid, holeheight, direction) =
 enddef;
 
 
-def draw_neomensural_black_head (expr wid, height) =
-       save head_height, head_width, stem_width;
-       save ne, nw, ne_dist, nw_dist, penthickness;
+def draw_neomensural_black_head (expr width, height) =
+       save head_width, head_height, stem_width;
+       save ne, nw, ne_dist, nw_dist;
        pair ne, nw, ne_dist, nw_dist;
 
-       penthickness# = linethickness#;
-       head_height# := height + penthickness#;
-       head_width# := wid + penthickness#;
+       head_width# := width;
+       head_height# := height;
        stem_width# := 1.3 linethickness#;
 
        set_char_box (0, head_width#,
@@ -182,12 +181,10 @@ def draw_neomensural_black_head (expr wid, height) =
        charwx := head_width# / 2;
        charwy := head_height# / 2 - 2 stem_width#;
 
-       define_pixels (penthickness);
-
        y3 = y1 = 0;
        x2 = x4 = 1/2 [x1, x3];
 
-       pickup pencircle scaled penthickness;
+       pickup pencircle scaled blot_diameter;
 
        top y2 = h;
        bot y4 = -d;
@@ -195,9 +192,9 @@ def draw_neomensural_black_head (expr wid, height) =
        rt x3 = w;
 
        ne := unitvector (z2 - z1);
-       nw_dist := (ne rotated 90) * penthickness / 2;
+       nw_dist := (ne rotated 90) * blot_diameter / 2;
        nw := unitvector (z2 - z3);
-       ne_dist := (nw rotated -90) * penthickness / 2;
+       ne_dist := (nw rotated -90) * blot_diameter / 2;
 
        fill lft z1
             .. (z1 + nw_dist)
@@ -217,13 +214,13 @@ def draw_neomensural_black_head (expr wid, height) =
 enddef;
 
 
-def draw_neomensural_open_head (expr wid, height)=
-       draw_neomensural_black_head (wid, height);
+def draw_neomensural_open_head (expr width, height)=
+       draw_neomensural_black_head (width, height);
 
        save headNW, headSW, stem_width;
 
-       headNW = length (z2 - z1) + penthickness;
-       headSW = length (z4 - z1) + penthickness;
+       headNW = length (z2 - z1) + blot_diameter;
+       headSW = length (z4 - z1) + blot_diameter;
        stem_width = 1.3 linethickness;
 
        save hole_widthNW, hole_widthSW;
@@ -233,8 +230,8 @@ def draw_neomensural_open_head (expr wid, height)=
 
        (rt z7 + lft z5) / 2 = (w / 2, 0);
        (bot z8 + top z6) / 2 = (w / 2, 0);
-       z6 - z5 = (hole_widthNW - penthickness) * unitvector (z2 - z1);
-       z7 - z6 = (hole_widthSW - penthickness) * unitvector (z4 - z1);
+       z6 - z5 = (hole_widthNW - blot_diameter) * unitvector (z2 - z1);
+       z7 - z6 = (hole_widthSW - blot_diameter) * unitvector (z4 - z1);
 
        unfill lft z5
               .. (z5 + nw_dist)
@@ -372,7 +369,7 @@ def draw_mensural_brevis (expr wid, holeheight, open, full) =
 enddef;
 
 
-def draw_mensural_longa (expr wid, holeheight, open, full, direction) =
+def draw_mensural_longa (expr wid, holeheight, open, full, direction, ligature) =
        draw_mensural_brevis (wid, holeheight, open, full);
 
        save dir;
@@ -385,7 +382,11 @@ def draw_mensural_longa (expr wid, holeheight, open, full, direction) =
        z17 = (x7, y7 - dir * stem_width / 2);
 
        penpos6 (stem_width, 0);
-       penpos7 (1.5 stem_width, 0);
+       if ligature:
+         penpos7 (stem_width, 0);
+       else:
+         penpos7 (1.5 stem_width, 0);
+       fi;
 
        fill z7l
             -- z6l
@@ -473,11 +474,11 @@ m_holeheight := nm_holeheight;
 m_red_holeheight := nm_red_holeheight;
 
 fet_beginchar ("Mensural maxima notehead (up)", "uM3mensural");
-       draw_mensural_longa (m_maxima_width, m_holeheight, true, true, 1);
+       draw_mensural_longa (m_maxima_width, m_holeheight, true, true, 1, false);
 fet_endchar;
 
 fet_beginchar ("Mensural maxima notehead (down)", "dM3mensural");
-       draw_mensural_longa (m_maxima_width, m_holeheight, true, true, -1);
+       draw_mensural_longa (m_maxima_width, m_holeheight, true, true, -1, false);
 fet_endchar;
 
 fet_beginchar ("Mensural maxima notehead (ligature)", "sM3ligmensural");
@@ -485,11 +486,15 @@ fet_beginchar ("Mensural maxima notehead (ligature)", "sM3ligmensural");
 fet_endchar;
 
 fet_beginchar ("Mensural longa notehead (up)", "uM2mensural");
-       draw_mensural_longa (m_longa_width, m_holeheight, true, true, 1);
+       draw_mensural_longa (m_longa_width, m_holeheight, true, true, 1, false);
 fet_endchar;
 
 fet_beginchar ("Mensural longa notehead (down)", "dM2mensural");
-       draw_mensural_longa (m_longa_width, m_holeheight, true, true, -1);
+       draw_mensural_longa (m_longa_width, m_holeheight, true, true, -1, false);
+fet_endchar;
+
+fet_beginchar ("Mensural longa notehead (ligature)", "sM2ligmensural");
+       draw_mensural_longa (m_longa_width, m_holeheight, true, true, -1, true);
 fet_endchar;
 
 fet_beginchar ("Mensural brevis notehead", "sM1mensural");
@@ -497,11 +502,11 @@ fet_beginchar ("Mensural brevis notehead", "sM1mensural");
 fet_endchar;
 
 fet_beginchar ("Mensural maxima notehead (up, reduced hole)", "urM3mensural");
-       draw_mensural_longa (m_maxima_width, m_red_holeheight, true, true, 1);
+       draw_mensural_longa (m_maxima_width, m_red_holeheight, true, true, 1, false);
 fet_endchar;
 
 fet_beginchar ("Mensural maxima notehead (down, reduced hole)", "drM3mensural");
-       draw_mensural_longa (m_maxima_width, m_red_holeheight, true, true, -1);
+       draw_mensural_longa (m_maxima_width, m_red_holeheight, true, true, -1, false);
 fet_endchar;
 
 fet_beginchar ("Mensural maxima notehead (ligature, reduced hole)", "srM3ligmensural");
@@ -509,11 +514,15 @@ fet_beginchar ("Mensural maxima notehead (ligature, reduced hole)", "srM3ligmens
 fet_endchar;
 
 fet_beginchar ("Mensural longa notehead (up, reduced hole)", "urM2mensural");
-       draw_mensural_longa (m_longa_width, m_red_holeheight, true, true, 1);
+       draw_mensural_longa (m_longa_width, m_red_holeheight, true, true, 1, false);
 fet_endchar;
 
 fet_beginchar ("Mensural longa notehead (down, reduced hole)", "drM2mensural");
-       draw_mensural_longa (m_longa_width, m_red_holeheight, true, true, -1);
+       draw_mensural_longa (m_longa_width, m_red_holeheight, true, true, -1, false);
+fet_endchar;
+
+fet_beginchar ("Mensural longa notehead (ligature, reduced hole)", "srM2ligmensural");
+       draw_mensural_longa (m_longa_width, m_red_holeheight, true, true, -1, true);
 fet_endchar;
 
 fet_beginchar ("Mensural brevis notehead (reduced hole)", "srM1mensural");
@@ -526,11 +535,11 @@ fet_endchar;
 %
 
 fet_beginchar ("Semi-colored mensural maxima notehead (up)", "uM3semimensural");
-       draw_mensural_longa (m_maxima_width, m_holeheight, true, false, 1);
+       draw_mensural_longa (m_maxima_width, m_holeheight, true, false, 1, false);
 fet_endchar;
 
 fet_beginchar ("Semi-colored mensural maxima notehead (down)", "dM3semimensural");
-       draw_mensural_longa (m_maxima_width, m_holeheight, true, false, -1);
+       draw_mensural_longa (m_maxima_width, m_holeheight, true, false, -1, false);
 fet_endchar;
 
 fet_beginchar ("Semi-colored mensural maxima notehead (ligature)", "sM3semiligmensural");
@@ -538,11 +547,15 @@ fet_beginchar ("Semi-colored mensural maxima notehead (ligature)", "sM3semiligme
 fet_endchar;
 
 fet_beginchar ("Semi-colored mensural longa notehead (up)", "uM2semimensural");
-       draw_mensural_longa (m_longa_width, m_holeheight, true, false, 1);
+       draw_mensural_longa (m_longa_width, m_holeheight, true, false, 1, false);
 fet_endchar;
 
 fet_beginchar ("Semi-colored mensural longa notehead (down)", "dM2semimensural");
-       draw_mensural_longa (m_longa_width, m_holeheight, true, false, -1);
+       draw_mensural_longa (m_longa_width, m_holeheight, true, false, -1, false);
+fet_endchar;
+
+fet_beginchar ("Semi-colored mensural longa notehead (ligature)", "sM2semiligmensural");
+       draw_mensural_longa (m_longa_width, m_holeheight, true, false, -1, true);
 fet_endchar;
 
 fet_beginchar ("Semi-colored mensural brevis notehead", "sM1semimensural");
@@ -550,11 +563,11 @@ fet_beginchar ("Semi-colored mensural brevis notehead", "sM1semimensural");
 fet_endchar;
 
 fet_beginchar ("Semi-colored mensural maxima notehead (up, reduced hole)", "urM3semimensural");
-       draw_mensural_longa (m_maxima_width, m_red_holeheight, true, false, 1);
+       draw_mensural_longa (m_maxima_width, m_red_holeheight, true, false, 1, false);
 fet_endchar;
 
 fet_beginchar ("Semi-colored mensural maxima notehead (down, reduced hole)", "drM3semimensural");
-       draw_mensural_longa (m_maxima_width, m_red_holeheight, true, false, -1);
+       draw_mensural_longa (m_maxima_width, m_red_holeheight, true, false, -1, false);
 fet_endchar;
 
 fet_beginchar ("Semi-colored mensural maxima notehead (ligature, reduced hole)", "srM3semiligmensural");
@@ -562,11 +575,15 @@ fet_beginchar ("Semi-colored mensural maxima notehead (ligature, reduced hole)",
 fet_endchar;
 
 fet_beginchar ("Semi-colored mensural longa notehead (up, reduced hole)", "urM2semimensural");
-       draw_mensural_longa (m_longa_width, m_red_holeheight, true, false, 1);
+       draw_mensural_longa (m_longa_width, m_red_holeheight, true, false, 1, false);
 fet_endchar;
 
 fet_beginchar ("Semi-colored mensural longa notehead (down, reduced hole)", "drM2semimensural");
-       draw_mensural_longa (m_longa_width, m_red_holeheight, true, false, -1);
+       draw_mensural_longa (m_longa_width, m_red_holeheight, true, false, -1, false);
+fet_endchar;
+
+fet_beginchar ("Semi-colored mensural longa notehead (ligature, reduced hole)", "srM2semiligmensural");
+       draw_mensural_longa (m_longa_width, m_red_holeheight, true, false, -1, true);
 fet_endchar;
 
 fet_beginchar ("Semi-colored mensural brevis notehead (reduced hole)", "srM1semimensural");
@@ -579,11 +596,11 @@ fet_endchar;
 %
 
 fet_beginchar ("Black mensural maxima notehead (up)", "uM3blackmensural");
-       draw_mensural_longa (m_maxima_width, 0, false, false, 1);
+       draw_mensural_longa (m_maxima_width, 0, false, false, 1, false);
 fet_endchar;
 
 fet_beginchar ("Black mensural maxima notehead (down)", "dM3blackmensural");
-       draw_mensural_longa (m_maxima_width, 0, false, false, -1);
+       draw_mensural_longa (m_maxima_width, 0, false, false, -1, false);
 fet_endchar;
 
 fet_beginchar ("Black mensural maxima notehead (ligature)", "sM3blackligmensural");
@@ -591,11 +608,15 @@ fet_beginchar ("Black mensural maxima notehead (ligature)", "sM3blackligmensural
 fet_endchar;
 
 fet_beginchar ("Black mensural longa notehead (up)", "uM2blackmensural");
-       draw_mensural_longa (m_longa_width, 0, false, false, 1);
+       draw_mensural_longa (m_longa_width, 0, false, false, 1, false);
 fet_endchar;
 
 fet_beginchar ("Black mensural longa notehead (down)", "dM2blackmensural");
-       draw_mensural_longa (m_longa_width, 0, false, false, -1);
+       draw_mensural_longa (m_longa_width, 0, false, false, -1, false);
+fet_endchar;
+
+fet_beginchar ("Black mensural longa notehead (ligature)", "sM2blackligmensural");
+       draw_mensural_longa (m_longa_width, 0, false, false, -1, true);
 fet_endchar;
 
 fet_beginchar ("Black mensural brevis notehead", "sM1blackmensural");
@@ -637,7 +658,7 @@ fet_endchar;
 % Josquin Desprez, BNF
 
 save petrucci_width, petrucci_height;
-petrucci_height := 1.3 noteheight#;
+petrucci_height := 1.4 noteheight#;
 petrucci_width := .72 petrucci_height;
 
 fet_beginchar ("Petrucci semibrevis head", "s0petrucci");