>From 11401a63ad810ef9235ad44b86dc4226636a405e Mon Sep 17 00:00:00 2001 From: Knut Petersen Date: Mon, 26 Sep 2016 11:53:36 +0200 Subject: [PATCH] Experimental: Implement special whiteout for LyricHyphen Grob Signed-off-by: Knut Petersen --- lily/lyric-hyphen.cc | 13 +++++++++++++ scm/stencil.scm | 1 + 2 files changed, 14 insertions(+) diff --git a/lily/lyric-hyphen.cc b/lily/lyric-hyphen.cc index 029391f..ca73985 100644 --- a/lily/lyric-hyphen.cc +++ b/lily/lyric-hyphen.cc @@ -68,6 +68,8 @@ Lyric_hyphen::print (SCM smob) Real dash_length = robust_scm2double (me->get_property ("length"), .5); Real padding = robust_scm2double (me->get_property ("padding"), 0.1); + Real wof = robust_scm2double (me->get_property ("whiteout"), -1); + if (dash_period < dash_length) dash_period = 1.5 * dash_length; @@ -99,12 +101,23 @@ Lyric_hyphen::print (SCM smob) Box b (Interval (0, dash_length), Interval (h, h + th)); Stencil dash_mol (Lookup::round_filled_box (b, 0.8 * lt)); + Box c (Interval (0, dash_length + 2 * wof * lt), Interval (h - wof * lt, h + th + wof * lt)); + Stencil wo (Lookup::round_filled_box (c, 0.8 * lt)); + Stencil total; for (int i = 0; i < n; i++) { Stencil m (dash_mol); + Stencil w (wo); + if (wof > 0.0 ) + 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 (wof > 0.0 ) { + w = w.in_color (1.0, 0, 0); + w.translate_axis (span_points[LEFT] + i * dash_period + space_left / 2 - wof * lt, X_AXIS); + total.add_stencil (w); + } } total.translate_axis (-me->relative_coordinate (common, X_AXIS), X_AXIS); diff --git a/scm/stencil.scm b/scm/stencil.scm index 17f5f90..f3698d6 100644 --- a/scm/stencil.scm +++ b/scm/stencil.scm @@ -817,6 +817,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))))) -- 2.1.4