[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-devel
Subject:    Re: misplaced-note-head bug (issue 5303)
From:       Lukas-Fabian Moser <lfm () gmx ! de>
Date:       2019-06-29 21:09:26
Message-ID: 7718b0cf-1912-1980-9b7d-bdde3200ac4f () gmx ! de
[Download RAW message or body]

Hi David,

>> Aah, I'm sorry - I was not aware that casting to int works by
>> /truncating/. Then it's quite obvious what's happening here.
> Which code do you think has a problem related to your example?

Compile

\version "2.19" \score {   {     <d' f' a'>4 \clef bass <f, a, c>   }   
\layout {     #(layout-set-staff-size 19)     % different magic number 
with layout-set-absolute-staff-size:     % 
#(layout-set-absolute-staff-size 6.011034)   } }

with a LilyPond patched with

diff --git a/lily/stem.cc b/lily/stem.cc index 37aa40c250..57995d8af7 
100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -627,6 +627,7 @@ 
Stem::calc_positioning_done (SCM smob)          parity = true;        
lastpos = int (p); +      message (_f ("In Stem::calc_positioning_done: 
lastpos = int (p) truncates %f to %f", p, lastpos));      }    return 
SCM_BOOL_T;

against current master (or in fact any LilyPond version starting from 
your commit cb6024decee0aafd84baafe34115fc1b2d179df6 implementing 
changing the staff line spacing in the \layout block). This exhibits 
issue 5303 (see attached image) and shows where the int () cast causes 
the problem:

Processing `/home/lukas/Musik/lp/Misplaced_note_head_MWE.ly'

Parsing...

Interpreting music...

Preprocessing graphical objects...

In Stem::calc_positioning_done: lastpos = int (p) truncates -3.000000 to 
-2.000000

In Stem::calc_positioning_done: lastpos = int (p) truncates -1.000000 to 
-1.000000

In Stem::calc_positioning_done: lastpos = int (p) truncates -3.000000 to 
-2.000000

In Stem::calc_positioning_done: lastpos = int (p) truncates -1.000000 to 
-1.000000

Finding the ideal number of pages...

Fitting music on 1 page...

Drawing systems...

Layout output to `/tmp/lilypond-lXcH6C'...

Converting to `Misplaced_note_head_MWE.pdf'...

Deleting `/tmp/lilypond-lXcH6C'...

Success: compilation successfully completed

I'm not sure why the reduction to an integer is done in the first place. 
For the MWE, both keeping it as a float

lastpos = p;

and explicitly rounding 'correctly' to an integer

lastpos = int (round (p) );

solve the problem. I expect one should run both versions through a 
comparison of regression tests, but I never did this before, so I'd 
better leave this for tomorrow. :-)

Best Lukas


["image.png" (image/png)]
[Attachment #4 (text/plain)]

_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic