Hi Harm,
I noticed a bug with recent master:
\markup \rounded-box "foo"
prints completely black.
First bad commit is:
commit 0772e38398972d6c2b4ba9e6f42e7725d973e08b
Author: Han-Wen Nienhuys <hanw...@gmail.com>
Date: Sun Aug 1 11:15:02 2021 +0200
Stop passing color names to output backends
Well, comparing that version pre- and post-change
(define-public (rounded-box-stencil stencil thickness padding blot)
"Add a rounded box around @var{stencil}, producing a new stencil."
(let* ((xext (interval-widen (ly:stencil-extent stencil 0) padding))
(yext (interval-widen (ly:stencil-extent stencil 1) padding))
(min-ext (min (-(cdr xext) (car xext)) (-(cdr yext) (car yext))))
(ideal-blot (min blot (/ min-ext 2)))
(ideal-thickness (min thickness (/ min-ext 2)))
(outer (ly:round-filled-box
(interval-widen xext ideal-thickness)
(interval-widen yext ideal-thickness)
ideal-blot))
- (inner (ly:make-stencil (list 'color (x11-color 'white)
- (ly:stencil-expr
(ly:round-filled-box
- xext yext (-
ideal-blot ideal-thickness)))))))
+ (inner (ly:make-stencil (ly:stencil-in-color
+ (ly:round-filled-box
+ xext yext (- ideal-blot
ideal-thickness))
+ "white"))))
(set! stencil (ly:stencil-add outer inner))
stencil))
it seems to me that before Han-Wen's change, ly:make-stencil was
necessary since the code manipulated the stencil expression of the
round-filled-box directly, thus returning a stencil expression. Now,
with the use of ly:stencil-in-color, we get an actual stencil
immediately, so the call ly:make-stencil (which expects a stencil
expression) is superfluous and (I think) wrong.
But to be honest, rounded-box-stencil seems to me to be broken anyway:
If you compare it with ellipse-stencil directly above (and looking at
the docstrings), one should expect to get the original stencil with an
added rounded box. But rounded-box-stencil
a) doesn't use the original stencil in stencil-add,
b) overwrites the original stencil with set!
Hence, the markup command \rounded-box has to take care to add the
original markup:
(let ((th (* (ly:output-def-lookup layout 'line-thickness)
thickness))
(pad (* (magstep font-size) box-padding))
(m (interpret-markup layout props arg)))
(ly:stencil-add (rounded-box-stencil m th pad corner-radius)
m)))
So in my impression, rounded-box-stencil might deserve a refactoring anyway?
Lukas