lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Attachment of reversed noteheads


From: Rune Zedeler
Subject: Re: Attachment of reversed noteheads
Date: Thu, 03 Oct 2002 09:05:40 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529

Jan Nieuwenhuizen wrote:

>>Is it on purpose that noteheads attached to the "wrong" side of the
>>stem are shifted noteheadwidth instead of noteheadwidth-stemwidth ...

> Ouch.  Good catch.

Okay, I take that as a "no" :-)

When trying to fix it I stumbled over this imho senseless piece of code
in stem.cc:

   bool invisible = invisible_b (me);
   Real thick = 0.0;
   if (invisible)
         thick = gh_scm2double (me->get_grob_property ("thickness"))
          * me->get_paper ()->get_var ("linethickness");


I cannot see that it makes sense only to calculate the width of the stem
if it is invisible.
"thick" is later on ONLY used if the stem is invisible. It is used to
shift the note head two stemwidths leftwards. I don't understand it.

This patch fixes the bug, but the code should be read through - I find
it quite strange.


-Rune

--- stem.cc.~1.187.~    Wed Sep 25 23:03:46 2002
+++ stem.cc     Thu Oct  3 02:59:02 2002
@@ -418,10 +418,8 @@
 
 
   bool invisible = invisible_b (me);
-  Real thick = 0.0;
-  if (invisible)
-        thick = gh_scm2double (me->get_grob_property ("thickness"))
-         * me->get_paper ()->get_var ("linethickness");
+  Real thick = gh_scm2double (me->get_grob_property ("thickness"))
+     * me->get_paper ()->get_var ("linethickness");
       
 
   Grob *hed = support_head (me);
@@ -446,10 +444,10 @@
              Real l = Note_head::head_extent (heads[i], X_AXIS).length ();
 
              Direction d = get_direction (me);
-             heads[i]->translate_axis (l * d, X_AXIS);
+             heads[i]->translate_axis ((l-thick) * d, X_AXIS);
 
              if (invisible_b(me))
-               heads[i]->translate_axis (-thick *2* d , X_AXIS);
+               heads[i]->translate_axis (-thick * d , X_AXIS);
 
              
             /* TODO:


reply via email to

[Prev in Thread] Current Thread [Next in Thread]