lilypond-user
[Top][All Lists]
Advanced

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

Re: Getting an override into a markup function


From: Thomas Morley
Subject: Re: Getting an override into a markup function
Date: Fri, 25 Sep 2015 23:10:48 +0200

2015-09-25 12:28 GMT+02:00 Malte Meyn <address@hidden>:
>
>
> Am 25.09.2015 um 10:58 schrieb Urs Liska:
>>
>> {
>>    \override TextScript.self-alignment-X = #LEFT
>>    c'2 ^\markup \rotate #90 "This is a long markup" c
>> }
>>
>
> You could use an event function:
>
> %%%%%
> \version "2.19.27"
>
> verticalText =
> #(define-event-function (text) (markup?)
>    #{
>      -\tweak TextScript.self-alignment-X #LEFT
>      -\markup \rotate #90 #text
>    #})
>
> {
>   c'2^\verticalText \markup \italic "This is a long markup" c
>   c'2\verticalText "This is a long text" c
> }
> %%%%%



Using \override or \tweak or an event-function will not work for
markups at toplevel and/or if not the entire markup is rotated, see:

\markup {
    "ab"
    \rotate #90 "------|------"
    "xy"
}


Hence I wrote 'my-rotate':


#(define-markup-command (my-rotate layout props ang arg)
  (number? markup?)
  (let* ((stil (interpret-markup layout props arg))
         (stil-x-length (interval-length (ly:stencil-extent stil X)))
         (stil-y-length (interval-length (ly:stencil-extent stil Y))))
    (ly:stencil-rotate stil ang (/ stil-y-length -2) (/ stil-x-length -2))))

\markup {
    "ab"
    \my-rotate #90 "------|------"
    "xy"
}


Not sure if I should add some padding at top and bottom to respect
baseline-skip.
For now I refused to do so, at least it's consistent to other commands, see:

\markup {
  \wordwrap {
    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed
    do eiusmod tempor incididunt ut labore et dolore
    \draw-line #'(0 . 5)
    \my-rotate #90
    magna aliqua.
    Ut enim ad minim veniam, quis nostrud exercitation ullamco
    laboris nisi ut aliquip ex ea commodo consequat.
  }
}


HTH,
  Harm


[off-topic]
I would have loved to check the output with adobe acrobat reader,
because of it's high resolution (was up to 6400%). Though, it's not
longer available for Linux.
For now I used qpdfview (up to 1000%)
Are there Linux-pdfviewer with higher resolution available?



reply via email to

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