;;;;
;;;; source file of the GNU LilyPond music typesetter
;;;;
-;;;; (c) 1998--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+;;;; (c) 1998--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
;;;; Jan Nieuwenhuizen <janneke@gnu.org>
;;; and `objects'.
+;;; TODO: this should be done through C++ macros, in order to have
+;;; tighter coupling between the C++ and its doco.
+
+(define all-interfaces '())
+
(define (lily-interface symbol description props)
- (list symbol
- description
- props
+ (set! all-interfaces (acons symbol (list symbol
+ description
+ props) all-interfaces)
)
)
-
-(define (grob-description name . interfaces)
- (let* ((ifs (cons general-grob-interface interfaces))
+(define (grob-description . interfaces)
+ (let* ((ifs (cons grob-interface interfaces))
(props (map caddr ifs))
-; (prop-typep-pairs (map (lambda (x) (cons (car x) (cadr x)))
-; (apply append props)))
+ ; (prop-typep-pairs (map (lambda (x) (cons (car x) (cadr x)))
+ ; (apply append props)))
(syms (map car ifs))
- )
+ )
(list (cons 'separator "\n\n\n") ;easy printing.
- (cons 'name name)
(cons 'interfaces syms)
(cons 'interface-descriptions ifs)
- ; (cons 'interface-descriptions (cadr merged))
+ ; (cons 'interface-descriptions (cadr merged))
;; description of the grob itself?
-; (cons 'properties prop-typep-pairs)
- )))
+ ; (cons 'properties prop-typep-pairs)
+ )))
+
+
+(lily-interface
+ 'grob-interface
+ "All grobs support this"
+ '(
+ X-offset-callbacks
+ Y-offset-callbacks
+ X-extent-callback
+ Y-extent-callback
+ molecule-callback
+ font-relative-size
+ extra-offset
+ interfaces
+ dependencies
+ no-spacing-rods
+ extra-extent-X
+ extra-extent-Y
+ minimum-extent-X
+ minimum-extent-Y
+ origin
+ transparent
+ ))
-(define general-grob-interface
- (lily-interface
- 'general-grob-interface
- "All grobs support this"
- '(
- X-offset-callbacks
- Y-offset-callbacks
- X-extent-callback
- Y-extent-callback
- font-relative-size
- extra-offset
- interfaces
- dependencies
- no-spacing-rods
- extra-extent-X
- extra-extent-Y
- minimum-extent-X
- minimum-extent-Y
- origin
- transparent
- ))
- )
-(define beam-interface
- (lily-interface
- 'beam-interface
- "A beam.
+(lily-interface
+ 'beam-interface
+ "A beam.
#'thickness= weight of beams, in staffspace
"
- '(
- y-position
- height
- flag-width-function
- damping
- default-neutral-direction
- thickness
- space-function
- beamed-stem-shorten
- height-quants
- vertical-position-quant-function
- damping
- outer-stem-length-limit
- slope-limit
- )
+ '(auto-knee-gap
+ beamed-stem-shorten
+ damping
+ flag-width-function
+ neutral-direction
+ outer-stem-length-limit
+ positions
+ slope-limit
+ thickness
+ )
+ )
+
+(lily-interface
+ 'staff-spacing-interface
+ ""
+ '(
))
-(define clef-interface
- (lily-interface
- 'clef-interface
- "A clef sign"
- '(
- non-default
- full-size-change
- glyph
- ))
- )
+(lily-interface
+ 'note-spacing-interface
+ ""
+ '(
+ ))
-(define axis-group-interface
- (lily-interface
- 'axis-group-interface
- "a group of coupled grobs"
- '(
- axes
- )))
+(lily-interface
+ 'clef-interface
+ "A clef sign"
+ '(
+ non-default
+ full-size-change
+ glyph
+ ))
-(define note-column-interface
- (lily-interface
- 'note-column-interface
- "Stem and noteheads combined"
- '(
- horizontal-shift
- force-hshift
- ))
- )
-(define stem-interface
- (lily-interface
- 'stem-interface
- "A stem"
- '(
- thickness
- beamed-lengths
- beamed-minimum-lengths
- stem-centered
- lengths
- beam
- stem-shorten
- duration-log
- beaming
- default-neutral-direction
- stem-end-position
- support-head
- heads
- direction
- stem-length
- style
- flag-style
- dir-forced
- )))
+(lily-interface
+ 'axis-group-interface
+ "a group of coupled grobs"
+ '(
+ axes
+ ))
-(define slur-interface
- (lily-interface
- 'slur-interface
- "A slur"
- '(
- de-uglify-parameters
- details
- attachment
- direction
+
+(lily-interface
+ 'note-column-interface
+ "Stem and noteheads combined"
+ '(
+ note-heads
+ horizontal-shift
+ force-hshift
+ ))
+
+
+(lily-interface
+ 'stem-interface
+ "A stem"
+ '(
+ thickness
+ beamed-lengths
+ beamed-minimum-lengths
+ lengths
+ beam
+ stem-shorten
+ duration-log
+ beaming
+ neutral-direction
+ stem-end-position
+ support-head
+ heads
+ direction
+ length
+ style
+ flag-style
+ dir-forced
+ ))
+
+
+
+(lily-interface
+ 'slur-interface
+ "A slur"
+ '(
+ de-uglify-parameters
+ details
+ attachment
+ direction
attachment-offset
- beautiful
- y-free
- control-points
- extremity-rules
- extremity-offset-alist
- thickness
- dashed
+ beautiful
+ y-free
+ control-points
+ extremity-rules
+ extremity-offset-alist
+ thickness
+ dashed
- )
)
- )
+ )
-(define side-position-interface
- (lily-interface
- 'side-position-interface
- "Position a victim object (this one) next to other objects (the support).
+
+
+(lily-interface
+ 'side-position-interface
+ "Position a victim object (this one) next to other objects (the support).
#'direction = where to put the victim object (left or right?)
"
- '(
- side-support
+ '(
+ side-support-elements
direction-source
- direction
- side-relative-direction
- minimum-space
- padding
- self-alignment-X
- self-alignment-Y
-
- )
- ))
+ direction
+ side-relative-direction
+ minimum-space
+ padding
+ self-alignment-X
+ self-alignment-Y
+
+ )
+ )
-(define accidentals-interface
- (lily-interface
- 'accidentals-interface
- "Accidentals"
- '(
- left-padding
- right-padding
- )
+
+(lily-interface
+ 'accidentals-interface
+ "Accidentals"
+ '(accidentals
+ left-padding
+ right-padding
+ paren-cautionaries
+ cautionary-size
))
-(define line-of-score-interface
- (lily-interface
- 'line-of-score-interface
- "Super grob, parent of all:
+
+
+(lily-interface
+ 'line-of-score-interface
+ "Super grob, parent of all:
The columns of a score that form one line. The toplevel grob. Any
grob has a Line_of_score as both X and Y reference point. The
Paper_score contains one grob of this type. Control enters the
Grob dependency calculation from this single Line_of_score
object."
- '(
- between-system-string
- spacing-procedure
- before-line-breaking-callback
- after-line-breaking-callback
- all-elements
- columns
- )))
-
-(define note-head-interface
- (lily-interface
- 'note-head-interface
- "Note head"
- '(
- style
- )
+ '(
+ between-system-string
+ spacing-procedure
+ before-line-breaking-callback
+ after-line-breaking-callback
+ all-elements
+ columns
))
-(define note-name-interface
- (lily-interface
- 'note-name-interface
- "Note name"
- '(
- style
- )
+
+(lily-interface
+ 'note-head-interface
+ "Note head"
+ '( style stem-attachment-function ))
+
+
+(lily-interface
+ 'note-name-interface
+ "Note name"
+ '( style ))
+
+
+
+(lily-interface
+ 'rhythmic-head-interface
+ "Note head or rest"
+ '(
+ dot
+ stem
+ duration-log
))
-(define rhythmic-head-interface
- (lily-interface
- 'rhythmic-head-interface
- "Note head or rest"
- '(
- dot
- stem
- duration-log
- )))
+(lily-interface
+ 'rest-interface
+ "a rest"
+ '(style ))
-(define rest-interface
- (lily-interface
- 'rest-interface
- "a rest"
- '(style )))
-(define tuplet-bracket-interface
- (lily-interface
- 'tuplet-bracket-interface
- "A bracket with a number in the middle, used for tuplets."
- '(
- beams
- columns
- number-gap
- delta-y
- tuplet-bracket-visibility
- tuplet-number-visibility
- parallel-beam
- thick
- )
-))
+(lily-interface
+ 'tuplet-bracket-interface
+ "A bracket with a number in the middle, used for tuplets."
+ '(
+ columns
+ number-gap
+ delta-y
+ tuplet-bracket-visibility
+ tuplet-number-visibility
+ thick
+ direction
+ ))
-(define align-interface
- (lily-interface
- 'align-interface
- " Order grobs top to bottom/left to right/right to left etc."
- '(
- stacking-dir
- align-dir
- threshold
- alignment-done
- center-element
- elements
- axes
- )))
-
-(define aligned-interface
- (lily-interface
- 'aligned-interface
- "read by align-interface"
- '(
- minimum-space
- extra-space
- )))
-(define break-aligned-interface
- (lily-interface
- 'break-aligned-interface
- "Items that are aligned in prefatory matter"
- '(
- break-align-symbol
- visibility-lambda
- breakable
- )))
+(lily-interface
+ 'align-interface
+ " Order grobs top to bottom/left to right/right to left etc."
+ '(
+ stacking-dir
+ align-dir
+ threshold
+ alignment-done
+ center-element
+ elements
+ axes
+ ))
-(define chord-name-interface
- (lily-interface
- 'chord-name-interface
- "generate a chord name"
- '( pitches inversion bass)))
-(define time-signature-interface
- (lily-interface
- 'time-signature-interface
- "A time signature, in different styles.
+(lily-interface
+ 'aligned-interface
+ "read by align-interface"
+ '(
+ minimum-space
+ extra-space
+ ))
+
+
+(lily-interface
+ 'break-aligned-interface
+ "Items that are aligned in prefatory matter"
+ '(
+ break-align-symbol
+ space-alist
+ visibility-lambda
+ breakable
+ ))
+
+
+(lily-interface
+ 'chord-name-interface
+ "generate a chord name"
+ '( pitches inversion bass))
+
+
+(lily-interface
+ 'time-signature-interface
+ "A time signature, in different styles.
The following values for 'style are are recognized:
@table @samp
See also the test-file @file{input/test/time.ly}.
"
- '(fraction style )))
+ '(fraction style ))
-(define bar-line-interface
- (lily-interface
- 'bar-line-interface
- "Bar line.
+
+(lily-interface
+ 'bar-line-interface
+ "Bar line.
This is a request to print a special bar symbol. It replaces the
regular bar symbol with a special
but a line break is allowed at that spot.
"
- '( barsize-procedure kern thin-kern hair-thickness thick-thickness glyph bar-size break-glyph-function )))
+ '(bar-size-procedure kern thin-kern hair-thickness thick-thickness glyph bar-size break-glyph-function ))
-(define hairpin-interface
- (lily-interface
- 'hairpin-interface
- "hairpin crescendo.
+
+(lily-interface
+ 'hairpin-interface
+ "hairpin crescendo.
padding -- horizontal padding. This is useful if a crescendo is set next to a text like `mf'
"
- '( grow-direction thickness height padding )
- ))
+ '( grow-direction thickness height padding
+ ))
-(define arpeggio-interface
- (lily-interface
- 'arpeggio-interface
- "Functions and settings for drawing an arpeggio symbol (a wavy line left to noteheads."
- '(stems)
- )
- )
-(define note-collision-interface
- (lily-interface
- 'note-collision-interface
- "An object that handles collisions between notes with different
+(lily-interface
+ 'arpeggio-interface
+ "Functions and settings for drawing an arpeggio symbol (a wavy line left to noteheads."
+ '(stems arpeggio-direction))
+
+
+
+(lily-interface
+ 'note-collision-interface
+ "An object that handles collisions between notes with different
stem directions and horizontal shifts. Most of the interesting
properties are to be set in @ref{note-column-interface}"
- '(merge-differently-dotted note-width)
- ))
+ '(merge-differently-dotted note-width))
-(define custos-interface
- (lily-interface
- 'custos-interface
- "A custos is a staff context symbol that appears at the end of a
+
+(lily-interface
+ 'custos-interface
+ "A custos is a staff context symbol that appears at the end of a
staff line with monophonic musical contents (i.e. with a single
voice). It anticipates the pitch of the first note of the following
line and thus helps the player or singer to manage line breaks
[TODO: add to glossary]"
- '(style)
-)
- )
+ '(style))
+
+
-(define dot-interface
(lily-interface
'dots-interface
"The dots to go with a notehead/rest. A separate interface, since they
- are a party in collision resolution.
- #'direction is the Direction to handle staff-line collisions in."
- '(direction dot-count)
+are a party in collision resolution.
+#'direction is the Direction to handle staff-line collisions in."
+ '(direction dot-count))
- ))
-(define font-interface
(lily-interface
'font-interface
"Any symbol that is typeset through fixed sets of glyphs (ie. fonts)"
'(font-style font-series font-shape font-family font-name
-font-point-size font-relative-size)
- ))
+font-design-size font-relative-size)
+ )
+
-(define text-interface
(lily-interface
'text-interface
"A scheme markup text"
- '(text align lookup raise kern magnify)))
+ '(text align baseline-skip lookup raise kern magnify))
+
-(define dot-column-interface
(lily-interface
'dot-column-interface
"Interface that groups dots so they form a column"
'( )
- ))
+ )
+
-(define dynamic-interface
(lily-interface
'dynamic-interface
"Any kind of loudness sign"
'()
- ))
+ )
+
-(define finger-interface
(lily-interface
'finger-interface
"A fingering instruction"
'()
- ))
+ )
+
-(define separation-spanner-interface
(lily-interface
'separation-spanner-interface
"Spanner that containing @code{separation-item-interface} grobs to calculate rods"
'()
- ))
-(define text-script-interface
+ )
+
(lily-interface
'text-script-interface
"Any text script"
'()
- ))
+ )
+
-(define grace-alignment-interface
(lily-interface
'grace-alignment-interface
"put grace notes in line"
'(
horizontal-space
)
- ))
+ )
+
-(define hara-kiri-group-interface
(lily-interface
'hara-kiri-group-interface
" As Vertical_group_spanner, but keep track of interesting items. If
- we don't contain any interesting items after linebreaking, then
- gracefully commit suicide. Objective: don't disgrace Lily by
- typesetting empty lines in orchestral scores."
+we don't contain any interesting items after linebreaking, then
+gracefully commit suicide. Objective: don't disgrace Lily by
+typesetting empty lines in orchestral scores."
'( items-worth-living )
-))
+)
+
-(define line-spanner-interface
(lily-interface
'line-spanner-interface
"Generic line drawn between two objects, eg. for use with glissandi.
gap is measured in staff-spaces. "
- '(gap dash-period dash-length line-thickness type )
+ '(gap dash-period dash-length line-thickness type
))
-(define lyric-hyphen-interface
+
(lily-interface
'lyric-hyphen-interface
"A centred hyphen is a simple line between lyrics used to divide
syllables. The length of the hyphen line should stretch based on the
- size of the gap between syllables."
+size of the gap between syllables."
- '( thickness height minimum-length word-space )
+ '( thickness height minimum-length word-space
))
-(define key-signature-interface
+
(lily-interface
'key-signature-interface
"A group of accidentals."
c0-position
old-accidentals
new-accidentals
- )))
+ ))
+
-(define lyric-extender-interface
(lily-interface
'lyric-extender-interface
"The extender is a simple line at the baseline of the lyric
- that helps show the length of a melissima (tied/slurred note)."
+that helps show the length of a melissima (tied/slurred note)."
'(
word-space
height
right-trim-amount
- )))
+ ))
+
-(define lyric-syllable-interface
(lily-interface
'lyric-syllable-interface
"a single piece of lyrics"
'(
- word-space
- )))
+ word-space
+ alignment
+ ignore-length-mismatch
+ begin-alignment
+ end-alignment
+ ))
+
-(define mark-interface
(lily-interface
'mark-interface
"a rehearsal mark"
'(
- )))
+ ))
+
-(define multi-measure-rest-interface
(lily-interface
'multi-measure-rest-interface
"A rest that spans a whole number of measures. For typesetting the
numbers, fields from font-interface may be used.
padding is the space between number and rest. Measured in staffspace.
-
+
"
- '( columns expand-limit minimum-width padding )
+ '( columns expand-limit minimum-width padding))
- ))
-(define paper-column-interface
(lily-interface
'paper-column-interface
""
dir-list shortest-playing-duration shortest-starter-duration
contains-grace extra-space stretch-distance ))
- )
-(define spaceable-element-interface
+ (lily-interface
+ 'piano-pedal-interface
+ ""
+ '(pedal-type
+ edge-width
+ edge-height
+ shorten-pair
+ left-widen
+ right-widen
+ ))
+
+
+ (lily-interface
+ 'porrectus-interface
+ "A porrectus ligature, joining two note heads into a single grob."
+ '(
+ ))
+
+
(lily-interface
'spaceable-element-interface
"An grob (generally a Paper_column) that takes part in the
spacing problem. "
- '(
+ '(penalty
minimum-distances
ideal-distances
dir-list
- )))
+ ))
+
-(define rest-collision-interface
(lily-interface
'rest-collision-interface
"Move around ordinary rests (not multi-measure-rests) to avoid
maximum-rest-count
minimum-distance
elements
- )))
+ ))
+
-(define script-interface
(lily-interface
'script-interface
""
'(
script-priority
- )))
+ ))
+
-(define script-column-interface
(lily-interface
'script-column-interface
"An interface that sorts scripts according to their @code{script-priority}"
- '( )))
+ '( ))
+
-(define spacing-spanner-interface
(lily-interface
'spacing-spanner-interface
" SPACE = arithmetic_multiplier * ( C + log2 (TIME) ))
The space taken by a note is determined by the formula
-
+
where TIME is the amount of time a note occupies. The value of C is
chosen such that the smallest space within a measure is
arithmetic_basicspace:
- C = arithmetic_basicspace - log2 (mininum (SHORTEST, 1/8))
+C = arithmetic_basicspace - log2 (mininum (SHORTEST, 1/8))
The smallest space is the one following the shortest note in the
measure, or the space following a hypothetical 1/8 note. Typically
space):
@example
- 2*quartwidth = arithmetic_multiplier * ( C + log2 (SHORTEST) ))
+2*quartwidth = arithmetic_multiplier * ( C + log2 (SHORTEST) ))
- @{ using: C = arithmetic_basicspace - log2 (mininum (SHORTEST, 1/8)) @}
- @{ assuming: SHORTEST <= 1/8 @}
+@{ using: C = arithmetic_basicspace - log2 (mininum (SHORTEST, 1/8)) @}
+@{ assuming: SHORTEST <= 1/8 @}
- = arithmetic_multiplier *
- ( arithmetic_basicspace - log2 (SHORTEST) + log2 (SHORTEST) )
+= arithmetic_multiplier *
+( arithmetic_basicspace - log2 (SHORTEST) + log2 (SHORTEST) )
- = arithmetic_multiplier * arithmetic_basicspace
+= arithmetic_multiplier * arithmetic_basicspace
- @{ choose: arithmetic_multiplier = 1.0*quartwidth (why?) @}
+@{ choose: arithmetic_multiplier = 1.0*quartwidth (why?) @}
- = quartwidth * arithmetic_basicspace
+= quartwidth * arithmetic_basicspace
- =>
+=>
- arithmetic_basicspace = 2/1 = 2
+arithmetic_basicspace = 2/1 = 2
If you want to space your music wider, use something like:
- arithmetic_basicspace = 4.;
+arithmetic_basicspace = 4.;
@end example"
'(
- maximum-duration-for-spacing
- arithmetic-basicspace
- arithmetic-multiplier
+spacing-increment
+shortest-duration-space
- )))
+ ))
+
+
+ (lily-interface
+ 'staff-symbol-referencer-interface
+
+ "Object whose Y position is meaning with reference to a staff
+symbol. Objects that have this interface should include
+Staff_symbol_referencer::callback in their Y-offset-callback.
+"
+ '(
+ staff-symbol
+ staff-position
+ ))
+
-(define staff-symbol-interface
(lily-interface
'staff-symbol-interface
"This spanner draws the lines of a staff. The middle line is
position 0."
'(
staff-space
- line-count
- )))
+ line-count
+ invisible-staff
+ ))
+
-(define stem-tremolo-interface
(lily-interface
'stem-tremolo-interface
""
- '( stem beam-width beam-thickness beam-space-function
- )))
+ '( stem beam-width beam-thickness
+ ))
+
-(define separation-item-interface
(lily-interface
'separation-item-interface
"Item that computes widths to generate spacing rods.
Calc dimensions for the Separating_group_spanner; this has to be
- an item to get dependencies correct. It can't be an grob_group
- since these usually are in a different X_group
+an item to get dependencies correct. It can't be an grob_group
+since these usually are in a different X_group
"
'(
elements
- )))
+ ))
+
-(define sustain-pedal-interface
- (lily-interface
- 'sustain-pedal-interface
- ""
- '(
- )))
-(define system-start-delimiter-interface
(lily-interface
'system-start-delimiter-interface
"#'style can be bar-line, bracket or brace"
'(bar-line-collapse-height brace-collapse-height bracket-collapse-height
thickness arch-height arch-angle arch-thick
- arch-width bracket-thick glyph )))
+ arch-width bracket-thick glyph ))
+
-(define text-spanner-interface
(lily-interface
'text-spanner-interface
"generic text spanner"
dash-length
line-thickness
edge-height
+ edge-width
edge-text
+ shorten-pair
type
- )
))
-(define tie-interface
+
(lily-interface
'tie-interface
"A tie connecting two noteheads.
x-gap
direction
minimum-length
- )))
+ ))
+
-(define tie-column-interface
(lily-interface
'tie-column-interface
"that sets tie directions in a tied chord"
- '(direction)
+ '(direction
))
-(define volta-bracket-interface
- (lily-interface
- 'volta-bracket-interface
- "Volta bracket with number"
- '(
- bars
- thickness
- height
- )))
+(lily-interface
+ 'percent-repeat-interface
+ "Repeats that look like percent signs"
+ '(slope thickness))
+
+(lily-interface
+ 'volta-bracket-interface
+ "Volta bracket with number"
+ '(
+ bars
+ thickness
+ height
+ ))
+
+
+(lily-interface
+ 'span-bar-interface
+ "A bar line that spans other barlines (typically used to get cross-staff barlines."
+ '(
+ ))
+
+
+(primitive-eval (cons
+ 'begin
+ (map (lambda (x) (list 'define (car x) (list 'quote (cdr x))))
+ all-interfaces)))
-(define span-bar-interface
- (lily-interface
- 'span-bar-interface
- "A bar line that spans other barlines (typically used to get cross-staff barlines."
- '(
- )))
-;(define urg-miss-last-interface )
+(define (interface-names) (map (lambda (x) (symbol->string (car x))) all-interfaces))