Menu

#4693 Note heads don’t fit exactly between staff lines

Verified
push
Enhancement
2016-03-30
2015-12-11
No

As Gilberto reported here, note heads in a default staff space extend the slightest bit above the upper staff line.

Image example here.

Discussion

  • Phil Holmes

    Phil Holmes - 2015-12-12

    FWIW, it's the same as far back as 2.12. A very slight extension above the staff line can also be seen in highly magnified PDF versions.

     
  • Carl Sorensen

    Carl Sorensen - 2016-02-14

    The Feta font has a parameter designed to adjust the notehead height. In 2.19.36 it is set to be exactly the staff space + the staff line thickness. I assume that when the ps is converted to type 1 with hinting, it can get infinitesimally bigger.

    I have created a new version of the feta font with the notehead height being staff_space + 0.8 * staff_line_thickness. It appears to solve the problem. If this seems OK, I will prepare a patch.

     
  • Werner LEMBERG

    Werner LEMBERG - 2016-02-14

    Why 0.8 and not, say, 0.9?

     
    • Carl Sorensen

      Carl Sorensen - 2016-02-14

      On Feb 14, 2016 3:51 AM, "Werner LEMBERG" wlemb@users.sf.net wrote:

      Why 0.8 and not, say, 0.9?

      Because 0.95 still showed the problem and 0.8 didn't. I haven't tried to
      be any more precise in terms of finding the optimal value. If I knew how to
      check the size of the notehead in ems I could find the largest note head
      that gives a size of 275 instead of 276. But I don't know how to do
      that. Help would be appreciated.

      Carl

       
  • Carl Sorensen

    Carl Sorensen - 2016-02-14

    Following up with David Kastrup and Paul Morris, I've created pdf files at three different settings: overdone=0, overdone = -.1, overdone=-.2.

    Overdone=0 is the current behavior. Overdone = -.1 reduces the notehead height in metafont by 10% of the staff line thickness. Overdone = -0.2 reduces the notehead height in metafont by 20% of the staff line thickness. As can be seen, the notehead still extends beyond the staff line at overdone=-.1

    The size changes are so slight that I can't see them (and I doubt anybody can) when the note is on a staff line; it's only by comparing the overlap on the staff line when the note is in a space that we can see it.

    Thanks,

    Carl

     
  • Phil Holmes

    Phil Holmes - 2016-02-15

    To my eye, 10% is good - it stops the noteheads hitting the line edges, but keeps them nice and tight.

     
  • Carl Sorensen

    Carl Sorensen - 2016-02-18
    • assigned_to: Carl Sorensen
    • Patch: --> new
     
  • Carl Sorensen

    Carl Sorensen - 2016-02-18
    • status: Accepted --> Started
     
  • Anonymous

    Anonymous - 2016-02-19
    • Patch: new -->
     
  • Anonymous

    Anonymous - 2016-02-19

    I cannot see any Rietveld to test against

     
  • Carl Sorensen

    Carl Sorensen - 2016-02-19

    I'm sorry -- git-cl didn't work so I did things manually and missed that.

    Here's the Rietveld:

    https://codereview.appspot.com/284650043/

    Carl

     
  • Werner LEMBERG

    Werner LEMBERG - 2016-02-21

    I've now done a closer look at the issue; it is indeed a rounding issue, as far as I can see. mf2pt1 doesn't produce extremum outline points by itself; it is FontForge which does that. The vertical coordinates of the extremum points in notehead.s2 are ±137.5 units; however, FontForge then rounds the coordinates to integers, making them ±138 units, which is the largest delta possible to the unrounded coordinates. I guess this is exactly the observed effect.

    So: LGTM to Carl's change.

     
  • Carl Sorensen

    Carl Sorensen - 2016-02-22

    Thanks for the careful review, Werner. After reading your review, I can see that my patch is, in fact, a hack.

    Feta has built into its parameters a process for rounding stafflinethickness toward the center. I'm currently trying a patch with stafflinethickness_rounded used to determine noteheight instead of stafflinethickness. I am hopeful this will fix the problem without any magic numbers.

     
  • Carl Sorensen

    Carl Sorensen - 2016-03-09

    Trying after installing ca-certificates

    http://codereview.appspot.com/283550043

     
  • Anonymous

    Anonymous - 2016-03-10
    • Needs: -->
    • Patch: new --> review
    • Type: -->
     
  • Anonymous

    Anonymous - 2016-03-10

    passes make, make check and a full make doc.

    There are a lot of reg test diffs here:

    https://drive.google.com/open?id=0B9nZ5LHV2Ds6cWc0T2NpTnpkR3M

    This is about 30mb to download.

     
  • Anonymous

    Anonymous - 2016-03-13
    • Patch: review --> countdown
    • Type: --> Enhancement
     
  • Anonymous

    Anonymous - 2016-03-13

    Patch on countdown for March 16 th.

    Reg test diffs here:

    https://drive.google.com/open?id=0B9nZ5LHV2Ds6cWc0T2NpTnpkR3M

    This is about 30mb to download.

     
  • Valentin Villenave

    Greetings Carl,
    This reminds me of the old (unrelated) 1/72.27 rounding problem:
    http://lists.gnu.org/archive/html/lilypond-devel/2007-07/msg00075.html
    Since you’re adding a regtest, would it be advisable to make the regtest render several staves in various sizes? Or would increasing the staff-size (and therefore the rendering precision) defeat the purpose?

     
  • Carl Sorensen

    Carl Sorensen - 2016-03-13

    I don't believe that there is any necessity to display at various staff sizes. The default staff size has an odd number of points in the staffspace * staffline interval, so when the notehead height is divided in half, there is an extra .5 hanging around that rounds to 1. We can never be worse than that. If we have an extra 0.8 hanging around and round to 1, there is less growth. if there is an extra .4 hanging around and rounds to 0, we have a little bit of shrinkage, which is undetectable absent a comparision with a staff line.

    Since the current condition is the worst possible case, I think it is fine.

     
  • Anonymous

    Anonymous - 2016-03-16
    • Patch: countdown --> push
     
  • Anonymous

    Anonymous - 2016-03-16

    Patch counted down - please push

     
  • Carl Sorensen

    Carl Sorensen - 2016-03-16
    • labels: --> Fixed_2_18_39
    • status: Started --> Fixed
     
  • Carl Sorensen

    Carl Sorensen - 2016-03-16

    Pushed to staging as 25ff85f..87eb2f9

     
  • Federico Bruni

    Federico Bruni - 2016-03-30
    • labels: Fixed_2_18_39 --> Fixed_2_19_39
    • status: Fixed --> Verified