lilypond-user
[Top][All Lists]
Advanced

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

Re: lilypond-user Digest, Vol 146, Issue 98


From: Werner LEMBERG
Subject: Re: lilypond-user Digest, Vol 146, Issue 98
Date: Tue, 20 Jan 2015 07:40:25 +0100 (CET)

> I dare say there is a prettier and more concise way of doing this,
> but at least I now have something that works!

What about the following?


#(define-public (pt-to-ss size)
   "Convert from points to staff space units."

   ;; 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 $defaultpaper
                                              'output-scale 1))
          (factor (/ output-scale 5pt))
          (staff-space (* 5 factor)))
     (/ size staff-space)))

#(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)."

   (interpret-markup layout
                     (cons `((baseline-skip . ,(pt-to-ss size)))
                           props)
                     arg))

\paper {
  line-width = 170.0\mm
  top-margin = 15.0\mm
  bottom-margin = 15.0\mm
  indent = 20.0\mm

  top-markup-spacing = #`((basic-distance . ,(pt-to-ss 30))
                          (minimum-distance . ,(pt-to-ss 30))
                          (padding . 0)
                          (stretchability . 0))
  markup-markup-spacing = #'((basic-distance . ,(pt-to-ss 15))
                             (minimum-distance . ,(pt-to-ss 15))
                             (padding . 0)
                             (stretchability . 0))
  ...

  bookTitleMarkup = \markup {
    \abs-baseline-skip #20 {
      \column {
        \fill-line {
          \abs-fontsize #18 \bold
          \fromproperty #'header:title
        }
        \fill-line {
          \abs-fontsize #11 \bold
          \fromproperty #'header:subtitle
        }
        \fill-line {
          \abs-fontsize #9 \bold
          \fromproperty #'header:subsubtitle
        }
        ...
      }
    }
  }
}


    Werner



reply via email to

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