lilypond-user
[Top][All Lists]
Advanced

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

Re: absolute font size issues


From: Marc Hohl
Subject: Re: absolute font size issues
Date: Wed, 12 Nov 2014 20:09:07 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

Am 12.11.2014 um 13:35 schrieb Werner LEMBERG:

Well, I was about to answer, but somehow ...

:-)

I defined some \abs-... markup commands myself

Ha!  Where are they?  I guess this would have saved me many hours of
wading through obscure LilyPond Scheme code...

D'oh. A closer look into the sources of my old project dates 2011, and I did not use \abs-... but \...-mm instead and gave all dimensions in millimetres.

Anyway, here are the definitions, in case they might be useful for somebody:

#(define-markup-command (hspace-mm layout props amount) (number?)
 (let ((o-s (ly:output-def-lookup layout 'output-scale)))
   (ly:make-stencil "" (cons 0 (abs (/ amount o-s))) '(0 . 0) )))

#(define-markup-command (vspace-mm layout props amount) (number?)
 (let ((o-s (ly:output-def-lookup layout 'output-scale)))
   (ly:make-stencil "" '(0 . 0) (cons 0 (abs (/ amount o-s))))))

#(define-markup-command (epsfile-mm layout props axis size file-name)
  (number? number? string?)
  (let* ((o-s (ly:output-def-lookup layout 'output-scale))
         (scaled-size (abs (/ size o-s))))
  (if (ly:get-option 'safe)
      (interpret-markup layout props "not allowed in safe")
      (eps-file->stencil axis scaled-size file-name)
      )))


and wondered if it would be feasible to implement a "switch" –
something like

   \absoluteSizeOn

or similar, to avoid the need of defining everything twice – with
relative sizes and absolute sizes, respectively.

Having an `\abs-' prefix is easy to remember.  I would favor this more
than `\absoluteSizeOn', but I fully agree that defining everything
twice is error-prone.  What about adding a `meta macro' (or special
form, or whatever) that generates absolute and non-absolute versions?
I imagine something like

   (make-relative-absolute
     (define-markup-command (foo ...)
        ...))

to create \foo and \abs-foo.  No idea whether this is possible at all,
however.  In case it *is* possible, we should probably continue the
discussion on lilypond-devel.

I like the idea of this 'meta macro' but I don't have a clue whether this is possible or not (I assume yes, but I won't be able to program it myself).

Marc


     Werner





reply via email to

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