lilypond-user
[Top][All Lists]
Advanced

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

Markup with dimensions


From: Andrew Bernard
Subject: Markup with dimensions
Date: Wed, 22 Feb 2017 13:21:16 +1100

Just a question about \with-dimensions in markup. I have a simple function which is to draw a line between two specified points, not just to an end point as per the \draw-line type functions. Unless you specify \with-dimensions at the point of calling the markup command, it starts at the (0 . 0) point. While I can understand this, the question is, can the \with-dimensions function (I use the term function loosely here) be incorporated into the scheme markup command? Or is this a case for writing the markup in lilypond syntax in the scheme function and using the \with-dimensions that way? I was unable to find a scheme with-dimensions function - I imagine that is because the dimension calculations happens at a different stage of the layout computation?

I want this function rather than an alternate solution as it is a cut down MWE of a more elaborate function that incorporates some other graphic commands as well.

So then as a second question, is it better to write define-markup-command functions in all Scheme, or to use lilypond syntax therein? I seem to recall some brief mention of this point in the list some time ago, but I never got the impression of a definitive answer or firm recommendation.


Andrew

== snip

\version "2.19.55"

#(define-markup-command (line-from-to layout props from to)
   (number-pair? number-pair?)
   #:properties ((thickness 0.15))
   (let* ((startx (car from))
          (starty (cdr from))
          (endx (car to))
          (endy (cdr to)))
     (make-line-stencil thickness startx starty endx endy)))

{
  c'4
  ^\markup \draw-line #'(4 . 4)
   c'4
  ^\markup \line-from-to #'(0.5 . -3) #'(3 . 3)
  c'4
  ^\markup \with-dimensions #'(0 . 0) #'(0 . 0) \line-from-to #'(0.5 . -3) #'(3 . 3)
}


== snip



reply via email to

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