lilypond-devel
[Top][All Lists]
Advanced

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

Re: C++ question:


From: David Kastrup
Subject: Re: C++ question:
Date: Sun, 22 Jan 2017 12:36:42 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Knut Petersen <address@hidden> writes:

>>           // 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); 
>
> The difference between Stencil wsa and wsb is that \markup { \withdimensions 
> #'(0 . 0) #'(0 . 0) ...}
> not only sets the dimensions :
>
> (define-markup-command (with-dimensions layout props x y arg)
>   (number-pair? number-pair? markup?)
>   #:category other
>   "
> @cindex setting extent of text objects
>
> Set the dimensions of @var{arg} to @var{x} address@hidden@var{y}."
>   (let* ((expr (ly:stencil-expr (interpret-markup layout props arg))))
>     (ly:stencil-add
>      (make-transparent-box-stencil x y)
>      (ly:make-stencil
>       `(delay-stencil-evaluation ,(delay expr))
>       x y))))

I think that is half of a red herring: apparently the delayed stencil
evaluation is only used in order to sneak the stencil outline past the
outline tracing code in lily/stencil-integral.cc.  And that apparently
causes the dimensions to be totally ignored, so a transparent box is
pasted on top.

What a steaming heap of something.  So your code would likely have
worked in LilyPond 2.16.  I think it would make sense to create a new
type of stencil expression explicitly intended to bypass outlining.

Probably by just containing _two_ stencils: one for typesetting, one for
outlining.  That would make for a much more transparent manner of
programming things like that.

-- 
David Kastrup



reply via email to

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