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: Fri, 20 Jan 2017 13:25:11 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

Hi David!
Uh what?

If you want to change the dimensions of a stencil copy, you can just do

Stencil wd0 = orig;
wd0.set_empty (false);

I use the following code to emit hyphens (stencil ds) and whiteout boxes 
(stencil ws)
in lyric-hyphen.cc:

  Stencil total;
  for (int i = 0; i < hyphens; i++)
    { // ok
      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 )
        {
          Box wb (Interval (0, dash_length + 2 * whiteout * lt),
                  Interval (h - whiteout * lt, h + th + whiteout * lt));
          Stencil ws (Lookup::round_filled_box (wb, 0.8 * lt));
          ws = ws.in_color (1.0, 0.0, 0.0);
          ws.translate_axis (span_points[LEFT] + start_space + i * (dash_period
                             + dash_length) - whiteout * lt, X_AXIS);
          ws.set_empty(false); // <== Does not help against collision detection
          total.add_stencil (ws);
        }
    }

As you can see in the attached jpgs, a collision of the whiteout box moves the 
last lyric line down.
set_empty(true) nor anything else I tried does change anything.

The ugly hack to define a markup property containing a filled box inside a 
\with-dimensions zero
for both axes, interpret, scale and move the stencil as required works. But 
there must be a better way ...
WithUglyHack.jpg shows the targeted result ...

 Knut

Attachment: NoCollision.jpg
Description: JPEG image

Attachment: Collision.jpg
Description: JPEG image

Attachment: WithUglyHack.jpg
Description: JPEG image


reply via email to

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