[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Dashed slur proposal
From: |
Bertalan Fodor |
Subject: |
Re: Dashed slur proposal |
Date: |
Wed, 09 Feb 2005 19:04:53 +0100 |
User-agent: |
Mozilla Thunderbird 1.0 (Windows/20041206) |
I've created the patches for the 2.4 branch. What do you say?
Should convert-ly also be modified?
I've attached a sample image: the new output of (the new)
input/slur-dash.ly
True that it's too simplistic, but better than it was.
Bert
Index: input/test/slur-dash.ly
===================================================================
RCS file: /cvsroot/lilypond/lilypond/input/test/slur-dash.ly,v
retrieving revision 1.42
diff -u -r1.42 slur-dash.ly
--- input/test/slur-dash.ly 30 Oct 2004 20:55:16 -0000 1.42
+++ input/test/slur-dash.ly 9 Feb 2005 17:56:15 -0000
@@ -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 @@
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: lily/lookup.cc
===================================================================
RCS file: /cvsroot/lilypond/lilypond/lily/lookup.cc,v
retrieving revision 1.168
diff -u -r1.168 lookup.cc
--- lily/lookup.cc 29 Oct 2004 20:49:29 -0000 1.168
+++ lily/lookup.cc 9 Feb 2005 17:56:17 -0000
@@ -76,10 +76,13 @@
}
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 @@
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: lily/slur.cc
===================================================================
RCS file: /cvsroot/lilypond/lilypond/lily/slur.cc,v
retrieving revision 1.204
diff -u -r1.204 slur.cc
--- lily/slur.cc 14 Oct 2004 22:16:41 -0000 1.204
+++ lily/slur.cc 9 Feb 2005 17:56:18 -0000
@@ -71,9 +71,11 @@
/*
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 @@
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: lily/include/lookup.hh
===================================================================
RCS file: /cvsroot/lilypond/lilypond/lily/include/lookup.hh,v
retrieving revision 1.80
diff -u -r1.80 lookup.hh
--- lily/include/lookup.hh 13 Feb 2004 00:32:23 -0000 1.80
+++ lily/include/lookup.hh 9 Feb 2005 17:56:27 -0000
@@ -26,7 +26,7 @@
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: ly/property-init.ly
===================================================================
RCS file: /cvsroot/lilypond/lilypond/ly/property-init.ly,v
retrieving revision 1.64
diff -u -r1.64 property-init.ly
--- ly/property-init.ly 30 Oct 2004 20:55:17 -0000 1.64
+++ ly/property-init.ly 9 Feb 2005 17:56:28 -0000
@@ -11,8 +11,18 @@
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: scm/define-grob-properties.scm
===================================================================
RCS file: /cvsroot/lilypond/lilypond/scm/define-grob-properties.scm,v
retrieving revision 1.83
diff -u -r1.83 define-grob-properties.scm
--- scm/define-grob-properties.scm 24 Oct 2004 22:24:25 -0000 1.83
+++ scm/define-grob-properties.scm 9 Feb 2005 17:56:32 -0000
@@ -150,7 +150,7 @@
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: scm/output-pdf.scm
===================================================================
RCS file: /cvsroot/lilypond/lilypond/scm/output-pdf.scm,v
retrieving revision 1.8
diff -u -r1.8 output-pdf.scm
--- scm/output-pdf.scm 13 Jun 2004 21:53:52 -0000 1.8
+++ scm/output-pdf.scm 9 Feb 2005 17:56:33 -0000
@@ -101,10 +101,10 @@
(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: scm/output-pdftex.scm
===================================================================
RCS file: /cvsroot/lilypond/lilypond/scm/output-pdftex.scm,v
retrieving revision 1.14
diff -u -r1.14 output-pdftex.scm
--- scm/output-pdftex.scm 10 Jul 2004 10:30:14 -0000 1.14
+++ scm/output-pdftex.scm 9 Feb 2005 17:56:34 -0000
@@ -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: scm/output-ps.scm
===================================================================
RCS file: /cvsroot/lilypond/lilypond/scm/output-ps.scm,v
retrieving revision 1.89
diff -u -r1.89 output-ps.scm
--- scm/output-ps.scm 10 Oct 2004 11:42:06 -0000 1.89
+++ scm/output-ps.scm 9 Feb 2005 17:56:34 -0000
@@ -128,16 +128,15 @@
" ] 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: scm/output-sketch.scm
===================================================================
RCS file: /cvsroot/lilypond/lilypond/scm/output-sketch.scm,v
retrieving revision 1.9
diff -u -r1.9 output-sketch.scm
--- scm/output-sketch.scm 13 Jun 2004 21:53:52 -0000 1.9
+++ scm/output-sketch.scm 9 Feb 2005 17:56:34 -0000
@@ -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)
@@ -218,15 +218,15 @@
;; 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: scm/output-tex.scm
===================================================================
RCS file: /cvsroot/lilypond/lilypond/scm/output-tex.scm,v
retrieving revision 1.67
diff -u -r1.67 output-tex.scm
--- scm/output-tex.scm 31 Jul 2004 21:22:42 -0000 1.67
+++ scm/output-tex.scm 9 Feb 2005 17:56:35 -0000
@@ -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)