----- Original Message ----- From: <d...@gnu.org> To: <philehol...@googlemail.com>; <tdanielsmu...@googlemail.com>; <em...@philholmes.net>; <m...@philholmes.net>
Cc: <lilypond-devel@gnu.org>; <re...@codereview-hr.appspotmail.com>
Sent: Tuesday, August 12, 2014 3:17 PM
Subject: Re: Adds incipit section to NR (issue 108270043 by philehol...@googlemail.com)


On 2014/08/12 13:58:44, mail_philholmes.net wrote:

The problem is the other way round.  incipit-width is not scaled
within the
layout block, and so produces correct results for width.

I am not convinced that the results are "correct" when they are not
scaled the same as every other measure including "\mm".  Have you tried
my proposal?

indent and
short-indent are scaled, and so produce widths that are too small for
the
desired output.  Attached is a sample file that illustrates the
problem.

No attachment here.

In
it is a potential solution: using

scale-factor = #( / 1.0 (module-ref (current-module) 'mm) )

That would seem to be a satisfactory way of avoiding problems should
the way
scaling is done change in future?

I am skeptical.  The main problem I see is that when inheriting a
grob-layout as the start of a \layout block, then 3 will not be the same
as 3\mm.  We probably need a way to get at the unscaled layout, then
scale afterwards.  I would not want to _calculate_ the unscaled layout
since that buys us a buildup of numerical errors.

https://codereview.appspot.com/108270043/


Attachment was sent but may be stripped by the way it was delivered. Re-attached.

As to numerical errors: remember, all we're trying to do is get an indent (i.e. the space for the incipit) said to be 8 cm wide to appear as 8 cm, not 4.6 (approx.) Whether it's 8.001 cm or 7.999 cm is somewhat irrelevant.

--
Phil Holmes
\pointAndClickOff

incipitA =
#(define-music-function (parser location incipit-music) (ly:music?)
  #{
    \once \override Staff.InstrumentName #'stencil =
      #(lambda (grob)
        (let* ((instrument-name (ly:grob-property grob 'long-text)))
        (set! (ly:grob-property grob 'long-text)
          #{ \markup {
            \score
            {
              \new Staff
              {
                $incipit-music
              }
              \layout { $(ly:grob-layout grob)
                #(format #t "grob::cm: ~a " (module-ref (current-module) 'cm))
                scale-factor = #( / 1.0 (module-ref (current-module) 'mm) )
                #(format #t "test: ~a " (module-ref (current-module) 'scale-factor))
                #(format #t "indent: ~a " (module-ref (current-module) 'indent))
                #(format #t "short-indent: ~a " (module-ref (current-module) 'short-indent))
                #(format #t "incipit-width: ~a " (module-ref (current-module) 'incipit-width))
              }
              \layout {
                #(format #t "cm: ~a " (module-ref (current-module) 'cm))
                test = \cm
                #(format #t "test: ~a " (module-ref (current-module) 'test))
              }
            }
            }
          #})
          (system-start-text::print grob)))
  #}
)

\score {
  {
    \set Staff.instrumentName = #"Altus"
    \incipitA { f''1 }
  }
  \layout {
    indent = 8\cm
    short-indent = 1\cm
    incipit-width = 2\cm
  }
}
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to