Re: Markup with dimensions

2017-02-24 Thread Simon Albrecht

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>) 
<http://lilypond.org/doc/v2.19/Documentation/extending/markup-construction-in-scheme.html%3E%29> 
as #:with-dimensions or directly as make-with-dimensions-markup.

HTH, Simon



Am 22-Feb-2017 03:21:41 +0100 schrieb andrew.bern...@gmail.com:

   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

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Markup with dimensions

2017-02-21 Thread Andrew Bernard
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
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user