/* whiteout background and larger file sizes with \pointAndClickOn. */
/* A grob has to be visible, otherwise the whiteout property has no effect. */
/* Calls the scheme procedure stencil-whiteout in scm/stencils.scm */
- if (!transparent && (scm_is_number (get_property("whiteout"))
+ if (!transparent && (scm_is_number (get_property ("whiteout"))
|| to_boolean (get_property ("whiteout"))))
{
- Real thickness = robust_scm2double (get_property("whiteout"), 3.0)
- * layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
+ Real line_thickness = layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
retval = *unsmob<Stencil>
(Lily::stencil_whiteout (retval.smobbed_copy (),
- scm_from_double (thickness)));
- }
-
- /* Calls the scheme procedure stencil-whiteout-box in scm/stencils.scm */
- if (!transparent && (scm_is_number (get_property("whiteout-box"))
- || to_boolean (get_property ("whiteout-box"))))
- {
- Real thickness = robust_scm2double (get_property("whiteout-box"), 0.0)
- * layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
- retval = *unsmob<Stencil>
- (Lily::stencil_whiteout_box (retval.smobbed_copy (),
- scm_from_double (thickness)));
+ get_property ("whiteout-style"),
+ get_property ("whiteout"),
+ scm_from_double (line_thickness)));
}
if (transparent)
"transparent "
"vertical-skylines "
"whiteout "
- "whiteout-box "
+ "whiteout-style "
);
/****************************************************************
Variable scorify_music ("scorify-music");
Variable span_bar_notify_grobs_of_my_existence ("span-bar::notify-grobs-of-my-existence");
Variable stencil_whiteout ("stencil-whiteout");
- Variable stencil_whiteout_box ("stencil-whiteout-box");
Variable symbol_list_p ("symbol-list?");
Variable tremolo_get_music_list ("tremolo::get-music-list");
Variable type_name ("type-name");
;;;
(when ,ly:moment? "Global time step associated with this column.")
(whiteout ,boolean-or-number? "If a number or true, the grob is
-printed over a white background that follows the outline of the stencil,
-if the grob is visible. A number sets the thickness of the outline as a
-multiple of the staff-line thickness. For compatibility with former
-behavior (now available with @code{whiteout-box}) the value @code{#t} is
-treated as @code{3.0}. Usually @code{#f} by default.")
- (whiteout-box ,boolean-or-number? "If a number or true, the grob
-is printed over a rectangular white background to white-out underlying
-material, if the grob is visible. A number indicates how far the
-outline extends beyond the bounding box of the grob as a multiple of
-the staff-line thickness. Usually @code{#f} by default.")
+printed over a white background to white-out underlying material, if
+the grob is visible. A number indicates how far the white background
+extends beyond the bounding box of the grob as a multiple of the
+staff-line thickness. The shape of the background is determined by
+@code{whiteout-style}. Usually @code{#f} by default.")
+ (whiteout-style ,symbol? "Determines the shape of the
+@code{whiteout} background. Available are @code{'outline} and the
+default @code{'box}.")
(width ,ly:dimension? "The width of a grob measured in staff
space.")
(word-space ,ly:dimension? "Space to insert between words in
(parenthesis-friends . (dot))
(stem-attachment . (0.0 . 1.35))
(stencil . ,tab-note-head::print)
- (whiteout-box . #t)
+ (whiteout . #t)
(X-offset . ,ly:self-alignment-interface::x-aligned-on-self)
(Y-offset . ,staff-symbol-referencer::callback)
(Y-extent . ,grob::always-Y-extent-from-stencil)
(define-markup-command (whiteout layout props arg)
(markup?)
#:category other
- #:properties ((thickness 3))
+ #:properties ((style 'box)
+ (thickness '()))
"
@cindex adding a white background to text
-Provide a white background for @var{arg}.
+Provide a white background for @var{arg}. The shape of the white
+background is determined by @code{style}. The default
+is @code{box} which produces a white rectangle. @code{outline}
+approximates the outline of the markup.
@lilypond[verbatim,quote]
\\markup {
\\combine
- \\filled-box #'(-1 . 10) #'(-3 . 4) #1
- \\override #'(thickness . 1.5) \\whiteout whiteout
+ \\filled-box #'(-1 . 15) #'(-3 . 4) #1
+ \\override #'(thickness . 1.5)
+ \\whiteout whiteout-box
}
-@end lilypond"
- (stencil-whiteout
- (interpret-markup layout props arg)
- (* thickness
- (ly:output-def-lookup layout 'line-thickness))))
-
-(define-markup-command (whiteout-box layout props arg)
- (markup?)
- #:category other
- #:properties ((thickness 0))
- "
-@cindex adding a rectangular white background to text
-
-Provide a rectangular white background for @var{arg}.
-
-@lilypond[verbatim,quote]
\\markup {
\\combine
- \\filled-box #'(-1 . 10) #'(-3 . 4) #1
- \\override #'(thickness . 1.5) \\whiteout-box whiteout-box
+ \\filled-box #'(-1 . 18) #'(-3 . 4) #1
+ \\override #'(style . outline)
+ \\override #'(thickness . 3)
+ \\whiteout whiteout-outline
}
@end lilypond"
- (stencil-whiteout-box
+ (stencil-whiteout
(interpret-markup layout props arg)
- (* thickness
- (ly:output-def-lookup layout 'line-thickness))))
+ style
+ thickness
+ (ly:output-def-lookup layout 'line-thickness)))
(define-markup-command (pad-markup layout props amount arg)
(number? markup?)
(ly:stencil-extent stencil X)
(ly:stencil-extent stencil Y)))
-(define*-public (stencil-whiteout
+(define*-public (stencil-whiteout-outline
stil #:optional (thickness 0.3) (color white)
(angle-increments 16) (radial-increments 1))
"This function works by creating a series of white or @var{color}
stencils radially offset from the original stencil with angles from
0 to 2*pi, at an increment of @code{angle-inc}, and with radii
from @code{radial-inc} to @var{thickness}. @var{thickness} is how big
-the white outline is in staff-spaces. @var{radial-increments} is how
-many copies of the white stencil we make on our way out to thickness.
-@var{angle-increments} is how many copies of the white stencil
-we make between 0 and 2*pi."
+the white outline is, as a multiple of line-thickness.
+@var{radial-increments} is how many copies of the white stencil we make
+on our way out to thickness. @var{angle-increments} is how many copies
+of the white stencil we make between 0 and 2*pi."
(if (or (not (positive? angle-increments))
(not (positive? radial-increments)))
(begin
`(delay-stencil-evaluation ,(delay whiteout-expr)))
stil)))))
-(define*-public (stencil-whiteout-box stencil
+(define*-public (stencil-whiteout-box stil
#:optional (thickness 0) (blot 0) (color white))
- "@var{thickness} is how far in staff-spaces the white outline
-extends past the extents of @var{stencil}."
+ "@var{thickness} is how far, as a multiple of line-thickness,
+the white outline extends past the extents of stencil @var{stil}."
(let*
- ((x-ext (interval-widen (ly:stencil-extent stencil X) thickness))
- (y-ext (interval-widen (ly:stencil-extent stencil Y) thickness)))
+ ((x-ext (interval-widen (ly:stencil-extent stil X) thickness))
+ (y-ext (interval-widen (ly:stencil-extent stil Y) thickness)))
(ly:stencil-add
(stencil-with-color (ly:round-filled-box x-ext y-ext blot) color)
- stencil)))
+ stil)))
+
+(define-public (stencil-whiteout stil style thickness line-thickness)
+ "@var{style} is a symbol that determines the shape of the white
+background. @var{thickness} is how far, as a multiple of
+@var{line-thickness}, the white background extends past the extents
+of stencil @var{stil}. If @var{thickness} has not been specified
+by the user, an appropriate default is chosen based on @var{style}."
+ (let ((thick (* line-thickness
+ (if (number? thickness)
+ thickness
+ (if (eq? style 'outline) 3 0)))))
+ (if (eq? style 'outline)
+ (stencil-whiteout-outline stil thick)
+ (stencil-whiteout-box stil thick))))
(define-public (arrow-stencil-maker start? end?)
"Return a function drawing a line from current point to @code{destination},
(make-simple-markup (simple-format #f "~a: NaN/inf" name))))
(let ((text-stencil (interpret-markup
layout text-props
- (markup #:whiteout-box #:simple name)))
+ (markup #:whiteout #:simple name)))
(dim-stencil (interpret-markup
layout text-props
- (markup #:whiteout-box
+ (markup #:whiteout
#:simple (cond
((interval-empty? extent)
"empty")