summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@xs4all.nl>2004-01-20 12:41:39 +0000
committerHan-Wen Nienhuys <hanwen@xs4all.nl>2004-01-20 12:41:39 +0000
commitad4427e49b45937f5153dd0db36b27feda8db6ee (patch)
tree211432b3ca56556bc60e6a6c606ca224852f9740
parent2c18f9324602e252bdd2a0b6f38f28f56c0e1aaf (diff)
*** empty log message ***
-rw-r--r--input/regression/accidental-ledger.ly39
-rw-r--r--lily/ambitus.cc4
-rw-r--r--lily/custos.cc2
-rw-r--r--lily/include/note-head.hh2
-rw-r--r--lily/mensural-ligature.cc2
-rw-r--r--lily/note-head.cc51
-rw-r--r--lily/vaticana-ligature.cc4
-rw-r--r--scm/define-grobs.scm2
-rw-r--r--scm/paper.scm2
-rw-r--r--scripts/convert-ly.py7
10 files changed, 81 insertions, 34 deletions
diff --git a/input/regression/accidental-ledger.ly b/input/regression/accidental-ledger.ly
index c1a0ce912d..d7270c032b 100644
--- a/input/regression/accidental-ledger.ly
+++ b/input/regression/accidental-ledger.ly
@@ -1,12 +1,39 @@
\version "2.1.7"
\header {
- texidoc = "Ledger lines are shortened when there are accidentals."
-}
-\score { \notes
-{
- c'!4 cis'! cis' <cis'! gis'>
+ texidoc = "Ledger lines are shortened when there are accidentals.
+This happens only for the single ledger line close to the note head,
+and only if the accidental is horizontally close to the head. "
+
}
- \paper { raggedright = ##t}
+
+
+\score {
+ \notes
+ \relative c {
+ disis
+ dis
+ d
+ des
+ deses
+ eses
+ es
+ e
+ eis
+ eisis
+ eses'''
+ es
+ e
+ eis
+ eisis
+ feses
+ fes
+ f
+ fis
+ fisis
+ <cis,, gis'>
+
+ }
+
}
diff --git a/lily/ambitus.cc b/lily/ambitus.cc
index 48eaa61711..b92a5f79e4 100644
--- a/lily/ambitus.cc
+++ b/lily/ambitus.cc
@@ -217,11 +217,11 @@ Ambitus::brew_molecule (SCM smob)
Molecule ledger_lines;
int interspaces = Staff_symbol_referencer::line_count (me) - 1;
ledger_lines =
- Note_head::brew_ledger_lines (me, p_min, interspaces, l_extents, true);
+ Note_head::brew_ledger_lines (me, p_min, interspaces, l_extents, 0,true);
ledger_lines.translate_axis (0.5 * p_min, Y_AXIS);
molecule.add_molecule (ledger_lines);
ledger_lines =
- Note_head::brew_ledger_lines (me, p_max, interspaces, l_extents, true);
+ Note_head::brew_ledger_lines (me, p_max, interspaces, l_extents, 0, true);
ledger_lines.translate_axis (0.5 * p_max, Y_AXIS);
molecule.add_molecule (ledger_lines);
diff --git a/lily/custos.cc b/lily/custos.cc
index 121357c476..7f0bb07f87 100644
--- a/lily/custos.cc
+++ b/lily/custos.cc
@@ -101,7 +101,7 @@ Custos::brew_molecule (SCM smob)
{
Molecule ledger_lines =
Note_head::brew_ledger_lines (me, pos, interspaces,
- molecule.extent (X_AXIS), true);
+ molecule.extent (X_AXIS), 0, true);
molecule.add_molecule (ledger_lines);
}
return molecule.smobbed_copy ();
diff --git a/lily/include/note-head.hh b/lily/include/note-head.hh
index 118022c700..15bdcbd4d8 100644
--- a/lily/include/note-head.hh
+++ b/lily/include/note-head.hh
@@ -23,7 +23,7 @@ public:
DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM ));
static Interval head_extent (Grob*, Axis);
static Molecule brew_ledger_lines (Grob *me, int pos, int interspaces,
- Interval x_extent, bool);
+ Interval x_extent, Real, bool);
DECLARE_SCHEME_CALLBACK (brew_ez_molecule, (SCM));
DECLARE_SCHEME_CALLBACK (extent, (SCM,SCM));
static bool has_interface (Grob*);
diff --git a/lily/mensural-ligature.cc b/lily/mensural-ligature.cc
index e8df8353a7..10fa80d31c 100644
--- a/lily/mensural-ligature.cc
+++ b/lily/mensural-ligature.cc
@@ -117,7 +117,7 @@ add_ledger_lines (Grob *me, Molecule *out, int pos, Real offs,
hd[RIGHT] + right_ledger_protusion);
Molecule ledger_lines =
Note_head::brew_ledger_lines (me, pos, interspaces,
- l_extents,
+ l_extents,0,
ledger_take_space);
ledger_lines.translate_axis (offs, Y_AXIS);
out->add_molecule (ledger_lines);
diff --git a/lily/note-head.cc b/lily/note-head.cc
index 5942c1dc6d..5c8688ef19 100644
--- a/lily/note-head.cc
+++ b/lily/note-head.cc
@@ -66,6 +66,7 @@ Note_head::brew_ledger_lines (Grob *me,
int pos,
int interspaces,
Interval x_extent,
+ Real left_shorten,
bool take_space)
{
Real inter_f = Staff_symbol_referencer::staff_space (me)/2;
@@ -84,22 +85,30 @@ Note_head::brew_ledger_lines (Grob *me,
Interval y_extent =
Interval (-0.5*(ledgerlinethickness),
+0.5*(ledgerlinethickness));
- Box ledger_line (x_extent, y_extent);
-
Molecule proto_ledger_line =
- Lookup::round_filled_box (ledger_line, blotdiameter);
+ Lookup::round_filled_box (Box (x_extent, y_extent), blotdiameter);
- if (!take_space)
- proto_ledger_line.set_empty (true);
+ x_extent[LEFT] += left_shorten;
+ Molecule proto_first_line =
+ Lookup::round_filled_box (Box (x_extent, y_extent), blotdiameter);
+ if (!take_space)
+ {
+ proto_ledger_line.set_empty (true);
+ proto_first_line.set_empty (true);
+ }
Direction dir = (Direction)sign (pos);
Real offs = (Staff_symbol_referencer::on_staffline (me, pos))
? 0.0
: -dir * inter_f;
+
for (int i = 0; i < line_count; i++)
{
- Molecule ledger_line (proto_ledger_line);
+ Molecule ledger_line ((i == 0)
+ ? proto_first_line
+ : proto_ledger_line
+ );
ledger_line.translate_axis (-dir * inter_f * i * 2 + offs, Y_AXIS);
molecule.add_molecule (ledger_line);
}
@@ -134,10 +143,10 @@ internal_brew_molecule (Grob *me, bool with_ledgers)
if (with_ledgers && interspaces >= 0
&& abs (pos) - interspaces > 1)
{
- Interval hd = out.extent (X_AXIS);
- Real left_ledger_protusion = hd.length ()/4;
- Real right_ledger_protusion = left_ledger_protusion;
+ Interval ledger_size = out.extent (X_AXIS);
+ ledger_size.widen ( ledger_size.length ()/4);
+ Real left_shorten =0.0;
if (Grob * g = unsmob_grob(me->get_grob_property ("accidental-grob")))
{
/*
@@ -149,16 +158,21 @@ internal_brew_molecule (Grob *me, bool with_ledgers)
Grob *common = g->common_refpoint (me, X_AXIS);
Real d =
- me->extent (common, X_AXIS)[LEFT]
- -g->extent (common, X_AXIS)[RIGHT];
-
- left_ledger_protusion = left_ledger_protusion <? (d/2);
+ (me->extent (common, X_AXIS)[LEFT]
+ +g->extent (common, X_AXIS)[RIGHT]) /2;
+
+ left_shorten = (-ledger_size[LEFT] + d) >? 0 ;
+
+ /*
+ TODO: shorten 2 ledger lines for the case natural +
+ downstem.
+ */
}
- Interval l_extents = Interval (hd[LEFT] - left_ledger_protusion,
- hd[RIGHT] + right_ledger_protusion);
out.add_molecule (Note_head::brew_ledger_lines (me, pos, interspaces,
- l_extents, false));
+ ledger_size,
+ left_shorten,
+ false));
}
return out;
}
@@ -250,9 +264,8 @@ Note_head::brew_ez_molecule (SCM smob)
if (abs (pos) - interspaces > 1)
{
Interval hd = m.extent (X_AXIS);
- Real hw = hd.length ()/4;
- Interval extent = Interval (hd[LEFT] - hw, hd[RIGHT] + hw);
- m.add_molecule (brew_ledger_lines (me, pos, interspaces, extent, false));
+ hd.widen ( hd.length ()/4);
+ m.add_molecule (brew_ledger_lines (me, pos, interspaces, hd, 0, false));
}
return m.smobbed_copy ();
diff --git a/lily/vaticana-ligature.cc b/lily/vaticana-ligature.cc
index 2368aa36fc..516de50b3f 100644
--- a/lily/vaticana-ligature.cc
+++ b/lily/vaticana-ligature.cc
@@ -205,7 +205,7 @@ vaticana_add_ledger_lines (Grob *me, Molecule *out, int pos, Real offs,
hd[RIGHT] + right_ledger_protusion);
Molecule ledger_lines =
Note_head::brew_ledger_lines (me, pos, interspaces,
- l_extents,
+ l_extents, 0,
ledger_take_space);
ledger_lines.translate_axis (offs, Y_AXIS);
out->add_molecule (ledger_lines);
@@ -260,7 +260,7 @@ vaticana_brew_primitive (Grob *me, bool ledger_take_space)
* flexa_width.)
*/
Real staff_space = Staff_symbol_referencer::staff_space (me);
- Real flexa_width = robust_scm2double ( me->get_grob_property ("flexa-width"), 2);
+ Real flexa_width = robust_scm2double ( me->get_grob_property ("flexa-width"), 2) *staff_space;
out =
Lookup::blank (Box (Interval (0, 0.5*flexa_width), Interval (0,0)));
}
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index f9d50fdf77..2e8121993d 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -28,7 +28,7 @@
;; this is quite small, but it is very ugly to have
;; accs closer to the previous note than to the next one.
- (right-padding . 0.15)
+ (right-padding . 0.2)
(meta . ((interfaces . (item-interface accidental-placement-interface))))
))
diff --git a/scm/paper.scm b/scm/paper.scm
index 56110a32bf..2b5e18024f 100644
--- a/scm/paper.scm
+++ b/scm/paper.scm
@@ -25,7 +25,7 @@
(module-define! m 'interscoreline (* 4 mm))
))
-(define-public (set-staff-size sz)
+(define-public (set-global-staff-size sz)
"Set the default staff size, where SZ is thought to be in PT."
(let*
((old-mod (current-module))
diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py
index b896051802..f961537f41 100644
--- a/scripts/convert-ly.py
+++ b/scripts/convert-ly.py
@@ -1694,6 +1694,13 @@ def conv (str):
conversions.append (((2,1,12), conv, """OttavaSpanner -> OttavaBracket"""))
+def conv (str):
+ str =re.sub (r"\(set-staff-size ", r"(set-global-staff-size", str)
+ return str
+
+conversions.append (((2,1,13), conv, """set-staff-size -> set-global-staff-size"""))
+
+
################################
# END OF CONVERSIONS
################################