summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@xs4all.nl>2007-07-29 10:21:49 -0700
committerHan-Wen Nienhuys <hanwen@xs4all.nl>2007-07-29 10:21:49 -0700
commit6dbf08cdc7c36d3b79dc757cab283423a40cd4a6 (patch)
tree69518178e63b3ea47cab09cbbab36dab289532be
parent0a082340177f39ec26b1fc73032f751335b9c1cc (diff)
Do not generate negative dash pattern entries for small dash-periods.
-rw-r--r--input/regression/line-dash-small-period.ly16
-rw-r--r--lily/line-interface.cc3
-rw-r--r--lily/ottava-bracket.cc3
-rw-r--r--ps/music-drawing-routines.ps2
4 files changed, 21 insertions, 3 deletions
diff --git a/input/regression/line-dash-small-period.ly b/input/regression/line-dash-small-period.ly
new file mode 100644
index 0000000000..8bbb1cb7d7
--- /dev/null
+++ b/input/regression/line-dash-small-period.ly
@@ -0,0 +1,16 @@
+\header {
+
+ texidoc = "Generate valid postscript even if dash-period is small
+ compared to line thickness."
+
+}
+
+\version "2.11.29"
+\relative {
+ \override Staff.OttavaBracket #'dash-period = #0.1
+ \override Score.OttavaBracket #'dash-fraction = #1
+
+ #(set-octavation 1)
+ c4 c
+}
+
diff --git a/lily/line-interface.cc b/lily/line-interface.cc
index 8720bba596..f936b0498f 100644
--- a/lily/line-interface.cc
+++ b/lily/line-interface.cc
@@ -127,7 +127,7 @@ Line_interface::make_dashed_line (Real thick, Offset from, Offset to,
{
dash_fraction = min (max (dash_fraction, 0.0), 1.0);
Real on = dash_fraction * dash_period + thick;
- Real off = dash_period - on;
+ Real off = max (0.0, dash_period - on);
SCM at = scm_list_n (ly_symbol2scm ("dashed-line"),
scm_from_double (thick),
@@ -231,6 +231,7 @@ Line_interface::line (Grob *me, Offset from, Offset to)
Real len = (to-from).length ();
int n = (int) rint ((len - period * fraction) / period);
+ n = max (0, n);
if (n > 0)
{
/*
diff --git a/lily/ottava-bracket.cc b/lily/ottava-bracket.cc
index cfd1d5d036..2f23261eb9 100644
--- a/lily/ottava-bracket.cc
+++ b/lily/ottava-bracket.cc
@@ -69,7 +69,8 @@ Ottava_bracket::print (SCM smob)
SCM markup = me->get_property ("text");
Stencil text;
if (Text_interface::is_markup (markup))
- text = *unsmob_stencil (Text_interface::interpret_markup (layout->self_scm (), properties, markup));
+ text = *unsmob_stencil (Text_interface::interpret_markup (layout->self_scm (),
+ properties, markup));
Drul_array<Real> shorten = robust_scm2interval (me->get_property ("shorten-pair"),
Interval (0, 0));
diff --git a/ps/music-drawing-routines.ps b/ps/music-drawing-routines.ps
index 2df5913acc..e263d3d29e 100644
--- a/ps/music-drawing-routines.ps
+++ b/ps/music-drawing-routines.ps
@@ -197,7 +197,7 @@ bind def
stroke
} bind def
-/draw_dashed_line % dx dy thickness dashpattern draw_dashed_line
+/draw_dashed_line % dx dy thickness dashpattern offset draw_dashed_line
{
1 setlinecap
1 setlinejoin