\score { \notes { << { d'4 c'4 } \\ \override NoteHead #'style = #'diamond { c'4 c'4 } >> r2 } } \paper { indent = 0.0\mm raggedright = ##t }
I created a patch. I also added a property (merge-differently-fonted) to allow the original behavior. The patch includes the source files as well as the user manual. I also created a file for the regression tests. Below are the 1. the patch, and 2. the regression test. I've been following the mailing list for a few weeks now, and I think this is the format you want (diff -u, no attachments, etc.). If you want something else, let me know.
Doug Linhardt
1. The patch
--- ../lilypond-2.1.27/./lily/note-head.cc 2004-03-07 17:03:28.000000000 -0600
+++ ./lily/note-head.cc 2004-03-07 17:03:28.000000000 -0600
@@ -121,16 +121,13 @@
Stencil
internal_print (Grob *me, bool with_ledgers)
{
- SCM style = me->get_property ("style");
- if (!gh_symbol_p (style))
+ String font_name = Note_head::get_font_name(me);
+ if (font_name == "")
{
return Stencil ();
}
- SCM log = gh_int2scm (Note_head::get_balltype (me)); - SCM proc = me->get_property ("glyph-name-procedure"); - SCM scm_font_char = scm_call_2 (proc, log, style); - String font_char = "noteheads-" + ly_scm2string (scm_font_char); + String font_char = "noteheads-" + font_name;
Font_metric * fm = Font_interface::get_default_font (me); Stencil out = fm->find_by_name (font_char); @@ -272,6 +269,23 @@ return m.smobbed_copy (); }
+String +Note_head::get_font_name(Grob* me) +{ + String ret_val = ""; + + SCM style = me->get_property ("style"); + if (gh_symbol_p (style)) + { + SCM log = gh_int2scm (Note_head::get_balltype (me)); + SCM proc = me->get_property ("glyph-name-procedure"); + SCM scm_font_char = scm_call_2 (proc, log, style); + ret_val = ly_scm2string (scm_font_char); + } + + return ret_val; +} +
Real
Note_head::stem_attachment_coordinate (Grob *me, Axis a)
@@ -281,16 +295,13 @@
if (brewer == Note_head::print_proc)
{
- SCM style = me->get_property ("style");
- if (!gh_symbol_p (style))
- {
- return 0.0;
- }
-
- SCM log = gh_int2scm (Note_head::get_balltype (me));
- SCM proc = me->get_property ("glyph-name-procedure");
- SCM scm_font_char = scm_call_2 (proc, log, style);
- String font_char = "noteheads-" + ly_scm2string (scm_font_char);
+ String font_name = get_font_name(me);
+ if (font_name == "")
+ {
+ return 0.0;
+ }
+
+ String font_char = "noteheads-" + font_name;
int k = fm->name_to_index (font_char) ;
--- ../lilypond-2.1.27/./lily/note-collision.cc 2004-03-07 17:03:28.000000000 -0600
+++ ./lily/note-collision.cc 2004-03-07 17:03:28.000000000 -0600
@@ -71,6 +71,8 @@
int upball_type = Note_head::get_balltype (nu);
int dnball_type = Note_head::get_balltype (nd);
+ String up_font = Note_head::get_font_name (nu);
+ String dn_font = Note_head::get_font_name (nd);
/* Do not merge whole notes (or longer, like breve, longa, maxima). */
if (merge_possible && (upball_type <= 0 || dnball_type <= 0))
@@ -88,6 +90,13 @@
&& !to_boolean (me->get_property ("merge-differently-headed")))
merge_possible = false;
+ /* Can only merge different fonts if merge-differently-fonted is + set. */ + if (merge_possible + && up_font != dn_font + && !to_boolean (me->get_property ("merge-differently-fonted"))) + merge_possible = false; + /* Should never merge quarter and half notes, as this would make them indistinguishable. */ if (merge_possible @@ -474,4 +483,4 @@
,
- "merge-differently-dotted merge-differently-headed positioning-done");
+ "merge-differently-dotted merge-differently-headed merge-differently-fonted positioning-done");
--- ../lilypond-2.1.27/./lily/include/note-head.hh 2004-03-07 17:03:28.000000000 -0600
+++ ./lily/include/note-head.hh 2004-03-07 17:03:28.000000000 -0600
@@ -29,6 +29,7 @@
static bool has_interface (Grob*);
static Real stem_attachment_coordinate (Grob *, Axis a);
static int get_balltype (Grob*) ;
+ static String get_font_name (Grob*) ;
};
#endif // NOTEHEAD_HH
--- ../lilypond-2.1.27/./scm/define-grob-properties.scm 2004-03-07 17:03:28.000000000 -0600
+++ ./scm/define-grob-properties.scm 2004-03-07 17:03:28.000000000 -0600
@@ -338,6 +338,10 @@
notation for some types of polyphonic music. The value of this setting
is used by @internalsref{note-collision-interface} .")
+ (merge-differently-fonted ,boolean? "Merge noteheads in
+collisions, even if they are represented by different fonts. The value
+of this setting is used by @internalsref{note-collision-interface} .")
+
(minimum-distance ,ly:dimension? "Minimum distance between rest
and notes or beam.")
(minimum-X-extent ,number-pair? "Minimum size of an object in X
--- ../lilypond-2.1.27/./Documentation/user/refman.itely 2004-03-07 17:03:28.000000000 -0600
+++ ./Documentation/user/refman.itely 2004-03-07 17:03:28.000000000 -0600
@@ -1240,6 +1240,15 @@
c8 c4. } \\ { c2 c2 } >>
@end lilypond
+Also, you can merge note heads from different fonts, by setting [EMAIL PROTECTED]: [EMAIL PROTECTED],relative=2,verbatim] +\context Voice << { c4 c4 } + \\ \override NoteHead #'style = #'diamond + {c4 \override Staff.NoteCollision + #'merge-differently-fonted = ##t c4 } >> [EMAIL PROTECTED] lilypond + LilyPond also vertically shifts rests that are opposite of a stem:
======================
2. The regression test
File name: collision-merge-differently-fonted.ly
\version "2.1.27"
\header {
texidoc = "If NoteCollision has merge-differently-fonted = ##t note
heads that have fonts may be merged anyway."
}
\paper { raggedright= ##t }
\score { \context Staff \notes\relative c'' << { c4 \override Staff.NoteCollision #'merge-differently-fonted = ##t c4 } \\ \override NoteHead #'style = #'diamond { c4 c4 } >> }
_______________________________________________ Lilypond-devel mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/lilypond-devel