lilypond-user
[Top][All Lists]
Advanced

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

Custom clef horizontal adjustment.


From: dfro
Subject: Custom clef horizontal adjustment.
Date: Mon, 2 Jul 2018 20:37:04 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

Hello,

I am interested in using custom clef symbols. I am practicing with a snippet from the library that replaces the internal "alto" clef glyph with a user defined postscript glyph. However, the behavior of the new glyph is not the same as the standard "alto" glyph.

In the code snippet below, the custom glyph sometimes collides with the notes before it, and sometimes does not. Also, I cannot control the distance from notes immediately after the custom glyph, as I can with the standard "alto" glyph.

I have tried to experiment and to understand the various Clef object properties, but I cannot figure it out. I am sure there is something basic about grob behavior that I don't understand, yet.

I am wondering:

How can I get the notes that are before and after to not clash with custom clef glyphs? Why is the (next-note extra-space . 8) property not working with the custom clef glyph?

Is there a way to establish the horizontal bounding box of a custom postscript glyph?

How does one adjust the spacing to the left of a standard or custom clef glyph?

Thanks for any help.

Peace,
David Froseth



%CODE START
%%%%% Valentin Villanave's macro for the French-style C clef %%%%%%%

altoClef = \markup \postscript #"
gsave newpath
   0.004 0.004 scale
   -200 0 translate
   248 -306 moveto
     248 -492 lineto
     248 -496 245 -500 240 -500 curveto
     218 -500 lineto
     213 -500 210 -496 210 -492 curveto
     210 492 lineto
     210 496 213 500 218 500 curveto
     240 500 lineto
     245 500 248 496 248 492 curveto
     248 292 lineto
     274 270 348 242 370 242 curveto
     404 242 462 228 462 453 curveto
     462 560 476 670 576 670 curveto
     628 670 671 626 671 571 curveto
     671 516 628 471 576 471 curveto
     526 471 530 496 520 503 curveto
     513 502 510 478 510 437 curveto
     510 340 lineto
     510 192 490 94 477 79 curveto
     442 39 332 70 248 70 curveto
     248 -83 lineto
     332 -83 442 -53 477 -93 curveto
     490 -108 510 -206 510 -354 curveto
     510 -451 lineto
     510 -491 513 -516 520 -517 curveto
     530 -509 526 -485 576 -485 curveto
     628 -485 671 -530 671 -584 curveto
     671 -640 628 -684 576 -684 curveto
     476 -684 462 -574 462 -467 curveto
     462 -242 404 -256 370 -256 curveto
     348 -256 274 -283 248 -306 curveto
    closepath
    130 -500 moveto
     8 -500 lineto
     4 -500 0 -496 0 -492 curveto
     0 492 lineto
     0 496 4 500 8 500 curveto
     130 500 lineto
     134 500 138 496 138 492 curveto
     138 -492 lineto
     138 -496 134 -500 130 -500 curveto
    closepath
fill grestore"

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

\relative c' {

      \numericTimeSignature
      \clef "alto"
      \override Staff.Clef.stencil = #(lambda (grob)
                                            (grob-interpret-markup grob altoClef))
      \override Staff.Clef.space-alist =
      #'( (staff-bar extra-space . 8)
          (time-signature minimum-space . 8)
          (first-note minimum-fixed-space . 8)
          (next-note extra-space . 8)
          (right-edge extra-space . 0))

      %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 . 8)
         (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
}

%CODE END




reply via email to

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