]> git.donarmstrong.com Git - lilypond.git/commitdiff
*** empty log message ***
authorJan Nieuwenhuizen <janneke@gnu.org>
Sat, 12 Feb 2005 10:11:49 +0000 (10:11 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sat, 12 Feb 2005 10:11:49 +0000 (10:11 +0000)
12 files changed:
ChangeLog
input/test/slur-dash.ly
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 1361820e42af78a66484df5db8dc2889bfd51256..a8779dab18899aee3479fc5cee5924b8ff2e26d0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-02-12  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * Slur-dash patch by Bertalan.
+
 2005-02-10  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * stepmake/aclocal.m4: teTeX-3.0 inimf fix.  Comment-out.
index dcda968b70877c21bb6603a83a6fa2a51474b1b4..68d3e34f3c705c82d0f8e1001e2c920a1d45e2a8 100644 (file)
@@ -1,5 +1,5 @@
 \version "2.4.0"
-\header {texidoc = "@cindex Slur, dotted
+\header {texidoc = "@cindex Slur, dotted, dashed
 The appearance of slurs may be changed from solid to dotted or dashed.
 "
 } 
@@ -8,9 +8,10 @@ The appearance of slurs may be changed from solid to dotted or dashed.
                c( d e  c) |
                \slurDotted
                c( d e  c) |
-               \slurSolid
+               \slurDashed
                c( d e  c) |
-               \override Slur  #'dashed = #0.0
+               \override Slur #'dash-period = #2.0
+               \override Slur #'dash-fraction = #0.4
                c( d e  c) |
                \slurSolid
                c( d e  c) |
index b84097ee2e7188b0739027753585d297f74f93ac..a1578920c6e2fd1db44007a8acdd8f7399af3bf4 100644 (file)
@@ -26,7 +26,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 69db6c10868843f9577d138053f901363f579df8..69ffc543793aa61e92e8c6a064f6f55a53919ebd 100644 (file)
@@ -76,10 +76,13 @@ Lookup::beam (Real slope, Real width, Real thick, Real blot)
 }
 
 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);
@@ -87,7 +90,8 @@ Lookup::dashed_slur (Bezier b, Real thick, Real dash)
 
   SCM at = (scm_list_n (ly_symbol2scm ("dashed-slur"),
                               scm_make_real (thick), 
-                              scm_make_real (dash),
+                              scm_make_real (on),
+                              scm_make_real (off),
                               ly_quote_scm (l),
                               SCM_UNDEFINED));
 
index cde26695784ce002592e4a4630ece622ab41c044..c6128c1a23baf46313f267ba3564f4bc35572fa5 100644 (file)
@@ -71,9 +71,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);
@@ -241,6 +243,6 @@ Slur::after_line_breaking (SCM smob)
 
 ADD_INTERFACE (Slur, "slur-interface",
               "A slur",
-              "quant-score excentricity encompass-objects control-points dashed slur-details direction height-limit note-columns ratio thickness");
+              "quant-score excentricity encompass-objects control-points dash-period dash-fraction slur-details direction height-limit note-columns ratio thickness");
 
 
index c820c5c7032a70e20d7f9550eecac6eeb1199520..97ce6a1a559913d98a84a68850fe0b16f3a0732e 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 0740f9ece4ac53d2a9a85aa73ab9a2a86f777cb0..53af9ecba2e6e08f994fb9fb6727ca698caeb12f 100644 (file)
@@ -150,7 +150,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 691e8f3c558e2a9267208a0c2312d8ac6080c99a..bf918d8a35f06aa69eb3350f91620b704b43662b 100644 (file)
   (invoke-char " show" i))
 
 
-(define (dashed-slur thick dash l)
+(define (dashed-slur thick on off l)
   (string-append (setlineparams)
-                "[ " (ly:number->string dash) " "
-                (ly:number->string (* 10 thick)) " ] 0 d "
+                "[ " (ly:number->string on) " "
+                (ly:number->string off) " ] 0 d "
                 (setlinewidth thick)
                 (moveto-pair (car l))
                 (apply curveto (cdr l))
index f20f7a02aa9898c2b7add58963b1cbba09f82290..4bad8d9af561b3818a7d0a3209bf3af3af2b7fd9 100644 (file)
@@ -53,8 +53,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 l)
-  (embedded-pdf (list 'dashed-slur   thick dash l)))
+(define (dashed-slur thick on off l)
+  (embedded-pdf (list 'dashed-slur   thick on off l)))
 
 (define (char i)
   (string-append "\\char" (ly:inexact->string i 10) " "))
index 5db157f282e82603b90fa11e4604bd80bcb63cab..2eda1052c3ea4304bee9d07388e533aa238170ca 100644 (file)
    " ] 0 draw_dashed_line"))
 
 ;; what the heck is this interface ?
-(define (dashed-slur thick dash l)
+(define (dashed-slur thick on off l)
   (string-append 
    (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"))
 
 ; todo: merge with tex-font-command?
index afe39c407605954d5d8b46a966b3f2a5d689d4a2..1323944b24a1b67adcf3e23f8956ed767e44f845 100644 (file)
@@ -46,7 +46,7 @@
 ; ((eq? keyword 'char x y i)
 ; ((eq? keyword 'comment s)
 ; ((eq? keyword 'dashed-line thick on off dx dy)
-; ((eq? keyword 'dashed-slur thick dash l)
+; ((eq? keyword 'dashed-slur thick on off l)
 ; ((eq? keyword 'define-origin a b c ) "")
 ; ((eq? keyword 'experimental-on) "")
 ; ((eq? keyword 'ez-ball ch letter-col ball-col)
 
 
 ;; what the heck is this interface ?
-(define (dashed-slur thick dash l)
+(define (dashed-slur thick on off l)
   (string-append 
    (string-join (map ly:number-pair->string l) " ")
    " "
    (ly:number->string thick) 
    " [ "
-   (ly:number->string dash)
+   (ly:number->string on)
    " "
-   (ly:number->string (* 10 thick))    ;UGH.  10 ?
+   (ly:number->string off)
    " ] 0 draw_dashed_slur"))
 
 (define (dashed-line thick on off dx dy)
index 4ea8fbe77d2419d82e7e156251f7bf411cc99cd8..4fd907963594dd406e1cd9cf086c7a2669c05478 100644 (file)
@@ -88,8 +88,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 l)
-  (embedded-ps (list 'dashed-slur thick dash `(quote ,l))))
+(define (dashed-slur thick on off l)
+  (embedded-ps (list 'dashed-slur thick on off `(quote ,l))))
 
 (define (char font i)
   (string-append "\\" (tex-font-command font)