[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Proposed patch to modify #'style of line objects
From: |
Mats Bengtsson |
Subject: |
Proposed patch to modify #'style of line objects |
Date: |
Thu, 01 Nov 2007 11:38:36 +0100 |
User-agent: |
Thunderbird 2.0.0.5 (X11/20070716) |
Hi,
The current mechanism to get solid versus dashed lines in LilyPond has
been irritating me for several years. We do have the option to set
both #'style = #'line and #'style = #dashed-line but currently both
give the same result and you instead have to set #'dash-fraction = #'()
to get a solid line.
Below, you can find a patch that gives a much more intuitive behavior,
namely that #'style=#'line gives a solid line whereas #'style=#'dashed-line
gives ... guess what. This will fix
http://code.google.com/p/lilypond/issues/detail?id=505
I realize that this might break some existing code and have tried to fix it
in the regression test files I could find (the example line-arrows.ly in LSR
has to be updated correspondingly). Also, the current behavior is mentioned
at one place in the manual, which should be updated in GDP.
Does anybody have any objections or can I submit?
Maybe I should also add a rule in convert-ly that warns everybody who
has set
the dash-fraction property.
/Mats
diff --git a/input/regression/line-arrows.ly
b/input/regression/line-arrows.ly
index 7512711..10b9ae9 100644
--- a/input/regression/line-arrows.ly
+++ b/input/regression/line-arrows.ly
@@ -10,7 +10,7 @@
\relative c'' {
\override TextSpanner #'bound-padding = #1.0
- \override TextSpanner #'dash-fraction = #'()
+ \override TextSpanner #'style = #line
\override TextSpanner #'bound-details #'right #'arrow = ##t
\override TextSpanner #'bound-details #'left #'text = #"fof"
\override TextSpanner #'bound-details #'right #'text = #"gag"
diff --git a/input/regression/line-dashed-period.ly
b/input/regression/line-dashed-period.ly
index dd0b55e..0ebeb5d 100644
--- a/input/regression/line-dashed-period.ly
+++ b/input/regression/line-dashed-period.ly
@@ -14,8 +14,8 @@ starts and ends on a full dash. "
\relative <<
\new Staff {
- \override DynamicTextSpanner #'dash-fraction = ##f
\setTextCresc
+ \set crescendoSpanner = #'line
c1_\< c c1\!
}
\new Staff {
diff --git a/input/regression/line-style.ly b/input/regression/line-style.ly
index 4d33f49..135e897 100644
--- a/input/regression/line-style.ly
+++ b/input/regression/line-style.ly
@@ -12,7 +12,7 @@
s2
d2 \glissando d'2
- \once \override Glissando #'dash-fraction = #0.5
+ \override Glissando #'style = #'dashed-line
d,2 \glissando d'2
\override Glissando #'style = #'dotted-line
d,2 \glissando d'2
diff --git a/lily/line-interface.cc b/lily/line-interface.cc
index f936b04..b3f110f 100644
--- a/lily/line-interface.cc
+++ b/lily/line-interface.cc
@@ -212,14 +212,13 @@ Line_interface::line (Grob *me, Offset from,
Offset to)
Stencil stil;
- SCM dash_fraction = me->get_property ("dash-fraction");
- if (scm_is_number (dash_fraction) || type == ly_symbol2scm
("dotted-line"))
+ if (type == ly_symbol2scm ("dashed-line") || type == ly_symbol2scm
("dotted-line"))
{
Real fraction
= type == ly_symbol2scm ("dotted-line")
? 0.0
- : robust_scm2double (dash_fraction, 0.4);
+ : robust_scm2double (me->get_property ("dash-fraction"), 0.4);
fraction = min (max (fraction, 0.0), 1.0);
Real period = Staff_symbol_referencer::staff_space (me)
@@ -249,11 +248,14 @@ Line_interface::line (Grob *me, Offset from,
Offset to)
}
ADD_INTERFACE (Line_interface,
- "Generic line objects. Any object using lines supports
this. Normally, "
- "you get a straight line. If @code{dash-period} is defined,
a dashed line is "
- "produced; the length of the dashes is tuned with "
+ "Generic line objects. Any object using lines supports this. "
+ "The property @code{style} can be @code{line}, "
+ "@code{dashed-line}, @code{trill}, \n"
+ "@code{dotted-line} or @code{zigzag}.\n"
+ "\n",
+ "For dashed-line, the length of the dashes is tuned with "
"@code{dash-fraction}. If the latter is set to 0, a dotted
line is "
- "produced. If @code{dash-fraction} is negative, the line is
made "
+ "produced. If @code{dash-period} is negative, the line is made "
"transparent.",
/* properties */
diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly
index 4a09d7c..e390ef7 100644
--- a/ly/engraver-init.ly
+++ b/ly/engraver-init.ly
@@ -744,14 +744,10 @@ of Editio Vaticana."
%% Prepare TextSpanner for \episem{Initium|Finis} use.
%%
- %% N.B.: dash-fraction MUST be unset; otherwise, TextSpanner will
- %% always produce dashed lines, regardless of the style property.
- %%
%% FIXME: The line @code{\override TextSpanner #'padding = #-0.1} is
%% required to force the articulation signs being placed vertically
%% tightly to the correpsonding note heads.
%%
- \override TextSpanner #'dash-fraction = #'()
\override TextSpanner #'style = #'line
\override TextSpanner #'padding = #-0.1
}
--
=============================================
Mats Bengtsson
Signal Processing
Signals, Sensors and Systems
Royal Institute of Technology
SE-100 44 STOCKHOLM
Sweden
Phone: (+46) 8 790 8463
Fax: (+46) 8 790 7260
Email: address@hidden
WWW: http://www.s3.kth.se/~mabe
=============================================
- Proposed patch to modify #'style of line objects,
Mats Bengtsson <=
Re: Proposed patch to modify #'style of line objects, Rune Zedeler, 2007/11/15