From 0358e5f9f5e937ee39ce35c60da2283858b60cfa Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Fri, 8 Apr 2005 18:34:41 +0000 Subject: [PATCH] * lily/tie.cc (print): idem. * lily/slur.cc (print): don't use thickness property for slur shape-thickness. * lily/stencil-scheme.cc (LY_DEFINE): don't reverse the order while adding stencils. * scm/define-markup-commands.scm (with-color): with-color markup command. (whiteout): new markup command (filled-box): new markup command --- ChangeLog | 15 +++++++++++++++ input/regression/beam-quarter.ly | 11 ++++++----- input/regression/markup-syntax.ly | 6 +++++- input/regression/whiteout.ly | 18 ++++++++++++++++++ lily/slur.cc | 6 ++++-- lily/stencil-scheme.cc | 15 +++++++++++---- lily/tie.cc | 12 ++++++++---- scm/define-grobs.scm | 6 +++--- scm/define-markup-commands.scm | 30 ++++++++++++++++++++++++++++++ scm/framework-tex.scm | 2 +- 10 files changed, 101 insertions(+), 20 deletions(-) create mode 100644 input/regression/whiteout.ly diff --git a/ChangeLog b/ChangeLog index 24576f549e..840652e633 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2005-04-08 Han-Wen Nienhuys + + * lily/tie.cc (print): idem. + + * lily/slur.cc (print): don't use thickness property for + slur shape-thickness. + + * lily/stencil-scheme.cc (LY_DEFINE): don't reverse the order + while adding stencils. + + * scm/define-markup-commands.scm (with-color): with-color markup + command. + (whiteout): new markup command + (filled-box): new markup command + 2005-04-07 Jan Nieuwenhuizen * Documentation/topdocs/NEWS.tely (Top): Make tex-able. Handy diff --git a/input/regression/beam-quarter.ly b/input/regression/beam-quarter.ly index f2967d7b7c..a6eb5ec5cd 100644 --- a/input/regression/beam-quarter.ly +++ b/input/regression/beam-quarter.ly @@ -2,11 +2,12 @@ \version "2.4.0" \header { - texidoc= "Quarter notes may be beamed: the beam is halted momentarily." + texidoc= "Quarter notes may be beamed: the beam is halted momentarily." } -\score { \relative c'' { - c8[ c4 c8] % should warn here! -} -\layout { raggedright = ##t} +\score { + \relative c'' { + c8[ c4 c8] % should warn here! + } + \layout { raggedright = ##t } } diff --git a/input/regression/markup-syntax.ly b/input/regression/markup-syntax.ly index ca59620d6d..b4ac17530a 100644 --- a/input/regression/markup-syntax.ly +++ b/input/regression/markup-syntax.ly @@ -8,7 +8,7 @@ texidoc = "With the new markup syntax, text may be written in various manners." \score { { - f'-\markup { + f'1-\markup { foo \raise #0.2 \hbracket \bold bar \override #'(baseline-skip . 4) @@ -24,6 +24,8 @@ texidoc = "With the new markup syntax, text may be written in various manners." \combine "X" "+" \combine "o" "/" + } + g'1-\markup { % \char-number #"abc1234abc" \box \column { \line { "string 1" } \line { "string 2" } } "$\\emptyset$" @@ -32,7 +34,9 @@ texidoc = "With the new markup syntax, text may be written in various manners." \italic Norsk \super "2" " " + \raise #3.0 \whiteout white-out \circle \dynamic p + \with-color #green Green \dynamic sfzp \huge { "A" \smaller "A" \smaller \smaller "A" \smaller \smaller \smaller "A" } diff --git a/input/regression/whiteout.ly b/input/regression/whiteout.ly new file mode 100644 index 0000000000..a173f64af4 --- /dev/null +++ b/input/regression/whiteout.ly @@ -0,0 +1,18 @@ +\header { + + texidoc = "The whiteout command underlays a white box under a +markup. The whitening effect only is only guaranteed for staff lines, +since staff lines are in a different layer. " + +} +\version "2.5.18" + +\paper +{ + raggedright = ##t +} + +{ + \override TextScript #'extra-offset = #'(2 . 4) + c'4-\markup { \whiteout foo } c +} diff --git a/lily/slur.cc b/lily/slur.cc index a35784eb3d..929353c00a 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -57,8 +57,9 @@ Slur::print (SCM smob) return SCM_EOL; } + Real staff_thick = Staff_symbol_referencer::line_thickness (me); Real base_thick = robust_scm2double (me->get_property ("thickness"), 1); - Real thick = base_thick * Staff_symbol_referencer::line_thickness (me); + Real thick = base_thick * staff_thick; Real ss = Staff_symbol_referencer::staff_space (me); Bezier one = get_curve (me); @@ -74,7 +75,8 @@ Slur::print (SCM smob) a = Lookup::dashed_slur (one, thick, robust_scm2double (p, 1.0), robust_scm2double (f, 0)); else - a = Lookup::slur (one, get_grob_direction (me) * base_thick * ss / 10.0, + a = Lookup::slur (one, + get_grob_direction (me) * staff_thick * 1.0, thick); #if DEBUG_SLUR_SCORING diff --git a/lily/stencil-scheme.cc b/lily/stencil-scheme.cc index e51fc41bcb..b69c9d70e3 100644 --- a/lily/stencil-scheme.cc +++ b/lily/stencil-scheme.cc @@ -192,19 +192,26 @@ LY_DEFINE (ly_stencil_add, "ly:stencil-add", #define FUNC_NAME __FUNCTION__ SCM_VALIDATE_REST_ARGUMENT (args); - Stencil result; - + SCM expr = SCM_EOL; + SCM *tail = &expr; + Box extent; + extent.set_empty (); + while (!SCM_NULLP (args)) { Stencil *s = unsmob_stencil (scm_car (args)); if (!s) SCM_ASSERT_TYPE (s, scm_car (args), SCM_ARGn, __FUNCTION__, "Stencil"); - result.add_stencil (*s); + + extent.unite (s->extent_box ()); + *tail = scm_cons (s->expr (), SCM_EOL); + tail = SCM_CDRLOC (*tail); args = scm_cdr (args); } - return result.smobbed_copy (); + expr = scm_cons (ly_symbol2scm ("combine-stencil"), expr); + return Stencil (extent, expr).smobbed_copy (); } LY_DEFINE (ly_make_stencil, "ly:make-stencil", diff --git a/lily/tie.cc b/lily/tie.cc index 3f9037d577..4f28e22464 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -332,9 +332,11 @@ Tie::print (SCM smob) if (!scm_is_pair (cp)) return Stencil ().smobbed_copy (); - Real thick - = Staff_symbol_referencer::line_thickness (me) - * robust_scm2double (me->get_property ("thickness"), 1); + + Real staff_thick = Staff_symbol_referencer::line_thickness (me); + Real base_thick = robust_scm2double (me->get_property ("thickness"), 1); + Real thick = base_thick * staff_thick; + Bezier b; int i = 0; @@ -344,7 +346,9 @@ Tie::print (SCM smob) i++; } - Stencil a = Lookup::slur (b, get_grob_direction (me) * thick, thick); + Stencil a = Lookup::slur (b, + get_grob_direction (me) * staff_thick, + thick); return a.smobbed_copy (); } diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index d831ce8d72..bc401414e9 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -821,7 +821,7 @@ (PhrasingSlur . ((slur-details . ,default-slur-details) (print-function . ,Slur::print) - (thickness . 1.2) + (thickness . 1.1) (spacing-procedure . ,Spanner::set_spacing_rods) (minimum-length . 1.5) (after-line-breaking-callback . ,Slur::after_line_breaking) @@ -934,7 +934,7 @@ (Slur . ((slur-details . ,default-slur-details) (print-function . ,Slur::print) - (thickness . 1.2) + (thickness . 1.0) (spacing-procedure . ,Spanner::set_spacing_rods) (minimum-length . 1.5) (after-line-breaking-callback . ,Slur::after_line_breaking) @@ -1256,7 +1256,7 @@ (spacing-procedure . ,Spanner::set_spacing_rods) (staffline-clearance . 0.35) (details . ((ratio . 0.333) (height-limit . 1.0))) - (thickness . 1.2) + (thickness . 1.0) (x-gap . -0.1) (y-offset . 0.6) (minimum-length . 2.5) diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index f411d539c2..7c807d77b7 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -371,6 +371,14 @@ recommend font for this is bold and italic" "Draw a double flat symbol." (interpret-markup layout props (markup #:musicglyph "accidentals.M4"))) +(def-markup-command (with-color layout props color arg) (color? markup?) + "Draw @var{arg} in color specified by @var{color}" + + (let* ((stil (interpret-markup layout props arg))) + + (ly:make-stencil (list 'color color (ly:stencil-expr stil)) + (ly:stencil-extent stil X) + (ly:stencil-extent stil Y)))) ;; ;; TODO: should extract baseline-skip from each argument somehow.. @@ -490,6 +498,28 @@ and/or @code{extra-offset} properties. " (ly:stencil-translate-axis stack 0.75 Y)))) + +(def-markup-command (filled-box layout props xext yext blot) + (number-pair? number-pair? number?) + "Draw a box with rounded corners of dimensions @var{xext} and @var{yext}." + (ly:round-filled-box + xext yext blot)) + +(def-markup-command (whiteout layout props arg) (markup?) + "Provide a white underground for @var{arg}" + (let* ((stil (interpret-markup layout props + (make-with-color-markup black arg))) + (white + (interpret-markup layout props + (make-with-color-markup + white + (make-filled-box-markup + (ly:stencil-extent stil X) + (ly:stencil-extent stil Y) + 0.0))))) + + (ly:stencil-add white stil))) + ;; TODO: better syntax. (def-markup-command (note-by-number layout props log dot-count dir) (number? number? number?) diff --git a/scm/framework-tex.scm b/scm/framework-tex.scm index be72b57981..3674054c68 100644 --- a/scm/framework-tex.scm +++ b/scm/framework-tex.scm @@ -337,7 +337,7 @@ (if (not (ly:get-option 'verbose)) (begin (format (current-error-port) - (_ "Converting to `~a'...") (string-append base ".psbl")) + (_ "Converting to `~a'...") (string-append base ".ps")) (newline (current-error-port)))) (ly:system cmd))) -- 2.39.2