X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=input%2Fregression%2Fstencil-hacking.ly;h=40d450fcd6b961ff43baba516bdc2c3f365ec1ff;hb=8659a99f233f5c4684292728e7ad4206669b35b0;hp=eee9f790a8fb423a035496e1538b6c64a1d7724f;hpb=7cbbc196bb885b0cec54aaa6f905fc89dc837ac1;p=lilypond.git diff --git a/input/regression/stencil-hacking.ly b/input/regression/stencil-hacking.ly index eee9f790a8..40d450fcd6 100644 --- a/input/regression/stencil-hacking.ly +++ b/input/regression/stencil-hacking.ly @@ -1,5 +1,4 @@ - -\version "2.5.13" +\version "2.19.21" \header { texidoc=" You can write stencil callbacks in Scheme, thus providing custom glyphs for notation elements. A simple example is @@ -16,32 +15,29 @@ parens are also not seen by accidentals. "Construct a function that will do CALLBACK and add parentheses. Example usage: - \\property NoteHead \\override #'print-function - = - #(parenthesize-callback Note_head::print) - -" - + \\override NoteHead.stencil + = + #(parenthesize-callback ly:note-head::print)" (define (parenthesize-stencil grob) "This function adds parentheses to the original callback for -GROB. The dimensions of the stencil is not affected. +GROB. It does not affect the dimensions of the stencil. " - (let* ((fn (ly:get-default-font grob)) + (let* ((fn (ly:grob-default-font grob)) (pclose (ly:font-get-glyph fn "accidentals.rightparen")) (popen (ly:font-get-glyph fn "accidentals.leftparen")) (subject (callback grob)) ; remember old size - (subject-dim-x (ly:stencil-extent subject 0)) - (subject-dim-y (ly:stencil-extent subject 1))) + (subject-dim-x (ly:stencil-extent subject X)) + (subject-dim-y (ly:stencil-extent subject Y))) - ; add parens + ;; add parens (set! subject (ly:stencil-combine-at-edge - (ly:stencil-combine-at-edge subject 0 1 pclose 0.2) - 0 -1 popen 0.2)) + (ly:stencil-combine-at-edge subject X RIGHT pclose 0.2) + X LEFT popen 0.2)) ; revert old size. (ly:make-stencil @@ -49,18 +45,19 @@ GROB. The dimensions of the stencil is not affected. parenthesize-stencil) -\layout { raggedright = ##t } -\relative c' { - c4 e +\layout { ragged-right = ##t } +\relative { + c'4 e - \override NoteHead #'print-function + \override NoteHead.stencil = - #(parenthesize-callback Note_head::print) + #(parenthesize-callback ly:note-head::print) g bes - \revert NoteHead #'print-function - \override Beam #'print-function + \revert NoteHead.stencil + + \override Beam.stencil = - #(parenthesize-callback Beam::print) + #(parenthesize-callback ly:beam::print) a8 gis8 a2.