bug-lilypond
[Top][All Lists]
Advanced

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

Update for http://lilypond.org/doc/v2.20/Documentation/snippets/tweaks-a


From: Johannes Feulner
Subject: Update for http://lilypond.org/doc/v2.20/Documentation/snippets/tweaks-and-overrides
Date: Thu, 29 Oct 2020 18:18:28 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1

I suggest to update code and picture of the snippet  "Adding Links to objects".

Changes:

* Update link URLs to a more current version of the documentation

* Fix link for accidental

#(define (add-link url-strg)
  (lambda (grob)
    (let* ((stil (ly:grob-property grob 'stencil)))
      (if (ly:stencil? stil)
        (begin
          (let* (
             (x-ext (ly:stencil-extent stil X))
             (y-ext (ly:stencil-extent stil Y))
             (url-expr (list 'url-link url-strg `(quote ,x-ext) `(quote ,y-ext)))
             (new-stil (ly:stencil-add
                 (ly:make-stencil url-expr x-ext y-ext) stil)))
          (ly:grob-set-property! grob 'stencil new-stil)))
        #f))))

%%%% test

urlI =
"http://lilypond.org/doc/v2.20/Documentation/notation/writing-pitches";

urlII =
"http://lilypond.org/doc/v2.20/Documentation/notation/rhythms";

urlIII =
"http://lilypond.org/doc/v2.20/Documentation/notation/note-heads";

urlIV =
"http://lilypond.org/doc/v2.20/Documentation/notation/beams";

urlV =
"http://lilypond.org/doc/v2.20/Documentation/notation/note-head-styles";

urlVI =
"http://lilypond.org/doc/v2.20/Documentation/notation/writing-pitches";

\relative c' {
  \key cis \minor

  \once \override Staff.Clef.color = #green
  \once \override Staff.Clef.after-line-breaking =
    #(add-link urlI)

  \once \override Staff.TimeSignature.color = #green
  \once \override Staff.TimeSignature.after-line-breaking =
    #(add-link urlII)

  \once \override NoteHead.color = #green
  \once \override NoteHead.after-line-breaking =
    #(add-link urlIII)

  cis'1
  \once \override Beam.color = #green
  \once \override Beam.after-line-breaking =
    #(add-link urlIV)
  cis8 dis e fis gis2
  <gis,
   \tweak Accidental.color #green
   \tweak Accidental.after-line-breaking #(add-link urlVI)
   \tweak color #green
   \tweak after-line-breaking #(add-link urlV)
   \tweak style #'harmonic
   bis
   dis
   fis
  >1
  <cis, cis' e>
}

Now with colored accidental and link on the accidental:

Before:

--
Johannes Feulner
Tel: +49 721 33500158  johannes.feulner@scorio.com

scorio GmbH  Bonhoefferweg 3   76327 Pfinztal
Geschäftsführer Johannes Feulner
Sitz der Gesellschaft Karlsruhe
Amtsgericht Mannheim HRB 713486



reply via email to

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