--- /dev/null
+\version "2.13.4"
+
+\header {
+ texidoc = "The gaps between an @code{AmbitusLine} and its
+note heads are set by the @code{gap} property."
+}
+
+\layout {
+ \context {
+ \Voice
+ \consists "Ambitus_engraver"
+ }
+}
+
+\new Staff {
+ \time 2/4
+ \override AmbitusLine #'gap = #1
+ c'4 g''
+}
+
-\header {
- texidoc = "Ambituses use actual pitch not lexicographic ordering."
- }
-
\version "2.12.0"
-\paper {
- ragged-right=##t
+\header {
+ texidoc = "Ambitus use actual pitch not lexicographic ordering."
}
\new Voice \with { \consists "Ambitus_engraver" } {
- \clef F c eis fes
+ \clef F
+ c4 eis fes2
}
+
+\version "2.12.0"
+
\header {
- texidoc = "Ambituses indicate pitch ranges for voices.
+ texidoc = "Ambitus indicate pitch ranges for voices.
Accidentals only show up if they're not part of key
-signature. @code{AmbitusNoteHead} grobs also have ledger lines.
-
+signature. @code{AmbitusNoteHead} grobs also have ledger lines.
"
}
-\version "2.12.0"
\layout {
- ragged-right = ##t
- \context {
- \Voice
- \consists Ambitus_engraver
- }
+ \context {
+ \Voice
+ \consists "Ambitus_engraver"
+ }
}
-\relative
<<
- \new Staff { \time 2/4 c4 f' }
- \new Staff \relative {
- \time 2/4
- \key d \major
- cis as'
- }
+ \new Staff \relative c'{
+ \time 2/4
+ c4 f'
+ }
+ \new Staff \relative c' {
+ \time 2/4
+ \key d \major
+ cis as'
+ }
>>
Ambitus_engraver::Ambitus_engraver ()
{
ambitus_ = 0;
- heads_[LEFT] = heads_[RIGHT] = 0;
- accidentals_[LEFT] = accidentals_[RIGHT] = 0;
+ heads_.set (0, 0);
+ accidentals_.set (0, 0);
group_ = 0;
is_typeset_ = false;
start_key_sig_ = SCM_EOL;
if (ambitus_ && !pitch_interval_.is_empty ())
{
Grob *accidental_placement =
- make_item ("AccidentalPlacement",
- accidentals_[DOWN]->self_scm ());
+ make_item ("AccidentalPlacement", accidentals_[DOWN]->self_scm ());
Direction d = DOWN;
do
Pitch p = pitch_interval_[d];
heads_[d]->set_property ("cause", causes_[d]->self_scm());
heads_[d]->set_property ("staff-position",
- scm_from_int (start_c0_
- + p.steps ()));
+ scm_from_int (start_c0_ + p.steps ()));
SCM handle = scm_assoc (scm_cons (scm_from_int (p.get_octave ()),
scm_from_int (p.get_notename ())),
start_key_sig_);
Rational sig_alter = (handle != SCM_BOOL_F)
- ? robust_scm2rational (scm_cdr (handle), Rational (0)) : Rational (0);
+ ? robust_scm2rational (scm_cdr (handle), Rational (0))
+ : Rational (0);
if (sig_alter == p.get_alteration ())
{
heads_[d]->set_object ("accidental-grob", SCM_EOL);
}
else
- {
- accidentals_[d]->set_property ("alteration", ly_rational2scm (p.get_alteration ()));
- }
- Separation_item::add_conditional_item (heads_[d], accidental_placement);
- Accidental_placement::add_accidental (accidental_placement, accidentals_[d]);
+ accidentals_[d]->
+ set_property ("alteration",
+ ly_rational2scm (p.get_alteration ()));
+ Separation_item::add_conditional_item (heads_[d],
+ accidental_placement);
+ Accidental_placement::add_accidental (accidental_placement,
+ accidentals_[d]);
+ Pointer_group_interface::add_grob (ambitus_,
+ ly_symbol2scm ("note-heads"),
+ heads_[d]);
}
while (flip (&d) != DOWN);
-
- Pointer_group_interface::add_grob (ambitus_, ly_symbol2scm ("note-heads"), heads_[DOWN]);
- Pointer_group_interface::add_grob (ambitus_, ly_symbol2scm ("note-heads"), heads_[UP]);
Axis_group_interface::add_element (group_, accidental_placement);
}
else
{
accidentals_[d]->suicide ();
heads_[d]->suicide ();
- }
+ }
while (flip (&d) != DOWN);
ambitus_->suicide ();
ADD_ACKNOWLEDGER (Ambitus_engraver, note_head);
ADD_TRANSLATOR (Ambitus_engraver,
/* doc */
- "",
+ "Create an ambitus.",
/* create */
"AccidentalPlacement "
"AmbitusNoteHead ",
/* read */
- "",
+ "keySignature "
+ "middleCPosition ",
/* write */
""
+++ /dev/null
-/*
- ambitus.cc -- implement Ambitus
-
- source file of the GNU LilyPond music typesetter
-
- (c) 2002--2009 Juergen Reuter <reuter@ipd.uka.de>
-*/
-
-#include "ambitus.hh"
-
-#include "staff-symbol-referencer.hh"
-#include "pitch.hh"
-#include "note-head.hh"
-#include "item.hh"
-#include "font-interface.hh"
-#include "output-def.hh"
-#include "lookup.hh"
-#include "pointer-group-interface.hh"
-
-MAKE_SCHEME_CALLBACK (Ambitus, print, 1);
-SCM
-Ambitus::print (SCM smob)
-{
- Item *me = (Item *) unsmob_grob (smob);
- Stencil stencil;
-
- // FIXME : should be Ambitus_line join heads
- extract_grob_set (me, "note-heads", heads);
- if (to_boolean (me->get_property ("join-heads"))
- && heads.size () > 1)
- {
- Grob *common
- = common_refpoint_of_array (vector<Grob*> (heads.begin (),
- heads.begin () + 2),
- me, Y_AXIS);
-
- Grob *minh = heads[0];
- Grob *maxh = heads[1];
-
- if (minh->relative_coordinate (common, Y_AXIS)
- > maxh->relative_coordinate (common, Y_AXIS))
- {
- Grob *t = maxh;
- maxh = minh;
- minh = t;
- }
-
- Real pad = 0.35;
- Real pmax = maxh->extent (common, Y_AXIS)[DOWN] - pad;
- Real pmin = minh->extent (common, Y_AXIS)[UP] + pad;
-
- if (pmin < pmax)
- {
- Real linethickness = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"))
- * robust_scm2double (me->get_property ("thickness"), 1.0);
- Real blotdiameter = me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"));
- Interval x_extent = 0.5 * linethickness * Interval (-1, 1);
- Interval y_extent = Interval (pmin, pmax);
- Box line_box (x_extent, y_extent);
-
- Stencil line = Lookup::round_filled_box (line_box, blotdiameter);
- line.translate_axis (- me->relative_coordinate (common, Y_AXIS),
- Y_AXIS);
- return line.smobbed_copy ();
- }
- }
-
- return SCM_EOL;
-}
-
-ADD_INTERFACE (Ambitus,
- "The line between note heads for a pitch range.",
-
- /* properties */
- "join-heads "
- "note-heads "
- "thickness "
- );
+++ /dev/null
-/*
- ambitus.hh
-
- source file of the GNU LilyPond music typesetter
-
- (c) 2000--2009 Juergen Reuter <reuter@ipd.uka.de>
-*/
-
-#ifndef AMBITUS_HH
-#define AMBITUS_HH
-
-#include "lily-proto.hh"
-#include "grob-interface.hh"
-
-struct Ambitus
-{
- DECLARE_SCHEME_CALLBACK (print, (SCM smob));
- DECLARE_GROB_INTERFACE();
- static Slice get_positions (Grob *);
- static Interval head_width (Grob *me, Grob *common);
-};
-
-#endif // AMBITUS_HH
-
Different settings for vertical layout.\n\
ly:system-start-text::print -> system-start-text::print\n\
Beam #'thickness -> Beam #'beam-thickness\n\
-ly:note-head::brew-ez-stencil -> note-head::brew-ez-stencil"))
+ly:note-head::brew-ez-stencil -> note-head::brew-ez-stencil\n\
+ly:ambitus::print -> ambitus::print"))
def conv(str):
if re.search("override-auto-beam-setting", str):
stderr_write ("\n")
stderr_write(NOT_SMART % _("alignment-offsets has been changed to alignment-distances: \
you must now specify the distances between staves rather than the offset of staves.\n"))
stderr_write(UPDATE_MANUALLY)
- str = re.sub ('ly:(system-start-text::print|note-head::brew-ez-stencil)',
+ str = re.sub ('ly:(system-start-text::print|note-head::brew-ez-stencil|ambitus::print)',
'\\1', str)
str = re.sub ('(\\bBeam\\s+#\')(?=thickness\\b)', '\\1beam-', str)
return str
note)."
'())
+(ly:add-interface
+ 'ambitus-interface
+ "The line between note heads for a pitch range."
+ '(gap note-heads thickness))
+
(ly:add-interface
'bass-figure-interface
"A bass figure text."
has affinity. See @var{next-staff-spacing} for the format of this list.")
-
;;
;; k
;;
(inclinatum ,boolean? "Is this neume an inclinatum?")
- (join-heads ,boolean? "Whether to join the note heads of an ambitus
-grob with a vertical line.")
(join-right-amount ,number? "A length used for calculating the
Y-extent of mensural ligatures.")
(AmbitusLine
. (
- (join-heads . #t)
- (stencil . ,ly:ambitus::print)
+ (gap . 0.35)
+ (stencil . ,ambitus::print)
(thickness . 2)
(X-offset . ,ly:self-alignment-interface::centered-on-x-parent)
(meta . ((class . Item)
(interfaces . (ambitus-interface
- font-interface
- staff-symbol-referencer-interface))))))
+ font-interface))))))
(AmbitusNoteHead
. (
(define-public empty-interval '(+inf.0 . -inf.0))
+(define-public (symmetric-interval expr)
+ (cons (- expr) expr))
+
(define-public (interval-length x)
"Length of the number-pair X, when an interval"
(max 0 (- (cdr x) (car x))))
(+
(ly:self-alignment-interface::y-aligned-on-self grob)
(interval-center extent))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; ambitus
+
+(define-public (ambitus::print grob)
+ (let ((heads (ly:grob-object grob 'note-heads)))
+
+ (if (and (ly:grob-array? heads)
+ (= (ly:grob-array-length heads) 2))
+ (let* ((common (ly:grob-common-refpoint-of-array grob heads Y))
+ (head-down (ly:grob-array-ref heads 0))
+ (head-up (ly:grob-array-ref heads 1))
+ (gap (ly:grob-property grob 'gap 0.35))
+ (point-min (+ (interval-end (ly:grob-extent head-down common Y))
+ gap))
+ (point-max (- (interval-start (ly:grob-extent head-up common Y))
+ gap)))
+
+ (if (< point-min point-max)
+ (let* ((layout (ly:grob-layout grob))
+ (line-thick (ly:output-def-lookup layout 'line-thickness))
+ (blot (ly:output-def-lookup layout 'blot-diameter))
+ (grob-thick (ly:grob-property grob 'thickness 2))
+ (width (* line-thick grob-thick))
+ (x-ext (symmetric-interval (/ width 2)))
+ (y-ext (cons point-min point-max))
+ (line (ly:round-filled-box x-ext y-ext blot))
+ (y-coord (ly:grob-relative-coordinate grob common Y)))
+
+ (ly:stencil-translate-axis line (- y-coord) Y))
+ empty-stencil))
+ (begin
+ (ly:grob-suicide! grob)
+ (list)))))
;;$defaultlayout
ly:accidental-interface::print
- ly:ambitus::print
ly:arpeggio::print
ly:arpeggio::brew-chord-bracket
ly:bar-line::print