From 53ed6257ae65d5a12b45da9fce930267ed12db48 Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Sat, 13 Dec 2008 00:23:25 +0100 Subject: [PATCH] Add ticked barlines (\bar "'"), i.e. a short tick through top-most staff-line For the span bar line, use an empty bar line, since ticked bar lines are not spanned across staff groups. --- input/regression/bar-line-tick.ly | 16 ++++++++++++++++ lily/bar-line.cc | 20 ++++++++++++++++++++ lily/include/bar-line.hh | 1 + lily/span-bar.cc | 2 ++ scm/output-lib.scm | 1 + 5 files changed, 40 insertions(+) create mode 100644 input/regression/bar-line-tick.ly diff --git a/input/regression/bar-line-tick.ly b/input/regression/bar-line-tick.ly new file mode 100644 index 0000000000..9ddf246683 --- /dev/null +++ b/input/regression/bar-line-tick.ly @@ -0,0 +1,16 @@ + +\header { texidoc = "A ticked bar line is a short line of the same length as a + staff space, centered on the top-most barline." } + +\version "2.11.65" + +\paper { ragged-right = ##t } + +\relative \new StaffGroup << + \new Staff { + c4 \bar "'" c } + \new Staff { + c c + } +>> + diff --git a/lily/bar-line.cc b/lily/bar-line.cc index df97638dba..18ad550e92 100644 --- a/lily/bar-line.cc +++ b/lily/bar-line.cc @@ -198,6 +198,10 @@ Bar_line::compound_barline (Grob *me, string str, Real h, { m = dashed_bar_line (me, h, hair); } + else if (str == "'") + { + m = tick_bar_line (me, hair, h, rounded); + } else if (str == ".") { m = dot; @@ -222,6 +226,22 @@ Bar_line::simple_barline (Grob *me, Interval (-h / 2, h / 2)), blot); } +Stencil +Bar_line::tick_bar_line (Grob *me, Real w, Real h, bool rounded) +{ + Real th = Staff_symbol_referencer::staff_space (me) / 2; + Real line_thick = Staff_symbol_referencer::line_thickness (me); + + Real blot + = rounded + ? me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter")) + : 0.0; + + return Lookup::round_filled_box (Box (Interval (0, line_thick), + Interval (h / 2 - th, h / 2 + th)), blot); +} + + MAKE_SCHEME_CALLBACK (Bar_line, calc_bar_size, 1); SCM Bar_line::calc_bar_size (SCM smob) diff --git a/lily/include/bar-line.hh b/lily/include/bar-line.hh index a6585084b6..43db11e9c9 100644 --- a/lily/include/bar-line.hh +++ b/lily/include/bar-line.hh @@ -16,6 +16,7 @@ public: DECLARE_GROB_INTERFACE(); static Stencil dashed_bar_line (Grob *me, Real h, Real thick); + static Stencil tick_bar_line (Grob *me, Real w, Real h, bool rounded); static Stencil compound_barline (Grob *, string, Real height, bool rounded); static Stencil simple_barline (Grob *, Real wid, Real height, bool rounded); static Interval bar_y_extent (Grob *, Grob *); diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 08a04e3cff..31d91b1fc7 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -190,6 +190,8 @@ Span_bar::calc_glyph_name (SCM smob) type = "|.|"; else if (type == ":|.:") type = "|."; + else if (type == "'") + type = ""; return ly_string2scm (type); } diff --git a/scm/output-lib.scm b/scm/output-lib.scm index b93eddaa9a..9b813a5566 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -250,6 +250,7 @@ centered, X==1 is at the right, X == -1 is at the left." ("" . ("" . "")) (":" . (":" . "")) ("." . ("." . ())) + ("'" . ("'" . ())) ("empty" . (() . ())) ("brace" . (() . "brace")) ("bracket" . (() . "bracket")) -- 2.39.5