summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Puttock <n.puttock@gmail.com>2008-11-22 17:19:18 +0000
committerNeil Puttock <n.puttock@gmail.com>2008-11-22 17:19:18 +0000
commitc2a0e17ed7739c43258389149a2d51cda34fb7bd (patch)
treea0a9cac4c1168ccd4a26a96985b64512d6499639
parentd829124c73ec0b92841ab32e64c711ede626e0c8 (diff)
More tweakable percent repeat glyphs.
- use grob properties for dot_neg_kern and slash_neg_kern.
-rw-r--r--input/regression/repeat-percent-kerning.ly21
-rw-r--r--lily/include/percent-repeat-item.hh2
-rw-r--r--lily/multi-measure-rest.cc2
-rw-r--r--lily/percent-repeat-item.cc18
-rw-r--r--scm/define-grob-interfaces.scm2
-rw-r--r--scm/define-grob-properties.scm8
-rw-r--r--scm/define-grobs.scm3
7 files changed, 44 insertions, 12 deletions
diff --git a/input/regression/repeat-percent-kerning.ly b/input/regression/repeat-percent-kerning.ly
new file mode 100644
index 0000000000..530fb1ab0f
--- /dev/null
+++ b/input/regression/repeat-percent-kerning.ly
@@ -0,0 +1,21 @@
+\version "2.11.65"
+\header {
+ texidoc = "The positioning of dots and slashes in percent repeat
+glyphs can be altered using @code{dot-negative-kern} and
+@code{slash-negative-kern}."
+}
+
+<<
+ \new Staff {
+ \set Staff.instrumentName = #"(default)"
+ \repeat percent 2 { c'1 }
+ \repeat percent 2 { d'1 e' }
+ }
+ \new Staff {
+ \override PercentRepeat #'dot-negative-kern = #1.1
+ \repeat percent 2 { c'1 }
+ \override DoublePercentRepeat #'dot-negative-kern = #0
+ \override DoublePercentRepeat #'slash-negative-kern = #1
+ \repeat percent 2 { d'1 e' }
+ }
+>>
diff --git a/lily/include/percent-repeat-item.hh b/lily/include/percent-repeat-item.hh
index 990a31873d..be3f06247b 100644
--- a/lily/include/percent-repeat-item.hh
+++ b/lily/include/percent-repeat-item.hh
@@ -18,7 +18,7 @@ public:
DECLARE_GROB_INTERFACE();
DECLARE_SCHEME_CALLBACK (beat_slash, (SCM));
DECLARE_SCHEME_CALLBACK (double_percent, (SCM));
- static Stencil x_percent (Grob *, int, Real, Real);
+ static Stencil x_percent (Grob *, int);
static Stencil brew_slash (Grob *);
};
diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc
index d16a11e3db..d5b490d1e9 100644
--- a/lily/multi-measure-rest.cc
+++ b/lily/multi-measure-rest.cc
@@ -47,7 +47,7 @@ Multi_measure_rest::percent (SCM smob)
Grob *me = unsmob_grob (smob);
Spanner *sp = dynamic_cast<Spanner *> (me);
- Stencil r = Percent_repeat_item_interface::x_percent (me, 1, 0.75, 1.6);
+ Stencil r = Percent_repeat_item_interface::x_percent (me, 1);
// ugh copy & paste.
diff --git a/lily/percent-repeat-item.cc b/lily/percent-repeat-item.cc
index b0c86c45b4..a38f77cb9d 100644
--- a/lily/percent-repeat-item.cc
+++ b/lily/percent-repeat-item.cc
@@ -26,17 +26,17 @@ Percent_repeat_item_interface::brew_slash (Grob *me)
return m;
}
-/*
- todo: use grob props for dot_neg_kern, slash_neg_kern?
-*/
Stencil
-Percent_repeat_item_interface::x_percent (Grob *me, int count,
- Real dot_neg_kern,
- Real slash_neg_kern)
+Percent_repeat_item_interface::x_percent (Grob *me, int count)
{
Stencil m;
Stencil s = brew_slash (me);
+ Real dot_neg_kern =
+ robust_scm2double (me->get_property ("dot-negative-kern"), 0.75);
+ Real slash_neg_kern =
+ robust_scm2double (me->get_property ("slash-negative-kern"), 1.6);
+
for (int i = count; i--;)
m.add_at_edge (X_AXIS, RIGHT, s, -slash_neg_kern);
Stencil d1 = Font_interface::get_default_font (me)->find_by_name ("dots.dot");
@@ -47,6 +47,7 @@ Percent_repeat_item_interface::x_percent (Grob *me, int count,
m.add_at_edge (X_AXIS, LEFT, d1, -dot_neg_kern);
m.add_at_edge (X_AXIS, RIGHT, d2, -dot_neg_kern);
+ m.translate_axis (- m.extent (X_AXIS).center (), X_AXIS);
return m;
}
@@ -55,8 +56,7 @@ SCM
Percent_repeat_item_interface::double_percent (SCM grob)
{
Grob *me = unsmob_grob (grob);
- Stencil m = x_percent (me, 2, 0.75, 1.6);
- m.translate_axis (- m.extent (X_AXIS).center (), X_AXIS);
+ Stencil m = x_percent (me, 2);
return m.smobbed_copy ();
}
@@ -74,6 +74,8 @@ ADD_INTERFACE (Percent_repeat_item_interface,
"Repeats that look like percent signs.",
/* properties */
+ "dot-negative-kern "
+ "slash-negative-kern "
"slope "
"thickness "
);
diff --git a/scm/define-grob-interfaces.scm b/scm/define-grob-interfaces.scm
index b5ffda6574..7185bd20d3 100644
--- a/scm/define-grob-interfaces.scm
+++ b/scm/define-grob-interfaces.scm
@@ -124,7 +124,7 @@ note)."
(ly:add-interface
'percent-repeat-interface
"Beat, Double and single measure repeats."
- '(slope thickness))
+ '(dot-negative-kern slash-negative-kern slope thickness))
(ly:add-interface
'piano-pedal-interface
diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm
index ed1837c8c6..619adf3106 100644
--- a/scm/define-grob-properties.scm
+++ b/scm/define-grob-properties.scm
@@ -1,4 +1,4 @@
-;;;; grob-property-description.scm -- part of generated backend documentation
+;;;; define-grob-properties.scm -- part of generated backend documentation
;;;;
;;;; source file of the GNU LilyPond music typesetter
;;;;
@@ -168,6 +168,9 @@ other object. Otherwise, it determines whether the object is placed
be used: @code{#UP}=@code{1}, @code{#DOWN}=@code{-1},
@code{#LEFT}=@code{-1}, @code{#RIGHT}=@code{1}, @code{#CENTER}=@code{0}.")
(dot-count ,integer? "The number of dots.")
+ (dot-negative-kern ,number? "The space to remove between a dot
+a and slash in percent repeat glyphs. Larger values bring the two
+elements closer together.")
(dot-placement-list ,list? "List
consisting of @code{(@var{description} @var{string-number}
@var{fret-number} @var{finger-number})}
@@ -566,6 +569,9 @@ is placed vertically.")
@code{direction-source} with this to get the direction of this
object.")
(size ,number? "Size of object, relative to standard size.")
+ (slash-negative-kern ,number? "The space to remove between
+slashes in percent repeat glyphs. Larger values bring the two
+elements closer together.")
(slope ,number? "The slope of this object.")
(slur-padding ,number? "Extra distance between slur and script.")
(space-alist ,list? "A table that specifies distances between
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index 1ae24412d6..0c1df0a257 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -566,6 +566,8 @@
(stencil . ,ly:percent-repeat-item-interface::double-percent)
(non-musical . #t)
(slope . 1.0)
+ (dot-negative-kern . 0.75)
+ (slash-negative-kern . 1.6)
(font-encoding . fetaMusic)
(width . 2.0)
(thickness . 0.48)
@@ -1315,6 +1317,7 @@
(stencil . ,ly:multi-measure-rest::percent)
(slope . 1.0)
(thickness . 0.48)
+ (dot-negative-kern . 0.75)
(font-encoding . fetaMusic)
(meta . ((class . Spanner)
(interfaces . (multi-measure-rest-interface