lilypond-user
[Top][All Lists]
Advanced

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

Re: Custom clef horizontal adjustment.


From: dfro
Subject: Re: Custom clef horizontal adjustment.
Date: Fri, 6 Jul 2018 02:13:22 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

I put the postscript code into a spreadsheet and calculated the x positions to move over -200 units, and put the 'moveto, lineto, curveto, closepath' commands first. In the code below I am able to control spacing nicely with "\override Staff.Clef.space-alist" except for the note clashing with the third custom symbol in the first measure. Is there a way to control or fix this?

It looks like a spreadsheet is necessary, since it seems to me to be the easiest way to switch the place of the commands and numbers.
Any advice is greatly appreciated.

Peace,
David Froseth



%CODE START

 \version "2.18.2"

altoClef =
#(ly:make-stencil
  `(path 0.001
    `(moveto    48    -306
lineto    48    -492
curveto    48    -496    45    -500    40    -500
lineto    18    -500
curveto    13    -500    10    -496    10    -492
lineto    10    492
curveto    10    496    13    500    18    500
lineto    40    500
curveto    45    500    48    496    48    492
lineto    48    292
curveto    74    270    148    242    170    242
curveto    204    242    262    228    262    453
curveto    262    560    276    670    376    670
curveto    428    670    471    626    471    571
curveto    471    516    428    471    376    471
curveto    326    471    330    496    320    503
curveto    313    502    310    478    310    437
lineto    310    340
curveto    310    192    290    94    277    79
curveto    242    39    132    70    48    70
lineto    48    -83
curveto    132    -83    242    -53    277    -93
curveto    290    -108    310    -206    310    -354
lineto    310    -451
curveto    310    -491    313    -516    320    -517
curveto    330    -509    326    -485    376    -485
curveto    428    -485    471    -530    471    -584
curveto    471    -640    428    -684    376    -684
curveto    276    -684    262    -574    262    -467
curveto    262    -242    204    -256    170    -256
curveto    148    -256    74    -283    48    -306
closepath
moveto    -70    -500
lineto    -192    -500
curveto    -196    -500    -200    -496    -200    -492
lineto    -200    492
curveto    -200    496    -196    500    -192    500
lineto    -70    500
curveto    -66    500    -62    496    -62    492
lineto    -62    -492
curveto    -62    -496    -66    -500    -70    -500
closepath
)
     'round 'round #t)
   (cons  -0.1 5)
   (cons  -5   5))

\layout {
  \context {
    \Score
    \override Clef.stencil =
      #(lambda (grob)
         (let* ((sz (ly:grob-property grob 'font-size 0))
                (mlt (magstep sz))
                (glyph (ly:grob-property grob 'glyph-name)))
                 (cond
                  ((equal? glyph "clefs.C")
                     (ly:stencil-scale altoClef (* .004 mlt) (* .004 mlt)))
                  ((equal? glyph "clefs.C_change")
                    (ly:stencil-scale altoClef (* .003 mlt) (* .003 mlt)))
                  (else (ly:clef::print grob)))))
  }
}

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

\relative c' {

      \numericTimeSignature
      \clef "alto"
      \override Staff.Clef.space-alist =
      #'( (staff-bar extra-space . 2.4)
          (time-signature minimum-space . 2.4)
          (first-note minimum-fixed-space . 2.5)
          (next-note extra-space . 2.6)
          (right-edge extra-space . 3))

      %next-note variable in measure 1 does not work,
      %and the note before the last custom symbol in the measure is clashing.

      | c4 c
      \set Staff.forceClef = ##t
      \clef "alto"

      c4 c \break
      \set Staff.forceClef = ##t
      \clef "alto"

      | c4 c c c

      \time 2/4
      \break
      \override Staff.Clef.stencil = #ly:clef::print
      \override Staff.Clef.space-alist =
      #'((staff-bar extra-space . 5)
         (time-signature minimum-space . 8)
         (first-note minimum-fixed-space . 8)
         (next-note extra-space . 8)
         (right-edge extra-space . 0))
      \set Staff.forceClef = ##t
      \clef "alto"

      | c8 c
      \set Staff.forceClef = ##t
      \clef "alto"

      c c \break

      \set Staff.forceClef = ##t
      \clef "alto"

      | c8 c c c
}

\paper {
      ragged-right = ##t
      indent = #0
}

%CODE END





reply via email to

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