lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ question:


From: Knut Petersen
Subject: Re: C++ question:
Date: Sat, 21 Jan 2017 11:28:52 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

Hi David!
Sigh.  Why do you use set_empty _after_ translation?  That makes the
remaining point stick out from the actual glyph.  And of course, it
totally moots any effect of set_empty before translation.

It does not matter where set_empty is used, it does not have the desired
effect. I tried a lot of possible places and combinations.

See comments in the following snippet:

  Stencil total;
  for (int i = 0; i < hyphens; i++)
    {
      Stencil ds = dash_stencil;
      ds.translate_axis (span_points[LEFT] + start_space +
                         i * (dash_period + dash_length), X_AXIS);
      total.add_stencil (ds);
      if (whiteout > 0.0 )
        {
          // A markup property whiteout-markup-wzd is implemented.
          // The following definition is used for that property:
          // \markup { \with-dimensions #'(0 . 0) #'(0 . 0) {
          //           \filled-box #'(0.0 . 1.0) #'(-0.5 . 0.5) #0.0 } }
          SCM properties = Font_interface::text_font_alist_chain (me);
          SCM ws_zd_mod = Text_interface::interpret_markup (
                             me->layout ()->self_scm (),
                             properties,
                             me->get_property ("whiteout-markup-wzd"));
          Stencil wsa = *unsmob<Stencil> (ws_zd_mod);

          // The following three lines should give an equivalent definition:
          Box wb (Interval (0.0, 1.0), Interval (-0.5, 0.5));
          Stencil wsb (Lookup::round_filled_box (wb, 0));
          wsb.set_empty(false);

          Stencil wos;
          // If this definition of wos is used everything works as intended,
          // collsion detection ignores wos:
          wos = wsa.in_color (1.0, 0, 0);
          // If this definition is used, collision detection does _not_ ignore
          // wos but moves the last lyric line in the testfile down:
          //
          // wos = wsb.in_color (1.0, 0, 0);

          Real xscale = (dash_stencil.extent (X_AXIS).length ()
                         + 2 * whiteout * lt);
          Real yscale = (dash_stencil.extent (Y_AXIS).length ()
                         + 2 * whiteout * lt);
          wos.scale(xscale,yscale);

          wos.translate_axis (span_points[LEFT] + start_space
                              + i * (dash_period + dash_length)
                              - whiteout * lt, X_AXIS);

          Real cory = 0.5 * (dash_stencil.extent (Y_AXIS)[DOWN]
                             + dash_stencil.extent (Y_AXIS) [UP]);
          wos.translate_axis (cory, Y_AXIS);

          total.add_stencil (wos);
        }
    }

  total.translate_axis (-me->relative_coordinate (common, X_AXIS), X_AXIS);
  return total.smobbed_copy ();
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]