]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/grob-description.scm
(warning): better robustness fix.
[lilypond.git] / scm / grob-description.scm
index 606a61a0795ad86948013fae430bd45ab8cccc92..4e19b91a2251998ef71598b28231a8d0a526be67 100644 (file)
@@ -2,29 +2,33 @@
 ;;;;
 ;;;;  source file of the GNU LilyPond music typesetter
 ;;;; 
-;;;; (c) 1998--20.301  Han-Wen Nienhuys <hanwen@cs.uu.nl>
+;;;; (c) 1998--2002  Han-Wen Nienhuys <hanwen@cs.uu.nl>
 ;;;;                 Jan Nieuwenhuizen <janneke@gnu.org>
 
 ;;;; distances are given in stafflinethickness (thicknesses) and
 ;;;; staffspace (distances)
 
 ;;;; WARNING: the meta field should be the last one.
+;;;; WARNING: don't use anonymous functions for initialization. 
 
 ;; TODO: junk the meta field in favor of something more compact?
-(define all-grob-descriptions
+(define-public all-grob-descriptions
   `(
     (Accidental
      . (
        (molecule-callback . ,Accidental_interface::brew_molecule)
        (font-family . music)
-       (cautionary-style . smaller)
+       (cautionary-style . parentheses)
        (after-line-breaking-callback . ,Accidental_interface::after_line_breaking)             (meta . ((interfaces . (item-interface accidental-interface font-interface))))
        ))
     (AccidentalPlacement
      . (
-       (X-extent-callback . ,Accidental_placement::extent_callback)
+       (X-extent-callback . ,Axis_group_interface::group_extent_callback)
        (left-padding . 0.3)
-       (right-padding . 0.3)
+
+       ;; this is quite small, but it is very ugly to have
+       ;; accs closer to the previous note than to the next one.
+       (right-padding . 0.15)
        (meta . ((interfaces . (item-interface accidental-placement-interface))))
        ))
 
@@ -74,6 +78,7 @@
                        (custos . (minimum-space . 2.0))
                        (clef .   (minimum-space . 1.0))
                        (first-note . (extra-space . 1.3))
+                       (right-edge . (extra-space . 0.0))
                        ))
 
        ;;
        (after-line-breaking-callback . ,Beam::after_line_breaking)
        (neutral-direction . -1)
        (dir-function . ,beam-dir-majority-median)
-       (beamed-stem-shorten . (1.0 0.5))
+       
+       ;; Whe have some unreferenced problems here.
+       ;;
+       ;; If we shorten beamed stems less than normal stems (1 staffspace),
+       ;; or high order less than 8th beams, patterns like
+       ;;     c''4 [c''8 c''] c''4 [c''16 c]
+       ;; are ugly (different stem lengths).
+       ;;
+       ;; But if we shorten 16th beams as much as 8th beams, a single
+       ;; forced 16th beam looks *very* short.
+
+       ;; We choose to shorten 8th beams the same as single stems,
+       ;; and high order beams less than 8th beams, so that all
+       ;; isolated shortened beams look nice and a bit shortened,
+       ;; sadly possibly breaking patterns with high order beams.
+       (beamed-stem-shorten . (1.0 0.5 0.25))
+       
        (outer-stem-length-limit . 0.2)
        (slope-limit . 0.2)
-       (flag-width-function . ,default-beam-flag-width-function)
+       (flag-width-function . ,beam-flag-width-function)
        (damping . 1)
-       (auto-knee-gap . 7)
+       (auto-knee-gap . 5.5)
        (font-name . "cmr10")
        (space-function . ,Beam::space_function)
        (meta . ((interfaces . (staff-symbol-referencer-interface beam-interface spanner-interface))))
                        (key-signature . (minimum-space . 4.0))
                        (time-signature . (minimum-space . 4.2))
                        (first-note . (minimum-space . 5.0))
-                       (next-note . (extra-space . 0.5))                       
+                       (next-note . (extra-space . 0.5))
+                       (right-edge . (extra-space . 0.5))
                        ))
        (Y-offset-callbacks  . (,Staff_symbol_referencer::callback)) 
        (meta . ((interfaces . (clef-interface staff-symbol-referencer-interface font-interface break-aligned-interface item-interface ))))
        ))
 
+    (Cluster
+     . (
+       (molecule-callback . ,Cluster::brew_molecule)
+       (spacing-procedure . ,Spanner::set_spacing_rods)                
+       (minimum-length . 0.0)
+       (padding . 0.25)
+       (shape . leftsided-stairs)
+       (meta . ((interfaces . (cluster-interface spanner-interface))))
+       ))
+
     (ChordName
      . (
        (molecule-callback . ,Chord_name::brew_molecule)
        (font-family . ancient)
        (space-alist . (
                        (first-note . (minimum-space . 0.0))
+                       (right-edge . (extra-space . 0.1))
                        ))
-       (meta . ((interfaces . (custos-interface staff-symbol-referencer-interface break-aligned-interface item-interface ))))
+       (meta . ((interfaces
+                 . (custos-interface staff-symbol-referencer-interface
+                                     font-interface
+                                     break-aligned-interface item-interface ))))
        ))
 
 
        (font-family . dynamic)
        (font-shape . italic)
        (self-alignment-Y . 0)
-       (meta . ((interfaces . (font-interface text-interface self-alignment-interface  dynamic-interface item-interface ))))
+       (meta . ((interfaces . (font-interface text-interface self-alignment-interface  dynamic-interface script-interface item-interface ))))
        ))
 
     (DynamicLineSpanner
     (LeftEdge
      . (
        (break-align-symbol . left-edge)
-       (X-offset-callbacks . (,Break_align_interface::alignment_callback))
        (X-extent-callback . ,Grob::point_dimension_callback)
        (breakable . #t)
        (space-alist . (
+                       (custos . (extra-space . 0.0))
                        (ambitus . (extra-space . 2.0))
                        (time-signature . (extra-space . 0.0)) 
                        (staff-bar . (extra-space . 0.0))
                        (breathing-sign . (minimum-space  . 0.0))
                        (clef . (extra-space . 1.0))
-                       (first-note . (extra-space . 0.0))
+                       (first-note . (extra-space . 1.0))
+                       (right-edge . (extra-space . 0.0))
                        (key-signature . (extra-space . 0.0))
                        ))
        (meta . ((interfaces . (break-aligned-interface item-interface ))))
     (Fingering
      . (
        (molecule-callback . ,Text_item::brew_molecule)
-       (X-offset-callbacks . (,Self_alignment_interface::centered_on_parent
-                              ,Self_alignment_interface::aligned_on_self))
        (padding . 0.6)
        ;;              (direction . -1)
        (self-alignment-X . 0)
        (meta . ((interfaces . (hairpin-interface self-alignment-interface dynamic-interface spanner-interface))))
        ))
 
+    (HorizontalBracket
+     . (
+       (thickness . 1.0)
+       (molecule-callback . ,Horizontal_bracket::brew_molecule)
+       (Y-offset-callbacks . (,Side_position_interface::aligned_side))
+       (padding . 0.2)
+       (direction . -1)
+       (meta . ((interfaces . (horizontal-bracket-interface side-position-interface spanner-interface))))
+       ))
     (InstrumentName
      . (
        (breakable . #t)
        (space-alist . (
                        (time-signature . (extra-space . 1.25))
                        (staff-bar .  (extra-space . 1.1))
+                       (right-edge . (extra-space . 0.5))
                        (first-note . (extra-space . 2.5))
                        ))
        (Y-offset-callbacks . (,Staff_symbol_referencer::callback))
 
     (LigatureBracket
      . (
-       (width . 0.75)
-       (height . 0.5)
        (ligature-primitive-callback . ,Note_head::brew_molecule)
-       (molecule-callback . ,Ligature_bracket::brew_molecule)
-       (meta . ((interfaces . (ligature-bracket-interface spanner-interface))))
+       (direction . 1)
+       (gap . 0.0)
+       (padding . 2.0)
+       (thickness . 1.6)
+       (edge-widen . (0.0 . 0.0))
+       (edge-height . (0.7 . 0.7))
+       (shorten-pair . (-0.2 . -0.2))
+       (before-line-breaking-callback . ,Tuplet_bracket::before_line_breaking)
+       (after-line-breaking-callback . ,Tuplet_bracket::after_line_breaking)
+       (molecule-callback . ,Tuplet_bracket::brew_molecule)
+       (meta .  ((interfaces . (tuplet-bracket-interface spanner-interface))))
        ))
 
     (LigatureHead
        (Y-offset-callbacks  . (,Staff_symbol_referencer::callback))
        (stem-attachment-function . ,note-head-style->attachment-coordinates)
        (font-family . ancient)
-       (style . mensural)
-       (meta . ((interfaces . (ligature-head-interface rhythmic-head-interface note-head-interface staff-symbol-referencer-interface))))
+       (style . default)
+       (glyph-name-procedure . ,find-notehead-symbol)
+       (meta . ((interfaces . (ligature-head-interface rhythmic-head-interface
+                                                       font-interface
+                                                       note-head-interface staff-symbol-referencer-interface))))
        ))
 
     (LyricHyphen
     (LyricText
      . (
        (molecule-callback . ,Text_item::brew_molecule)
-       (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
+       (X-offset-callbacks . (,Self_alignment_interface::centered_on_parent
+                              ,Self_alignment_interface::aligned_on_self))
        (self-alignment-X . 0)
        (word-space . 0.6)
        (ignore-length-mismatch . #f)
        (end-alignment . 2)
        (font-family . roman)
        (font-shape . upright)
+       
        ;; duh, side-position-interface?
        (meta . ((interfaces . (lyric-syllable-interface self-alignment-interface text-interface font-interface item-interface ))))
        ))
        (ligature-primitive-callback . ,Mensural_ligature::brew_ligature_primitive)
        (molecule-callback . ,Mensural_ligature::brew_molecule)
        (font-family . ancient)
-       (meta . ((interfaces . (mensural-ligature-interface))))
+       (meta . ((interfaces . (mensural-ligature-interface font-interface))))
        ))
 
     (Porrectus
        (direction . 1)
        (breakable . #t)
        (font-family . roman)
+       (baseline-skip . 2)
        (break-visibility . ,end-of-line-invisible)
        (padding . 0.8)
        (meta . ((interfaces . (text-interface side-position-interface font-interface mark-interface self-alignment-interface item-interface ))))
        ))
-
+    
+    (MeasureGrouping
+     . (
+       (Y-offset-callbacks . (,Side_position_interface::out_of_staff 
+                              ,Side_position_interface::aligned_side))
+       (molecule-callback . ,Measure_grouping::brew_molecule)
+       (padding . 2)
+       (direction . 1)
+       (thickness . 1)
+       (height . 2.0)
+       (staff-padding . 3)
+       (meta . ((interfaces . (spanner-interface side-position-interface measure-grouping-interface))))
+       ))
     (MultiMeasureRest
      . (
        (spacing-procedure . ,Multi_measure_rest::set_spacing_rods)
        (Y-offset-callbacks . (,Staff_symbol_referencer::callback))
        (staff-position . 0)
        (expand-limit . 10)
-       (number-threshold . 1)
-       (padding . 1)
-       (thickness . 6.6)
-       (font-family . number)
+       (thick-thickness . 6.6)
+       (hair-thickness . 2.0)
        (padding . 1)
        (meta . ((interfaces . (multi-measure-rest-interface rest-interface font-interface staff-symbol-referencer-interface spanner-interface))))
        ))
+    
+    (MultiMeasureRestNumber
+     . (
+       (molecule-callback . ,Text_item::brew_molecule)
+       (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self
+                              ,Self_alignment_interface::centered_on_other_axis_parent))
+       (Y-offset-callbacks . (,Side_position_interface::aligned_side))
+       (self-alignment-X . 0)
+       (direction . 1)
+       (padding . 2)
+       (font-family . number)
+       (meta . ((interfaces . (side-position-interface self-alignment-interface font-interface spanner-interface text-interface))))
+       ))
+
 
     (NoteCollision
      . (
      . (
        (style . default)
        (molecule-callback . ,Note_head::brew_molecule)
+       (glyph-name-procedure . ,find-notehead-symbol)
        (Y-offset-callbacks  . (,Staff_symbol_referencer::callback))
        (stem-attachment-function . ,note-head-style->attachment-coordinates)
        (meta . ((interfaces . (rhythmic-head-interface font-interface note-head-interface staff-symbol-referencer-interface item-interface ))))
      . (
        (type . line)
        (gap . 0.5)
+       (zigzag-width . 0.75)
        (breakable . #t)
        (X-extent-callback . #f)
        (Y-extent-callback . #f)                         
        (Y-offset-callbacks . (,Side_position_interface::aligned_side))
        (molecule-callback . ,Text_item::brew_molecule)
        (font-shape . italic)
+       (padding . 0.4)
+       (font-relative-size . -2)
        (font-family . roman)
        (meta . ((interfaces . (text-interface self-alignment-interface side-position-interface font-interface item-interface ))))
        ))
        (extremity-offset-alist . ,default-phrasing-slur-extremity-offset-alist)
        (de-uglify-parameters . (1.5  0.8  -2.0))
        (Y-extent-callback . ,Slur::height)
-       (details . ((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5)
-                   (bezier-pct-c0 . -0.2) (bezier-pct-c3 . 0.000006)
-                   (bezier-pct-out-max . 0.8) (bezier-pct-in-max . 1.2)
-                   (bezier-area-steps . 1.0)))
+       (height-limit . 2.0)
+       (ratio . 0.333)
        (beautiful . 0.5)
        (y-free . 0.75)
        (attachment . (#f . #f))
        (attachment-offset . ((0 . 0) . (0 . 0)))
        (slope-limit . 0.8)
+       (details . ((force-blowfit . 0.5)
+                   (bezier-pct-c0 . -0.2) (bezier-pct-c3 . 0.000006)
+                   (bezier-pct-out-max . 0.8) (bezier-pct-in-max . 1.2)
+                   (bezier-area-steps . 1.0)))
        (meta . ((interfaces . (slur-interface spanner-interface))))
        ))
 
        (Y-extent-callback . ,Rest::extent_callback)            
        (molecule-callback . ,Rest::brew_molecule)
        (Y-offset-callbacks . (,Staff_symbol_referencer::callback)) 
-       (minimum-beam-collision-distance . 1.5)
+       (minimum-beam-collision-distance . 0.75)
        (meta . (
                 (interfaces . (font-interface
                                rhythmic-head-interface
        (extremity-offset-alist . ,default-slur-extremity-offset-alist)
        (de-uglify-parameters . (1.5  0.8  -2.0))
        (Y-extent-callback . ,Slur::height)
-       (details . ((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5)
-                   (bezier-pct-c0 . -0.2) (bezier-pct-c3 . 0.000006)
-                   (bezier-pct-out-max . 0.8) (bezier-pct-in-max . 1.2)
-                   (bezier-area-steps . 1.0)))
+       (height-limit . 2.0)
+       (ratio . 0.333)
        (beautiful . 0.5)
        (y-free . 0.75)
        (attachment . (#f . #f))
        (attachment-offset . ((0 . 0) . (0 . 0)))
        (slope-limit . 0.8)
+       (details . ((force-blowfit . 0.5)
+                   (bezier-pct-c0 . -0.2) (bezier-pct-c3 . 0.000006)
+                   (bezier-pct-out-max . 0.8) (bezier-pct-in-max . 1.2)
+                   (bezier-area-steps . 1.0)))
        (meta . ((interfaces . (slur-interface spanner-interface))))
        ))
 
        (grace-space-factor . 0.6)
        (shortest-duration-space . 2.0)
        (spacing-increment . 1.2)
-       (base-shortest-duration . ,(make-moment 1 8))
+       (base-shortest-duration . ,(ly:make-moment 1 8))
        (meta . ((interfaces . (spacing-interface spacing-spanner-interface spanner-interface))))
        ))
 
        (thin-kern . 3.0)
        (hair-thickness . 1.6)
        (thick-thickness . 6.0)
-       (meta . ((interfaces . (span-bar-interface bar-line-interface item-interface ))))
+       (meta . ((interfaces . (span-bar-interface font-interface
+                                                  bar-line-interface item-interface ))))
        ))
 
     (StanzaNumber
      . (
        (breakable . #t)
        (stem-spacing-correction . 0.4)
+       (knee-spacing-correction . 0.75)
        (meta . ((interfaces . (spacing-interface staff-spacing-interface item-interface ))))
        ))
     (NoteSpacing
      . (
        (stem-spacing-correction . 0.5)
+       (knee-spacing-correction . 0.75)
        (meta . ((interfaces . (spacing-interface note-spacing-interface item-interface ))))
        ))
 
      . (
        (axes . (1))
        (Y-extent-callback . ,Axis_group_interface::group_extent_callback)      
+       (Y-offset-callbacks . (,Side_position_interface::aligned_side))
+       
 
        (padding . 1.2)
        (minimum-space . 1.0)
        (before-line-breaking-callback . ,Stem::before_line_breaking)
        (molecule-callback . ,Stem::brew_molecule)
        (thickness . 1.3)
-       (beamed-lengths . (0.0 2.5 2.0 1.5))
-
-       ;; 
-       (beamed-minimum-lengths . (0.0 1.5 1.25 1.0))
-
-       ;;  Stems in unnatural (forced) direction should be shortened,
-       ;;  according to [Roush & Gourlay].  Their suggestion to knock off
-       ;;  a whole staffspace seems a bit drastical: we'll do half.
 
+       ;; 3.5 (or 3 measured from note head) is standar length
+       ;; 32nd, 64th flagged stems should be longer
        (lengths . (3.5 3.5 3.5 4.5 5.0))
+       
+       ;; Stems in unnatural (forced) direction should be shortened by
+       ;; one staff space, according to [Roush & Gourlay].
+       ;; Flagged stems we shorten only half a staff space.
        (stem-shorten . (1.0 0.5))
-                                       ; if stem is on middle line, choose this direction.
+
+       ;; default stem direction for note on middle line
        (neutral-direction . -1)
+       
+       ;; [Wanske]: standard length (but no shorter than minimum).
+       ;; (beamed-lengths . (3.5))
+       
+       ;; FIXME.  3.5 yields too long beams (according to Ross and
+       ;; looking at Baerenreiter examples) for a number of common
+       ;; boundary cases.  Subtracting half a beam thickness fixes
+       ;; this, but the bug may well be somewhere else.
+       (beamed-lengths . (3.26))
+
+       ;; [Wanske] lists three sets of minimum lengths.  One
+       ;; set for the nomal case, and one set for beams with `der
+       ;; Balkenendpunkt weiter "uber bzw. unter die Systemgrenze
+       ;; hinaus (bei Gruppen mit grossem Tonumfang)' and the extreme
+       ;; case.
+
+       ;; Note that Wanske lists numbers lengths starting from top of
+       ;; head, so we must add half a staff space.
+       
+       ;; We use the normal minima as minimum for the ideal lengths,
+       ;; and the extreme minima as abolute minimum length.
+       
+       ;; The 'normal' minima
+       (beamed-minimum-free-lengths . (2.5 2.0 1.5))
+       
+       ;; The 'far outside staff' minima, not used
+       ;(beamed-far-minimum-free-lengths . (1.83))
+       
+       ;; The 'extreme case' minima
+       (beamed-extreme-minimum-free-lengths . (1.83 1.5))
+
        (X-offset-callbacks . (,Stem::off_callback))
        (X-extent-callback . ,Stem::dim_callback)       
        (Y-extent-callback . ,Stem::height)
        (Y-extent-callback . ,Stem_tremolo::height)
        (X-extent-callback . #f)
 
-       (beam-width . 2.0) ; staff-space
+       (beam-width . 1.6) ; staff-space
        (beam-thickness . 0.48) ; staff-space
        (meta . ((interfaces . (stem-tremolo-interface item-interface ))))
        ))
     (SustainPedalLineSpanner 
      . (
        (axes . (1))
-       (Y-extent-callback . ,Axis_group_interface::group_extent_callback)      
+       (Y-extent-callback . ,Axis_group_interface::group_extent_callback)
+       (Y-offset-callbacks . (,Side_position_interface::aligned_side))
        
        (padding . 1.2)
        (minimum-space . 1.0)
      . (
        (molecule-callback . ,Text_item::brew_molecule)
        (no-spacing-rods . #t)
+       (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
        (direction . -1)
        (padding . 0.5)
        (script-priority . 200)
        (style . default)
        (molecule-callback . ,tablature-molecule-callback)
        (Y-offset-callbacks  . (,Staff_symbol_referencer::callback))
+       (extra-offset . (0 . -0.65)) ;; UGH! TODO: Clean this up!
        (stem-attachment-function . ,tablature-stem-attachment-function)
-       (meta . ((interfaces . (rhythmic-head-interface font-interface note-head-interface staff-symbol-referencer-interface item-interface ))))
+       (meta . ((interfaces
+                 . (rhythmic-head-interface
+                    font-interface
+                    note-head-interface staff-symbol-referencer-interface
+                    text-interface item-interface ))))
        ))
 
 
        (break-visibility . ,all-visible)
        (space-alist . (
                        (first-note . (extra-space . 2.0))
+                       (right-edge . (extra-space . 0.5))
                        (staff-bar .  (minimum-space . 2.0))
                        ))
        (breakable . #t)
      . (
        (axes . (1))
        (Y-extent-callback . ,Axis_group_interface::group_extent_callback)      
+       (Y-offset-callbacks . (,Side_position_interface::aligned_side))
+       
        (padding . 1.2)
        (minimum-space . 1.0)
        (direction . -1)
 (define (completize-grob-entry x)
   "transplant assoc key into 'name entry of 'meta of X
 "
-
   (let* ((name-sym  (car x))
         (grob-entry (cdr x))
         (metaentry (cdr (assoc 'meta grob-entry)))
 (map (lambda (x)
                                        ; (display (car x)) (newline)
 
-       (set-object-property! (car x) 'translation-type? list?))
+       (set-object-property! (car x) 'translation-type? list?)
+       (set-object-property! (car x) 'is-grob? #t))
      all-grob-descriptions)