lilypond-user
[Top][All Lists]
Advanced

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

Re: Does 'strut' command work in LilyPond?


From: Karol Majewski
Subject: Re: Does 'strut' command work in LilyPond?
Date: Sun, 30 Mar 2014 15:01:07 +0200

Very nice workaround! For Cental Europe languages it's better to replace "fp" 
with, let's say, "Śp".

> 2014-03-30 0:35 GMT+01:00 Karol Majewski <address@hidden>:
> > According to:
> >
> > http://www.lilypond.org/doc/v2.19/Documentation/notation/other
> >
> > "\strut Create a box of the same height as the space in the current font."
> >
> > So
> >
> > \markup { \strut \box "." }
> > \markup { \strut \box "bp" }
> >
> > should draw a box with constant height. But it doesn't. Maybe I'm doing 
> something wrong?
> >
> > -Karol
> 
> 
> 
> Hi,
> 
> according to it's description \strut works as expected, imho:
> \strut creates a (invisible) box of the same _height_ (Y-direction!)
> as the _space_ (X-direction!) in the current font.
> 
> Look at the output of:
> 
> \markup
> \box \vcenter {
>     %% current default \strut:
>     \strut
>     %% sort of rebuilding it:
>     \rotate #90 " "
>     %% another markup to compare:
>     \concat { \strut "." }
> }
> 
> 
> I think the request is another:
> 2014-03-30 10:24 GMT+02:00 Karol Majewski <address@hidden>:
> > OK, so the question is: Is there a way to create box that has _height_ 
> of total font _height_?
> > By "total font height" I mean the distance between bottom bearing line 
> and top bearing line
> 
> As sort of workaround you may use the coding below.
> Please note, it's a _workaround_ ! Thinking of other non-european
> languages it might easily be broken.
> 
> 
> \version "2.18.0"
> 
> #(define-markup-command (vstrut layout props)
>   ()
>   #:category other
>   "
> @cindex creating vertical space in text
> 
> Create a box of the same height as the current font."
>   (let ((ref-mrkp (interpret-markup layout props "fp")))
>     (ly:make-stencil (ly:stencil-expr empty-stencil)
>                      empty-interval
>                      (ly:stencil-extent ref-mrkp Y))))
> 
> %%%%%%%%%%%%%%%
> %% EXAMPLE
> %%%%%%%%%%%%%%%
> 
> ln-mrkp = \markup \draw-line #'(2 . 0)
> 
> \markup
> \override #'(baseline-skip . 1) {
>     \column \box {
>         \ln-mrkp
>         \ln-mrkp
>         \ln-mrkp
>     }
>     \column \box  {
>         "x"
>         "x"
>         "x"
>     }
>     "opposed to: "
>     \column \box {
>         \line { \vstrut \ln-mrkp }
>         \line { \vstrut \ln-mrkp }
>         \line { \vstrut \ln-mrkp }
>     }
>     \column \box {
>         \line { \vstrut "x" }
>         \line { \vstrut "x" }
>         \line { \vstrut "x" }
>     }
> }
> 
> Cheers,
>   Harm






reply via email to

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