Hi Harm, Hi David,

Here's what can be done as a first step, just to go a little further even
if, for sure, that does not solve our calculation problem.
The idea is to make as many conditions as staff sizes from 1 to 30 (or more
if needed).
Each staff size has an acurate parameter tested and controled at a 3000%
zoom.
Here we go :

\version "2.17.21"

%% A markup-command for better viewing and the possibility
%% to read out some values
#(define-markup-command (rectangle layout props x) (number?)
" returns a rectangle "
   (let ((osc (ly:output-def-lookup layout 'output-scale))
         (pt (ly:output-def-lookup layout 'pt)))

    ;; (display "\n\t'output-scale \t")(write osc)
    ;; (display "\n\tpt from layout \t")(write pt)
    ;; (display "\n\t(* osc pt) \t")(write (* osc pt))
    ;; (newline)

   (interpret-markup layout props
     (markup #:stencil (make-filled-box-stencil  `(0 . ,x) '(0 . 3))))))

\paper {
        indent = 30
        %% #(display "\n\tpt from within \\paper \t")
        %% #(write pt)
}

\layout {
        % Better viewing:
        \override Score.RehearsalMark #'color = #red
        \override Score.RehearsalMark #'layer = #10
        \override Score.RehearsalMark #'extra-offset = #'(0 . -2.5)
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Test here with different values:

#(define staff-size 20)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#(set-global-staff-size staff-size)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Accord. here with param. below :

#(define (adjust-kern x-lngth)
   (* 10.000 x-lngth))


%{
  St-sz  param
  1 0.742
  2 1.448
  3 2.118
  4 2.755
  5 3.363
  6 3.948
  7 4.505
  8 5.036
  9 5.546
  10 6.035
  11 6.504
  12 6.953
  13 7.385
  14 7.803
  15 8.204
  16 8.590
  17 8.963
  18 9.322
  19 9.667
  20 10.000
  21 10.323
  22 10.635
  23 10.938
  24 11.229
  25 11.515
  26 11.790
  27 12.057
  28 12.314
  29 12.564
  30 12.806
%}

show =
#(define-music-function (parser location x-length)(number?)
"
 returns some test-music, with the rectangle and tweaked BarLine.kern
"
#{
        \set Staff.instrumentName =
        \markup \fontsize #-1 \center-column {
                "stencil/kern-length?"
                #(number->string x-length)
        }

        R1
        \mark \markup
        \rectangle #x-length
        \override Staff.BarLine.kern = #(adjust-kern x-length)
        \bar "||"
        R1
#})

\header {
        title = "Adjust BarLine 'kern to stencil-extent"
        subtitle = #(format #f "Used global-staff-size: ~a" staff-size)
        subsubtitle = \markup \vspace #2
}

\show #1
\show #2
\show #10
\show #20

Of course, I have to let you do the scheme code, it's none of my knowledge.
Cheers,
Pierre
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to