lilypond-user
[Top][All Lists]
Advanced

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

Re: absolute font size issues


From: Werner LEMBERG
Subject: Re: absolute font size issues
Date: Wed, 12 Nov 2014 07:42:06 +0100 (CET)

>   . What's the unit of \abs-fontsize's `SIZE' parameter?
>     Typographical Points, i.e. 72.27pt = 1 inch?  The documentation
>     lacks this.

After investigations I now know that the unit of `SIZE' is indeed
Typographical Points.  This *must* be mentioned right there, since it
otherwise contradicts a statement from section `Distances and
measurements':

  Absolute distances are used for specifying margins, indents, and
  other page layout details, and are by default specified in
  millimeters.

I've applied the corresponding trivial patch to the doc string of
`\abs-fontsize' directly to staging.

>   . While we have \abs-fontsize, there is no equivalent to that for
>     `baseline-skip'.  What's the recommended way to set it in a
>     consistent way (this is, always using the same *typographical*
>     unit)?  I can imagine a combination of \abs-fontsize and
>     baseline-skip, but this sounds quite inconvenient and
>     error-prone.

And this doesn't work, of course...

>     Additionally, it's not trivial to map the units of baseline-skip
>     to, say, typographical points.
> 
>     I would like to have an \abs-baselike-skip function added to
>     LilyPond...
> 
> I guess I'm not the first stumbling upon those issues, so I wonder
> whether there are nice solutions to this already available.

Given that responses on this list are often within minutes, and these
my questions stayed unanswered I guess that no-one has thought about
this, which actually surprises me.

Well, below is my solution for such a function.  It took me a very
long time to find out how to compute the factor between the default
global size (20pt) and the actual value set with
`set-global-staff-size'.  Is there a better way?

I suggests that something similar – possibly improved – gets added to
the lilypond core.


    Werner


======================================================================


#(define-markup-command (abs-baseline-skip layout props size arg)
   (number? markup?)
   #:category font
   "Use @var{size} as the absolute value for @code{baseline-skip} (in points)."

   ;; The value `output-scale' gives the size (in mm) of the staff space at
   ;; the global staff size.  By definition, the staff space for a staff
   ;; size of 20pt is 20pt / 4 = 5pt.
   (let* ((5pt (ly:pt 5))
          (output-scale (ly:output-def-lookup layout 'output-scale 1))
          (factor (/ output-scale 5pt))
          (staff-space (* 5 factor))
          (skip (/ size staff-space)))
     (interpret-markup layout
                       (cons `((baseline-skip . ,skip))
                             props)
                       arg)))


\header { tagline = ##f }
\paper { print-page-number = ##f }

#(set-global-staff-size 25)

\markup { \abs-fontsize #200 {
            \override #'(baseline-skip . 40) {
              \column { A A } } } }

\pageBreak

\markup { \abs-fontsize #200 {
            \abs-baseline-skip #250 {
              \column { A A } } } }

reply via email to

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