Inside the chord (within the brackets @code{< >}), before the note to
be altered, place the @code{\\tweak} command, followed by
@code{#'font-size} and define the proper size like @code{#-2} (a tiny
-notehead).
+note head).
--- /dev/null
+%% Do not edit this file; it is automatically
+%% generated from LSR http://lsr.dsi.unimi.it
+%% This file is in the public domain.
+\version "2.13.10"
+
+\header {
+ lsrtags = "tweaks-and-overrides"
+
+ texidoc = "
+When working with grob callbacks, it can be helpful to understand a
+grob's @qq{ancestry}. Most grobs have @qq{parents} which influence the
+positioning of the grob. X- and Y-parents influence the horizontal and
+vertical positions for the grob, respectively. Additionally, each
+parent may have parents of its own.
+
+
+Unfortunately, there are several aspects of a grob's ancestry can lead
+to confusion:
+
+* The types of parents a grob has may depend on context. * For some
+grobs, the X- and Y-parents are the same. * A particular @qq{ancestor}
+may be related to a grob in multiple ways. * The concept of
+@qq{generations} is misleading.
+
+
+For example, the @code{System} grob can be both parent (on the Y-side)
+and grandparent (twice on the X-side) to a @code{VerticalAlignment}
+grob.
+
+
+This macro prints (to the console) a textual representation of a grob's
+ancestry.
+
+
+When called this way
+
+
+@{
+ \\once \\override NoteHead #'before-line-breaking = #display-ancestry
+ c @}
+
+
+The following output is generated:
+
+
+------------------------------------
+
+NoteHead X,Y: NoteColumn
+ X: PaperColumn
+ X,Y: System
+ Y: VerticalAxisGroup
+ X: NonMusicalPaperColumn
+ X,Y: System
+ Y: VerticalAlignment
+ X: NonMusicalPaperColumn
+ X,Y: System
+ Y: System
+
+
+
+"
+ doctitle = "Displaying grob ancestry"
+} % begin verbatim
+
+#(define (grob-name grob)
+ (if (ly:grob? grob)
+ (assoc-ref (ly:grob-property grob 'meta) 'name)
+ #f))
+
+#(define (get-ancestry grob)
+ (if (not (null? (ly:grob-parent grob X)))
+ (list (grob-name grob)
+ (get-ancestry (ly:grob-parent grob X))
+ (get-ancestry (ly:grob-parent grob Y)))
+ (grob-name grob)))
+
+#(define (format-ancestry lst padding)
+ (string-append
+ (symbol->string (car lst))
+ "\n"
+ (let ((X-ancestry
+ (if (list? (cadr lst))
+ (format-ancestry (cadr lst) (+ padding 3))
+ (symbol->string (cadr lst))))
+ (Y-ancestry
+ (if (list? (caddr lst))
+ (format-ancestry (caddr lst) (+ padding 3))
+ (symbol->string (caddr lst)))))
+ (if (equal? X-ancestry Y-ancestry)
+ (string-append
+ (format #f "~&")
+ (make-string padding #\space)
+ "X,Y: "
+ (if (list? (cadr lst))
+ (format-ancestry (cadr lst) (+ padding 5))
+ (symbol->string (cadr lst))))
+ (string-append
+ (format #f "~&")
+ (make-string padding #\space)
+ "X: " X-ancestry
+ "\n"
+ (make-string padding #\space)
+ "Y: " Y-ancestry
+ (format #f "~&"))))
+ (format #f "~&")))
+
+#(define (display-ancestry grob)
+ (display
+ (string-append
+ (format #f "~3&~a~2%" (make-string 36 #\-))
+ (format-ancestry (get-ancestry grob) 0)
+ (format #f "~2&"))))
+
+\relative c' {
+ \once \override NoteHead #'before-line-breaking = #display-ancestry
+ f
+ \once \override Accidental #'before-line-breaking = #display-ancestry
+ \once \override Arpeggio #'before-line-breaking = #display-ancestry
+ <f as c>\arpeggio
+}
+
(note-names (make-vector 7 (number->string (+ 1 delta)))))
(ly:grob-set-property! grob 'note-names note-names))))))))
+#(set-global-staff-size 26)
+
\layout {
+ ragged-right = ##t
\context {
\Voice
\consists \Ez_numbers_engraver
(note-names (make-vector 7 (number->string (+ 1 delta)))))
(ly:grob-set-property! grob 'note-names note-names))))))))
+#(set-global-staff-size 26)
+
\layout {
+ ragged-right = ##t
\context {
\Voice
\consists \Ez_numbers_engraver
\version "2.13.10"
\header {
-%% Translation of GIT committish: b7ec64504da87595509ae6e88ae546d6a0ce633d
- texidocfr = "
-Pour obtenir la partition d'un chanson, il suffit d'assembler
-des noms d'accords, une mélodie et des paroles :
-
-"
- doctitlefr = "Chanson simple"
-
lsrtags = "chords"
%% Translation of GIT committish: b2d4318d6c53df8469dfa4da09b27c15a374d0ca
"
doctitlede = "Ein einfaches Liedblatt"
+%% Translation of GIT committish: b7ec64504da87595509ae6e88ae546d6a0ce633d
+ texidocfr = "
+Pour obtenir la partition d'un chanson, il suffit d'assembler
+des noms d'accords, une mélodie et des paroles :
+
+"
+ doctitlefr = "Chanson simple"
texidoc = "
When put together, chord names, a melody, and lyrics form a lead sheet:
customizing-fretboard-fret-diagrams.ly
customizing-markup-fret-diagrams.ly
display-bracket-with-only-one-staff-in-a-system.ly
+displaying-grob-ancestry.ly
dotted-harmonics.ly
drawing-boxes-around-grobs.ly
drawing-circles-around-various-objects.ly
transcription-of-ancient-music-with-incipit.ly
tweaking-clef-properties.ly
tweaking-grace-layout-within-music.ly
+using-ly-grob-object-to-access-grobs-with--tweak.ly
using-postscript-to-generate-special-note-head-shapes.ly
using-the--tweak-command-to-tweak-individual-grobs.ly
vertically-aligned-dynamics-and-textscripts.ly
--- /dev/null
+%% Do not edit this file; it is automatically
+%% generated from LSR http://lsr.dsi.unimi.it
+%% This file is in the public domain.
+\version "2.13.10"
+
+\header {
+ lsrtags = "tweaks-and-overrides"
+
+ texidoc = "
+Some grobs can be accessed @qq{laterally} from within another grob's
+callback. These are usually listed as @qq{layout objects} in the
+@qq{Internal properties} section of a grob-interface. The function
+@code{ly:grob-object} is used to access these grobs.
+
+
+Demonstrated below are some ways of accessing grobs from within a
+NoteHead callback, but the technique is not limited to NoteHeads.
+However, the NoteHead callback is particularly important, since it is
+the implicit callback used by the @code{\\tweak} command.
+
+
+The example function defined below (\"display-grobs\") is probably not
+that useful, but it demonstrates that the grobs are indeed being
+accessed.
+
+
+Example console output:
+
+
+-------------------- #-Grob Accidental - #-Grob Arpeggio - #-Grob Stem -
+
+
+
+"
+ doctitle = "Using ly:grob-object to access grobs with \\tweak"
+} % begin verbatim
+
+#(define (notehead-get-accidental notehead)
+ ;; notehead is grob
+ (ly:grob-object notehead 'accidental-grob))
+
+#(define (notehead-get-arpeggio notehead)
+ ;; notehead is grob
+ (let ((notecolumn (notehead-get-notecolumn notehead)))
+ (ly:grob-object notecolumn 'arpeggio)))
+
+#(define (notehead-get-notecolumn notehead)
+ ;; notehead is grob
+ (ly:grob-parent notehead X))
+
+#(define (notehead-get-stem notehead)
+ ;; notehead is grob
+ (let ((notecolumn (notehead-get-notecolumn notehead)))
+ (ly:grob-object notecolumn 'stem)))
+
+#(define (display-grobs notehead)
+ ;; notehead is grob
+ (let ((accidental (notehead-get-accidental notehead))
+ (arpeggio (notehead-get-arpeggio notehead))
+ (stem (notehead-get-stem notehead)))
+ (format #t "~2&~a\n" (make-string 20 #\-))
+ (for-each
+ (lambda (x) (format #t "~a\n" x))
+ (list accidental arpeggio stem))))
+
+\relative c' {
+ %% display grobs for each note head:
+ %\override NoteHead #'before-line-breaking = #display-grobs
+ <c
+ %% or just for one:
+ \tweak #'before-line-breaking #display-grobs
+ es
+ g>1\arpeggio
+}
+