David is right - it's the bounding box being rotated. As bounding boxes can
only have heights and widths in vertical and horizontal direction (there
isn't even such a thing as an italic slant in LilyPond), the resulting new
bounding box's height and width increases.
I usually solve this problem by calculating the desired X-extent and
Y-extent and set the stencil dimensions.
In scheme, I use (ly:stencil-outline stencil point-stencil) to rotate
stencil using the dimensions of point-stencil so that the bounding box isn't
*Example:* I've created a fake slanted markup command by combining rotate,
scale, rotate back, scale (because there is no shearing) that keeps the
original stencil extent.
Without stencil extent manipulations (using point-stencil dimensions etc.)
the resulting bounding box would be ridiculously high and totally unusable.
(slanted layout props arg)
#:properties ((slant-angle 12))
"Fake a slanted font"
(let* ((alpha-rad (* 0.5 (acos (tan (* (/ PI -180) slant-angle)))))
(alpha-deg (* (/ 180 PI) alpha-rad))
(stencil (if (markup? arg) (interpret-markup layout props arg)
(ly:stencil-rotate (ly:stencil-outline stencil point-stencil) 45 0
1 (* (tan alpha-rad)))
(* (- alpha-deg)) 0 0)
(* (sqrt 2) (cos alpha-rad)) (/ 0.5 (sqrt 0.5) (sin alpha-rad)))
\markup \override #'(box-padding . 0) \box \slanted "Poor man’s slanted
This is a simple case just keeping the original extents, but in the end, the
desired new bounding box (i.e. stencil extent) has to be calculated
explicitly depending on the desired output, I couldn't find an automatic
Simple trigonometric functions are all you need - it could be worse... ;)
All the best,
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html
lilypond-user mailing list