X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fnote-head.cc;h=d7da247660a90f0b37a419021e636ae9bbe7b97f;hb=aaa52903d633cdeaa642c20ab42ec268f4e17a2b;hp=f1b3bf192d658b1ef9971ce0447dcbab8947ed38;hpb=f55f0fa994d8b2de6ffb558fa24560b7f1ccafaf;p=lilypond.git diff --git a/lily/note-head.cc b/lily/note-head.cc index f1b3bf192d..d7da247660 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -18,6 +18,39 @@ +/* + build a ledger line for small pieces. + */ +Molecule +Note_head::ledger_line (Interval xwid) const +{ + Drul_array endings; + endings[LEFT] = lookup_l()->afm_find ("noteheads-ledgerending"); + Molecule * e = &endings[LEFT]; + endings[RIGHT] = *e; + + Real thick = e->dim_[Y_AXIS].length(); + Real len = e->dim_[X_AXIS].length () - thick; + + Molecule total; + Direction d = LEFT; + do { + endings[d].translate_axis (xwid[d] - endings[d].dim_[X_AXIS][d], X_AXIS); + total.add_molecule (endings[d]); + } while ((flip(&d)) != LEFT); + + Real xpos = xwid [LEFT] + len; + + while (xpos + len + thick /2 <= xwid[RIGHT]) + { + e->translate_axis (len, X_AXIS); + total.add_molecule (*e); + xpos += len; + } + + return total; +} + void Note_head::do_pre_processing () @@ -76,9 +109,8 @@ Note_head::do_brew_molecule_p() const Interval hd = out->dim_[X_AXIS]; Real hw = hd.length ()/4; - Molecule ledger - = lookup_l ()->ledger_line (Interval (hd[LEFT] - hw, - hd[RIGHT] + hw)); + Molecule ledger (ledger_line (Interval (hd[LEFT] - hw, + hd[RIGHT] + hw))); int parity = abs(int (p)) % 2;