lilypond-user
[Top][All Lists]
Advanced

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

Re: Markup with dimensions


From: Simon Albrecht
Subject: Re: Markup with dimensions
Date: Fri, 24 Feb 2017 21:53:04 +0100

Hi Andrew,
 
I can’t comment on whether there is a clear point to be made in favour of either LilyPond syntax or using the scheme markup macro. Anyway, surely you can call with-dimensions from Scheme as well, either from the markup macro (which is covered in the Extending Manual, <http://lilypond.org/doc/v2.19/Documentation/extending/markup-construction-in-scheme.html>) as #:with-dimensions or directly as make-with-dimensions-markup.
 
HTH, Simon



Am 22-Feb-2017 03:21:41 +0100 schrieb address@hidden:

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]