]> git.donarmstrong.com Git - lilypond.git/commitdiff
*** empty log message ***
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 12 Feb 2005 10:34:36 +0000 (10:34 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 12 Feb 2005 10:34:36 +0000 (10:34 +0000)
13 files changed:
ChangeLog
input/regression/slur-dash.ly [new file with mode: 0644]
input/test/slur-dash.ly [deleted file]
lily/include/lookup.hh
lily/lookup.cc
lily/slur.cc
ly/property-init.ly
scm/define-grob-properties.scm
scm/output-pdf.scm
scm/output-pdftex.scm
scm/output-ps.scm
scm/output-sketch.scm
scm/output-tex.scm

index 1ba21de39b25a97ca26031969a3608cb9aba825d..013820ce5233ad1357a0cfcd235bd493b940468a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,6 @@
 2005-02-11  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+       
+       * Slur-dash patch by Bertalan.
 
        * ly/engraver-init.ly (EasyNotation): glyph name dash -> period.
 
diff --git a/input/regression/slur-dash.ly b/input/regression/slur-dash.ly
new file mode 100644 (file)
index 0000000..68d3e34
--- /dev/null
@@ -0,0 +1,23 @@
+\version "2.4.0"
+\header {texidoc = "@cindex Slur, dotted, dashed
+The appearance of slurs may be changed from solid to dotted or dashed.
+"
+} 
+\score{
+       \relative c'{
+               c( d e  c) |
+               \slurDotted
+               c( d e  c) |
+               \slurDashed
+               c( d e  c) |
+               \override Slur #'dash-period = #2.0
+               \override Slur #'dash-fraction = #0.4
+               c( d e  c) |
+               \slurSolid
+               c( d e  c) |
+       }
+       \layout{ raggedright=##t }
+}
+
+
+
diff --git a/input/test/slur-dash.ly b/input/test/slur-dash.ly
deleted file mode 100644 (file)
index dcda968..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-\version "2.4.0"
-\header {texidoc = "@cindex Slur, dotted
-The appearance of slurs may be changed from solid to dotted or dashed.
-"
-} 
-\score{
-       \relative c'{
-               c( d e  c) |
-               \slurDotted
-               c( d e  c) |
-               \slurSolid
-               c( d e  c) |
-               \override Slur  #'dashed = #0.0
-               c( d e  c) |
-               \slurSolid
-               c( d e  c) |
-       }
-       \layout{ raggedright=##t }
-}
-
-
-
index f5e787c0d9341513dfcc5ff60b4823ad79b16138..bf53592937784f05fe8c6033c36634d350def44f 100644 (file)
@@ -22,7 +22,7 @@ struct Lookup
   static Stencil slur (Bezier controls, Real cthick, Real thick);
   static Stencil bezier_sandwich (Bezier top_curve, Bezier bottom_curve);
   static Stencil beam (Real slope, Real width, Real thick, Real blot);
-  static Stencil dashed_slur (Bezier, Real thick, Real dash);
+  static Stencil dashed_slur (Bezier, Real thick, Real dash_period, Real dash_fraction);
   static Stencil blank (Box b);
   static Stencil filled_box (Box b);
   static Stencil round_filled_box (Box b, Real blotdiameter);
index da0ccde18295092edeff952a421c665fb70d38fe..f012ca6930259a173d3964d9b6941ac6e4502b1f 100644 (file)
@@ -75,21 +75,26 @@ Lookup::beam (Real slope, Real width, Real thick, Real blot)
   return Stencil (b, at);
 }
 
+  
 Stencil
-Lookup::dashed_slur (Bezier b, Real thick, Real dash)
+Lookup::dashed_slur (Bezier b, Real thick, Real dash_period, Real dash_fraction)
 {
   SCM l = SCM_EOL;
-
+  
+  Real on = dash_fraction * dash_period; 
+  Real off = dash_period - on; 
   for (int i = 4; i -- ;)
     {
       l = scm_cons (ly_offset2scm (b.control_[i]), l);
     }
 
   SCM at = (scm_list_n (ly_symbol2scm ("dashed-slur"),
-                              scm_make_real (thick), 
-                              scm_make_real (dash),
-                              ly_quote_scm (l),
-                              SCM_UNDEFINED));
+                       scm_make_real (thick), 
+                       scm_make_real (on),
+                       scm_make_real (off),
+                       ly_quote_scm (l),
+                       SCM_UNDEFINED));
 
   Box box (Interval (0, 0), Interval (0, 0));
   return   Stencil (box, at);
index 3057fc2c37ab4561e5beb7d560115c457698b46b..5d8138b36ec2d78df30e820c8fc210d9bd6a01b0 100644 (file)
@@ -68,9 +68,11 @@ Slur::print (SCM smob)
   /*
     TODO: replace dashed with generic property.
   */
-  SCM d =  me->get_property ("dashed");
-  if (scm_is_number (d))
-    a = Lookup::dashed_slur (one, thick, thick * robust_scm2double (d, 0));
+  SCM p =  me->get_property ("dash-period");
+  SCM f =  me->get_property ("dash-fraction");
+  if (scm_is_number (p) && scm_is_number (f))
+    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,
                      thick);
@@ -238,6 +240,6 @@ Slur::after_line_breaking (SCM smob)
 
 ADD_INTERFACE (Slur, "slur-interface",
               "A slur",
-              "positions quant-score excentricity encompass-objects control-points dashed slur-details direction height-limit note-columns ratio thickness");
+              "positions quant-score excentricity encompass-objects control-points dash-period dash-fraction slur-details direction height-limit note-columns ratio thickness");
 
 
index 8103849c651182dbb38f6d082dcae74efd01dcc8..52d4e7e419051e9371b18227c48a6de67d748b2e 100644 (file)
@@ -11,8 +11,18 @@ slurDown = \override Slur  #'direction = #-1
 slurNeutral = \revert Slur #'direction 
 
 % There's also dash, but setting dash period/length should be fixed.
-slurDotted = \override Slur  #'dashed = #1
-slurSolid = \revert Slur #'dashed
+slurDashed = {
+       \override Slur #'dash-period = #1
+       \override Slur #'dash-fraction = #0.4
+}
+slurDotted = {
+       \override Slur  #'dash-period = #1
+       \override Slur #'dash-fraction = #0.1
+}
+slurSolid = {
+       \revert Slur #'dash-period
+       \revert Slur #'dash-fraction
+}
 
 
 phrasingSlurUp = \override PhrasingSlur  #'direction = #1
index 0cb0793f22b4f84fbbe18f71be01b523735b4e21..fd4934f60a50466a397008a614953a0a25367fce 100644 (file)
@@ -149,7 +149,7 @@ negative, no line is drawn at all.")
 dash-period. Should be between 0.0 (no line) and 1.0 (continuous
 line).")
 
-     ;; [FIXME: use dash-period/dash length; see text-spanner]
+     ;; use dash-period/dash-fraction instead;
      (dashed ,number? " number representing the length of the dashes.")
  
      ;; todo: why is this tunable?
index 6cc3a1f75176e570d7e237fc441495cb0b726ea9..954dffd18733a7455e8f2a79f1573fda0cdbd748 100644 (file)
   (invoke-char " show" i))
 
 
-(define (dashed-slur thick dash lst)
+(define (dashed-slur thick on off l)
   (string-append (setlineparams)
-                "[ " (ly:number->string dash) " "
-                (ly:number->string (* 10 thick)) " ] 0 d "
-                (setlinewidth thick)
-                (moveto-pair (car lst))
-                (apply curveto (cdr lst))
+                "[ " (ly:number->string on) " "
+                (ly:number->string off) " ] 0 d "
+                (setlinewidth thick)
+                (moveto-pair (car l))
+                (apply curveto (cdr l))
                 (closestroke)))
 
 (define (dashed-line thick on off dx dy)
index 9dfb6040aec9642104fec2e7a5499ad18e6b2aa2..f4c39ce21c9a057971bd584656585737aaf12c88 100644 (file)
@@ -45,8 +45,8 @@
 (define (bracket arch_angle arch_width arch_height height arch_thick thick)
   (embedded-pdf (list 'bracket  arch_angle arch_width arch_height height arch_thick thick)))
 
-(define (dashed-slur thick dash lst)
-  (embedded-pdf (list 'dashed-slur thick dash lst)))
+(define (dashed-slur thick on off lst)
+  (embedded-pdf (list 'dashed-slur thick on off lst)))
 
 (define (char i)
   (string-append "\\char" (ly:inexact->string i 10) " "))
index 3b1e91c6537ad41d395f725df57b513a7d178ecf..67042e214e89a6e83065121c39a1ad0888325381 100644 (file)
    " ] 0 draw_dashed_line"))
 
 ;; what the heck is this interface ?
-(define (dashed-slur thick dash lst)
+(define (dashed-slur thick on off l)
   (string-append 
-   (string-join (map ly:number-pair->string lst) " ")
+   (string-join (map ly:number-pair->string l) " ")
    " "
    (ly:number->string thick) 
    " [ "
-   (ly:number->string dash)
-   " "
-   ;;UGH.  10 ?
-   (ly:number->string (* 10 thick))
+   (ly:number->string on)
+   " "   
+   (ly:number->string off)
    " ] 0 draw_dashed_slur"))
 
 (define (dot x y radius)
index 6a42089b47e31569e1bc72c35ff3b778f6355c85..7fb0f963437f8ed96463955c5694165ad7ee0669 100644 (file)
 
 
 ;; what the heck is this interface ?
-(define (dashed-slur thick dash lst)
-  (string-append 
-   (string-join (map ly:number-pair->string lst) " ")
-   " "
-   (ly:number->string thick) 
-   " [ "
-   (ly:number->string dash)
-   " "
-   (ly:number->string (* 10 thick))    ;UGH.  10 ?
-   " ] 0 draw_dashed_slur"))
+(define (dashed-slur thick on off l)
+  "")
 
 (define (dashed-line thick on off dx dy)
   (string-append 
index 6bc3f50a06783ac2f2f40a040db78c561bba48c2..c0aa31680bcb9fa7f94228bc141a643923235390 100644 (file)
@@ -90,8 +90,8 @@
 (define (bracket arch_angle arch_width arch_height height arch_thick thick)
   (embedded-ps (list 'bracket  arch_angle arch_width arch_height height arch_thick thick)))
 
-(define (dashed-slur thick dash lst)
-  (embedded-ps (list 'dashed-slur thick dash `(quote ,lst))))
+(define (dashed-slur thick on off lst)
+  (embedded-ps (list 'dashed-slur thick on off `(quote ,lst))))
 
 (define (named-glyph font name)
   (let* ((info (ly:otf-font-glyph-info font name))