X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=lily%2Fbar-line.cc;h=1f2d9b2963401327cc49a04ffe3920c937eba6ac;hb=e29d5fc6255e3090d308767401bf9985ed7206e5;hp=a56c5f6408bfb684d054958bcf01db4ada238a7b;hpb=bb8a0a5387af94dd2702877256334b160575a730;p=lilypond.git diff --git a/lily/bar-line.cc b/lily/bar-line.cc index a56c5f6408..1f2d9b2963 100644 --- a/lily/bar-line.cc +++ b/lily/bar-line.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 1997--2011 Han-Wen Nienhuys + Copyright (C) 1997--2012 Han-Wen Nienhuys LilyPond is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,8 +34,22 @@ Bar_line::calc_bar_extent (SCM smob) Interval result; Grob *me = unsmob_grob (smob); if (Grob *staff = Staff_symbol_referencer::get_staff_symbol (me)) - result = staff->extent (staff, Y_AXIS); - + { + result = staff->extent (staff, Y_AXIS); + + /* Due to rounding problems, bar lines extending to the outermost edges + of the staff lines appear wrongly in on-screen display + (and, to a lesser extent, in print) - they stick out a pixel. + The solution is to extend bar lines only to the middle + of the staff line - unless they have different colors, + when it would be undesirable. + */ + SCM bar_line_color = me->get_property ("color"); + SCM staff_color = staff->get_property ("color"); + Real radius = Staff_symbol_referencer::staff_radius (me); + if (bar_line_color == staff_color && radius) + result *= (1 - 0.5 * (Staff_symbol_referencer::line_thickness (me) / radius)); + } return ly_interval2scm (result); } @@ -272,7 +286,8 @@ Bar_line::compound_barline (Grob *me, string str, Interval const &extent, m = dashed_bar_line (me, extent, hair); else if (str == "'") m = tick_bar_line (me, extent.at (UP), rounded); - + else if (str == "kievan") + m.add_stencil (Font_interface::get_default_font (me)->find_by_name("scripts.barline.kievan")); return m; } @@ -453,6 +468,7 @@ ADD_INTERFACE (Bar_line, "kern " "thin-kern " "hair-thickness " + "has-span-bar " "thick-thickness " "glyph " "glyph-name "