in a C form, with the top accidental closet to the chord.
* lily/stem.cc (get_default_stem_end_position): don't crash if
lengths not set.
(get_default_stem_end_position): idem for stem-shorten.
* mf/feta-toevallig.mf: enlarge flat bbox.
* input/regression/lyrics-extender.ly: new file.
2002-07-21 Han-Wen <hanwen@cs.uu.nl>
+ * lily/accidental-placement.cc (stagger_apes): try to arrange accs
+ in a C form, with the top accidental closet to the chord.
+
+ * lily/stem.cc (get_default_stem_end_position): don't crash if
+ lengths not set.
+ (get_default_stem_end_position): idem for stem-shorten.
+
+ * mf/feta-toevallig.mf: enlarge flat bbox.
+
+ * input/regression/lyrics-extender.ly: new file.
+
* lily/lyric-extender.cc (brew_molecule): don't add
right-trim-amount if extender is broken.
\header {
texidoc ="Accidentals are placed as closely as possible.
-Accidentals in corresponding octaves are aligned."
+Accidentals in corresponding octaves are aligned.
+The top accidental should be nearest to the chord. The
+flats in a sixth shoudl be staggered. "
}
\score { \notes \context Voice \relative c' {
cis4
+ c4
+ \transpose c'' {
+ <bis4 es gis>
+ <es! as!>
+ <gis! cis!>
+ <g! des!>
+ <ges! es'!>
+}
<cis4 d es fis gis ases bes ces d dis >
<bes'! fis!>
<bes! cis!>
--- /dev/null
+\header{
+ texidoc =
+
+ "Extenders that end a staff should not extend past the staff.
+Also shown: a trick to get an extender at the end of the staff.
+"
+
+}
+
+sopran = \notes \relative c'' {
+\time 3/4 a2.( | \break
+)g2 < g4 { s8 s8 } > |
+}
+
+text = \lyrics {
+vielt __ Zeit. __ " "
+}
+
+\score {
+<
+\addlyrics
+ \context Staff \sopran
+ \context Lyrics \text
+>
+\paper { linewidth = 5.0\cm
+}
+}
static Interval all_accidental_vertical_extent;
Real ape_priority (Accidental_placement_entry const * a)
{
- Real c = a->vertical_extent_.center();
-
- /*
- far from center means we can fold more. Hopefully.
- */
- Real center_distance =
- fabs(c - all_accidental_vertical_extent[LEFT]) >?
- fabs(c - all_accidental_vertical_extent[RIGHT]);
-
- return 20 * a->vertical_extent_.length () + center_distance;
+ return a->vertical_extent_[UP];
}
return sign (ape_priority (a) - ape_priority(b));
}
+int ape_rcompare (Accidental_placement_entry *const &a,
+ Accidental_placement_entry *const &b)
+{
+ return -sign (ape_priority (a) - ape_priority(b));
+}
+
+
+/*
+
+TODO: should favor
+
+ b
+ b
+
+placement
+
+*/
+void
+stagger_apes (Link_array<Accidental_placement_entry> *apes)
+{
+ Link_array<Accidental_placement_entry> asc = *apes;
+
+
+ asc.sort (&ape_compare);
+
+ apes->clear();
+
+ int i =0;
+ int parity = 1;
+ while (i < asc.size())
+ {
+ Accidental_placement_entry * a = 0;
+ if (parity)
+ a = asc.pop();
+ else
+ a = asc[i++];
+
+ apes->push (a);
+ parity = !parity;
+ }
+
+ apes->reverse();
+}
+
+
+
/*
Return: width as SCM interval.
total.unite (y);
}
all_accidental_vertical_extent = total;
- apes.sort (&ape_compare);
+ stagger_apes (&apes);
Accidental_placement_entry * head_ape = new Accidental_placement_entry;
Grob *commonx = common_refpoint_of_array (heads, me, X_AXIS);
Slice int_list_to_slice (SCM l);
SCM ly_interval2scm (Drul_array<Real>);
-void taint (SCM *);
-
SCM ly_parse_scm (char const* s, int* n);
SCM ly_quote_scm (SCM s);
SCM ly_number2string (SCM s);
SCM parse_symbol_list (char const *);
+SCM robust_list_ref(int i, SCM l);
+
inline SCM ly_cdr (SCM x) { return SCM_CDR (x); }
inline SCM ly_car (SCM x) { return SCM_CAR (x); }
return s;
}
+
+
+
+/*
+ return I-th element, or last elt L
+
+ PRE: length (L) > 0
+ */
+SCM
+robust_list_ref(int i, SCM l)
+{
+ while (i-- && gh_pair_p (gh_cdr(l)))
+ l = gh_cdr (l);
+
+ return gh_car(l);
+}
else
{
s = me->get_grob_property ("lengths");
- for (SCM q = s; q != SCM_EOL; q = ly_cdr (q))
- a.push (gh_scm2double (ly_car (q)));
-
- // stem uses half-spaces
- length_f = a[ ((duration_log (me) - 2) >? 0) <? (a.size () - 1)] * 2;
+ length_f = 3.5;
+
+ if (gh_pair_p (s))
+ {
+ length_f = 2* gh_scm2double (robust_list_ref (duration_log(me) -2, s));
+ }
}
- a.clear ();
- s = me->get_grob_property ("stem-shorten");
- for (SCM q = s; gh_pair_p (q); q = ly_cdr (q))
- a.push (gh_scm2double (ly_car (q)));
-
-
- // stem uses half-spaces
-
- // fixme: use scm_list_n_ref () iso. array[]
- Real shorten_f = a[ ((duration_log (me) - 2) >? 0) <? (a.size () - 1)] * 2;
+ Real shorten_f = 0.0;
+
+ SCM sshorten = me->get_grob_property ("stem-shorten");
+ if (gh_pair_p (sshorten))
+ {
+ shorten_f = 2* gh_scm2double (robust_list_ref ((duration_log (me) - 2) >? 0, sshorten));
+ }
/* On boundary: shorten only half */
if (abs (chord_start_y (me)) == 0.5)
return unsmob_grob (b);
}
-/*
- return I-th element, or last elt L
-
- PRE: length (L) > 0
- */
-SCM
-robust_list_ref(int i, SCM l)
-{
- while (i-- && gh_pair_p (gh_cdr(l)))
- l = gh_cdr (l);
-
- return gh_car(l);
-}
-
// ugh still very long.
Stem_info
Stem::calc_stem_info (Grob*me)
% unfortunately, 600dpi is not enough to show the brush of the stem.
%
fet_beginchar("Flat", "-1", "flat")
- set_char_box(1.2 stafflinethickness#, .8 staff_space#, .5 staff_space#, 2 staff_space#);
+ set_char_box(1.2 stafflinethickness#, .8 staff_space#, 0.6 staff_space#, 2 staff_space#);
draw_meta_flat(0, w, 1/3 staff_space);
fet_endchar;
(grob-property-description 'left-widen boolean? "Whether the left edge of a piano pedal bracket should be widened by the first element of edge-widen.")
(grob-property-description 'length number? "Stem length for unbeamed stems, only for user override.")
-(grob-property-description 'lengths list? "Stem length given multiplicity of flag.")
+(grob-property-description 'lengths list? "Stem length given
+multiplicity of flag. The Nth element of the list gives the stem
+length of a note with N flags.
+")
(grob-property-description 'line-count integer? "Number of staff
lines. If you want to override this for staffs individually, you must
use @code{\outputproperty}. @code{\property .. \override} will not
terms of note head bounding box.")
(grob-property-description 'stem-end-position number? "Where does the stem end (the end is opposite to the support-head.")
-(grob-property-description 'stem-shorten list? "shorten stems in forced directions given flag multiplicity.")
+(grob-property-description 'stem-shorten list? "shorten stems in forced directions given flag multiplicity:
+the Nth element of the list gives the amount stem shortening of a note with N flags.
+")
(grob-property-description 'stem-spacing-correction number? "optical correction amount. [TODO: doco] ")
(grob-property-description 'stems grob-list? "list of stem objects, corresponding to the notes that the arpeggio has to be before.")
(grob-property-description 'style symbol? "a string determining what style of glyph is typeset. Valid choices depend on the function that is reading this property. .")