]> git.donarmstrong.com Git - lilypond.git/commitdiff
LyricHyphen whiteout
authorKnut Petersen <knut_petersen@t-online.de>
Sat, 4 Mar 2017 18:10:19 +0000 (18:10 +0000)
committerJames Lowe <pkx166h@gmail.com>
Fri, 10 Mar 2017 18:32:08 +0000 (18:32 +0000)
Issue 5033

A proper outline whiteout
would be ideal, but it is
not currently implemented.
The current code fails
because you need a relatively
large whiteout area for a
small object.

A brute force fix is to increase
the number of iterations, but
the result would be a pdf with
a high percentage of whiteout code.

There is the case where a long
melisma produces a single hyphen
event that generates a lot of
hyphens that cross a number of
mensuration lines.

Rectangular or roundedbox whiteout
will produce gaps in all
mensuration lines crossed, even
if there is no collision.

That's not acceptable.

lily/lyric-hyphen.cc
scm/define-grob-properties.scm
scm/stencil.scm

index 029391f92f681fbe3e144efa7c66444c0da20fd4..a76ed9b2fa0f930c1b525a0eeab2b290929c083a 100644 (file)
@@ -67,6 +67,7 @@ Lyric_hyphen::print (SCM smob)
   Real dash_period = robust_scm2double (me->get_property ("dash-period"), 1.0);
   Real dash_length = robust_scm2double (me->get_property ("length"), .5);
   Real padding = robust_scm2double (me->get_property ("padding"), 0.1);
+  Real whiteout = robust_scm2double (me->get_property ("whiteout"), -1);
 
   if (dash_period < dash_length)
     dash_period = 1.5 * dash_length;
@@ -103,8 +104,20 @@ Lyric_hyphen::print (SCM smob)
   for (int i = 0; i < n; i++)
     {
       Stencil m (dash_mol);
-      m.translate_axis (span_points[LEFT] + i * dash_period + space_left / 2, X_AXIS);
+      m = m.in_color (0.0, 0.0, 0.0);
+      m.translate_axis (span_points[LEFT] + i * dash_period +
+                        space_left / 2, X_AXIS);
       total.add_stencil (m);
+      if (whiteout > 0.0 )
+        {
+          Box c (Interval (0, dash_length + 2 * whiteout * lt),
+                 Interval (h - whiteout * lt, h + th + whiteout * lt));
+          Stencil w (Lookup::round_filled_box (c, 0.8 * lt));
+          w = w.in_color (1.0, 1.0, 1.0);
+          w.translate_axis (span_points[LEFT] + i * dash_period +
+                            space_left / 2 - whiteout * lt, X_AXIS);
+          total.add_stencil (w);
+        }
     }
 
   total.translate_axis (-me->relative_coordinate (common, X_AXIS), X_AXIS);
@@ -148,4 +161,3 @@ ADD_INTERFACE (Lyric_hyphen,
                "padding "
                "thickness "
               );
-
index e950d53b3a712f32d7020a794f3a69a7fb94762c..fbcaa2b4bb85e74812e5b56a898d201417df33e7 100644 (file)
@@ -1167,11 +1167,15 @@ one below this grob.")
 printed over a white background to white-out underlying material, if
 the grob is visible.  A number indicates how far the white background
 extends beyond the bounding box of the grob as a multiple of the
-staff-line thickness.  The shape of the background is determined by
-@code{whiteout-style}.  Usually @code{#f} by default.")
+staff-line thickness.  The @code{LyricHyphen} grob uses a special
+implementation of whiteout:  A positive number indicates how far the
+white background extends beyond the bounding box in multiples of
+@code{line-thickness}.  The shape of the background is determined by
+@code{whiteout-style}.  Usually @code{#f} by default. ")
      (whiteout-style ,symbol? "Determines the shape of the
 @code{whiteout} background.  Available are @code{'outline},
-@code{'rounded-box}, and the default @code{'box}.")
+@code{'rounded-box}, and the default @code{'box}.  There is one
+exception: Use @code{'special} for @code{LyricHyphen}.")
      (width ,ly:dimension? "The width of a grob measured in staff
 space.")
      (word-space ,ly:dimension? "Space to insert between words in
index 0fa79d4161376d45f61b0bc1232fc3abcbb4eda5..00f8503487b7f0cd185b48acfb1d81af3f9231da 100644 (file)
@@ -814,6 +814,7 @@ based on @var{style}."
                       ((eq? style 'rounded-box) 3)
                       (else 0))))))
     (cond
+     ((eq? style 'special) stil)
      ((eq? style 'outline) (stencil-whiteout-outline stil thick))
      ((eq? style 'rounded-box) (stencil-whiteout-box stil thick (* 2 thick)))
      (else (stencil-whiteout-box stil thick)))))