X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fsystem-start-text.cc;h=33b0f68f40810b872de9f96c08f208d3f4c2c3ac;hb=51eff44c691a77454e01ffef7a444c42a287e37c;hp=00795d22d749a743b8b381508f0816477e7ecc93;hpb=a276a19dc6bd57832db3107f2f2cbb04cb4677b6;p=lilypond.git diff --git a/lily/system-start-text.cc b/lily/system-start-text.cc index 00795d22d7..33b0f68f40 100644 --- a/lily/system-start-text.cc +++ b/lily/system-start-text.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 2006--2007 Han-Wen Nienhuys + (c) 2006--2009 Han-Wen Nienhuys */ @@ -19,7 +19,7 @@ class System_start_text { public: static Stencil get_stencil (Grob *); - DECLARE_GROB_INTERFACE(); + DECLARE_GROB_INTERFACE (); DECLARE_SCHEME_CALLBACK (print, (SCM)); }; @@ -45,9 +45,25 @@ System_start_text::get_stencil (Grob *me_grob) SCM align_y = me_grob->get_property ("self-alignment-Y"); if (scm_is_number (align_y)) p->align_to (Y_AXIS, robust_scm2double (align_y, 0.0)); - return *p; + + /* Horizontal alignment according to the self-alignment-X property + * and indent value. */ + Output_def *layout = me_grob->layout (); + Real indent; + if (me->get_break_index () == 0) + indent = robust_scm2double (layout->c_variable ("indent"), 0); + else + indent = robust_scm2double (layout->c_variable ("short-indent"), 0); + Real align_x = robust_scm2double (me->get_property ("self-alignment-X"), 0); + Interval p_extent_x = p->extent (X_AXIS); + Interval padding (0.0, max (0.0, indent - p_extent_x.length ())); + Real right_padding = padding.length () - padding.linear_combination (align_x); + Box box (Interval (p_extent_x[LEFT], p_extent_x[RIGHT] + right_padding), + p->extent (Y_AXIS)); + Stencil *aligned_p = new Stencil (box, p->expr ()); + return *aligned_p; } - return Stencil(); + return Stencil (); } @@ -101,4 +117,5 @@ ADD_INTERFACE (System_start_text, "text " "long-text " "self-alignment-Y " + "self-alignment-X " );