]> git.donarmstrong.com Git - lilypond.git/blobdiff - ly/engraver-init.ly
* scm/output-lib.scm (shift-right-at-line-begin): new function:
[lilypond.git] / ly / engraver-init.ly
index bf823045334cc45d901703f88902421042a58774..2ee75e707813f879c352db07dbbeaec68b80c5bb 100644 (file)
@@ -1,12 +1,11 @@
-\version "1.7.18"
-
+\version "1.9.8"
 
 
 %
 % setup for Request->Element conversion. Guru-only
 %
 
-StaffContext=\translator {
+\translator {
        \type "Engraver_group_engraver"
        \name Staff
 
@@ -17,7 +16,7 @@ StaffContext=\translator {
        \consists "Output_property_engraver"    
        
        \consists "Bar_engraver"
- % Bar_engraver must be first so default bars aren't overwritten
+% Bar_engraver must be first so default bars aren't overwritten
 % with empty ones.
        \consists "Font_size_engraver"
 
@@ -41,6 +40,7 @@ StaffContext=\translator {
        \consists "Instrument_name_engraver"
        \consists "Grob_pq_engraver"
        \consists "Forbid_line_break_engraver"
+       \consists "String_number_engraver"
        \consistsend "Axis_group_engraver"
 
        minimumVerticalExtent = #'(-6 . 6)
@@ -59,7 +59,7 @@ StaffContext=\translator {
 }
 
 
-StaffContainerContext = \translator {
+\translator {
        \type Engraver_group_engraver
        \consists "Axis_group_engraver"
        minimumVerticalExtent = ##f
@@ -71,7 +71,7 @@ StaffContainerContext = \translator {
        \name StaffContainer
 }
 
-InnerChoirStaffContext = \translator {
+\translator {
        \type "Engraver_group_engraver"
        \name InnerChoirStaff
        \consists "System_start_delimiter_engraver"
@@ -86,7 +86,7 @@ InnerChoirStaffContext = \translator {
        \accepts "ChordNames"
 }
 
-ChoirStaffContext = \translator {
+\translator {
        \InnerChoirStaffContext
        \name ChoirStaff
        
@@ -98,7 +98,7 @@ ChoirStaffContext = \translator {
 }
 
 
-RhythmicStaffContext=\translator{
+\translator{
        \type "Engraver_group_engraver"
        
        \consists "Output_property_engraver"    
@@ -136,9 +136,10 @@ RhythmicStaffContext=\translator{
 }
 
 
-VoiceContext = \translator {
+\translator {
        \type "Engraver_group_engraver"
        \name Voice
+
 \description "
     Corresponds to a voice on a staff.  This context handles the
     conversion of dynamic signs, stems, beams, super- and subscripts,
@@ -185,10 +186,9 @@ VoiceContext = \translator {
        \consists "Script_column_engraver"
        \consists "Rhythmic_column_engraver"
        \consists "Phrasing_slur_engraver"
-       \consists "Cluster_engraver"
+       \consists "Cluster_spanner_engraver"
        \consists "Slur_engraver"
        \consists "Tie_engraver"
-       \consists "New_tie_engraver"
        \consists "Tuplet_engraver"
        \consists "A2_engraver"
 
@@ -196,7 +196,7 @@ VoiceContext = \translator {
        \accepts Thread % bug if you leave out this!
 }
 
-ThreadContext = \translator{
+\translator{
        \type Engraver_group_engraver
        \name Thread
        localKeySignature = #'()
@@ -212,12 +212,10 @@ ThreadContext = \translator{
 
        % why here ? 
        \consists "Output_property_engraver"    
-
 }
 
 
-
-GrandStaffContext=\translator{
+\translator{
        \type "Engraver_group_engraver"
        \name GrandStaff
        localKeySignature = #'()
@@ -234,7 +232,7 @@ GrandStaffContext=\translator{
        \accepts "Staff"
 }
 
-PianoStaffContext = \translator{
+\translator{
        \GrandStaffContext
        \name "PianoStaff"
        \alias "GrandStaff"
@@ -255,7 +253,7 @@ PianoStaffContext = \translator{
 %      \consistsend "Axis_group_engraver"
 }
 
-InnerStaffGroupContext= \translator {
+\translator {
        \type "Engraver_group_engraver"
        \name InnerStaffGroup
        localKeySignature = #'()
@@ -275,7 +273,7 @@ InnerStaffGroupContext= \translator {
        \accepts "ChordNames"
 }
 
-StaffGroupContext = \translator {
+\translator {
        \InnerStaffGroupContext
        \name StaffGroup
        
@@ -294,10 +292,10 @@ StaffGroupContext = \translator {
 
 
 % UGH! JUNKME
-LyricsVoiceContext= \translator{
+\translator{
        \type "Engraver_group_engraver"
        \consistsend "Hara_kiri_engraver"
-       minimumVerticalExtent = #'(-1.2 . 1.2)
+       minimumVerticalExtent = #'(-1.2 . 2.4)
        extraVerticalExtent = ##f
        verticalExtent = ##f
 
@@ -312,11 +310,11 @@ LyricsVoiceContext= \translator{
        \consists "Extender_engraver"
        \consists "Hyphen_engraver"
        \consists "Stanza_number_engraver"
+       \consists "Instrument_name_engraver"
        \consists "Skip_event_swallow_translator"
-       phrasingPunctuation = #".,:!?\""
-       
+       SeparationItem \set #'padding = #0.5
 }
-NoteNamesContext = \translator {
+\translator {
        \type "Engraver_group_engraver"
        \name NoteNames
        \consistsend "Axis_group_engraver"
@@ -326,18 +324,22 @@ NoteNamesContext = \translator {
        verticalExtent = ##f 
 
        
+       \consists "Rest_swallow_translator" 
+       \consists "Skip_event_swallow_translator"
+       \consists "Tie_engraver"
+       \consists "Note_swallow_translator"
        \consists "Note_name_engraver"
        \consists "Separating_line_group_engraver"
 }
 
-LyricsContext = \translator {
+\translator {
        \type "Engraver_group_engraver"
        \name Lyrics
        \description  "Typesets lyrics."
+       
        %% To get folded repeats right.
        \consists Vertical_align_engraver 
 
-       \consistsend "Hara_kiri_engraver"
        minimumVerticalExtent = ##f
        extraVerticalExtent = ##f
        verticalExtent = ##f 
@@ -346,10 +348,10 @@ LyricsContext = \translator {
 }
 
 
-ChordNamesContext = \translator {
+\translator {
        \type "Engraver_group_engraver"
        \name ChordNames
-\description "    Typesets chord names."
+       \description "Typesets chord names."
        
        \consists "Rest_swallow_translator" 
        \consists "Output_property_engraver"    
@@ -357,26 +359,33 @@ ChordNamesContext = \translator {
        \consists "Chord_name_engraver"
        \consists "Skip_event_swallow_translator"
        \consistsend "Hara_kiri_engraver"
+       
        minimumVerticalExtent = #'(0 . 2.5)
        extraVerticalExtent = ##f
+       SeparatingGroupSpanner \override #'padding = #0.8
        verticalExtent = ##f 
 }
 
 
-RemoveEmptyStaffContext = \translator {
+RemoveEmptyStaffContext= \translator {
        \StaffContext
        \remove "Axis_group_engraver"
        \consistsend "Hara_kiri_engraver"
-       \consists "Instrument_name_engraver"
        \accepts "Voice"
 
        % hara kiri & auto knee don't work together.
        Beam \override #'auto-knee-gap = #'()
 }
 
-HaraKiriStaffContext = \translator { \RemoveEmptyStaffContext }
+AncientRemoveEmptyStaffContext = \translator {
+    %% why not add by default?
+    
+       \RemoveEmptyStaffContext
+       \accepts "VaticanaVoice"
+       \accepts "GregorianTranscriptionVoice"
+}
 
-ScoreContext = \translator {
+\translator {
        \type Score_engraver
        \name Score
        localKeySignature = #'()
@@ -414,16 +423,18 @@ ScoreContext = \translator {
 
        \accepts "Staff"
        \accepts "TabStaff"
+       \accepts "VaticanaStaff"
+       \accepts "GregorianTranscriptionStaff"
        \accepts "StaffContainer"
        \accepts "StaffGroup"
-       \accepts "RhythmicStaff"        
+       \accepts "RhythmicStaff"
        \accepts "Lyrics"
        \accepts "ChordNames"
        \accepts "GrandStaff"
        \accepts "ChoirStaff"
        \accepts "PianoStaff"
        \accepts "NoteNames"
-       \accepts "FiguredBass"  
+       \accepts "FiguredBass"
 
        soloText = #"Solo"
        soloIIText = #"Solo II"
@@ -433,17 +444,16 @@ ScoreContext = \translator {
        changeMoment = #`(,(ly:make-moment 0 0) . ,(ly:make-moment 1 512))
        systemStartDelimiter =#'SystemStartBar
 
-
+       melismaBusyProperties = #default-melisma-properties
+       
        clefGlyph = #"clefs-G"
        clefPosition = #-2
        centralCPosition = #-6
        
-        automaticPhrasing = ##t
-       automaticMelismata = ##t
-       
        defaultBarType = #"|"
        barNumberVisibility = #default-bar-number-visibility
-
+       automaticBars = ##t
+       
        explicitClefVisibility = #all-visible
        explicitKeySignatureVisibility = #all-visible
        autoBeamSettings = #default-auto-beam-settings
@@ -453,42 +463,47 @@ ScoreContext = \translator {
        verticalAlignmentChildCallback = #Align_interface::alignment_callback
 
        pedalSustainStrings = #'("Ped." "*Ped." "*")
+       pedalSustainStyle = #'text
        pedalUnaCordaStrings = #'("una corda" "" "tre corde")
+       pedalUnaCordaStyle = #'text
 
        %% These are in ordinary italic font, including the *,
        %% but they are unlikely to be used, 
        %% as the default pedal-style for SostenutoPedal is 'mixed':
        %% i.e.  Sost. Ped_____________________ 
        pedalSostenutoStrings = #'("Sost. Ped." "*Sost. Ped." "*") 
+       pedalSostenutoStyle = #'mixed
 
+       fingeringOrientations = #'(up down)
        tupletNumberFormatFunction = #denominator-tuplet-formatter
-       
+       markFormatter = #format-mark-letters
+       rehearsalMark = #1 
        subdivideBeams = ##f
        allowBeamBreak = ##f
        extraNatural = ##t
        autoAccidentals = #'(Staff (same-octave . 0))
        autoCautionaries = #'()  
 
-       keyAccidentalOrder = #'(
-         (6 . -1) (2  . -1) (5 . -1 ) (1  . -1) (4  . -1) (0  . -1) (3  . -1)
-        (3  . 1) (0 . 1) (4 . 1) (1 . 1) (5 . 1) (2 . 1) (6 . 1)
-         (6 . -2) (2  . -2) (5 . -2 ) (1  . -2) (4  . -2) (0  . -2) (3 . -2)
-         (3  . 2) (0 . 2) (4 . 2) (2 . 2) (5 . 2) (2 . 2) (6 . 2)
+       keyAccidentalOrder = #`(
+         (6 . ,FLAT) (2  . ,FLAT) (5 . ,FLAT ) (1  . ,FLAT) (4  . ,FLAT) (0  . ,FLAT) (3  . ,FLAT)
+        (3  . ,SHARP) (0 . ,SHARP) (4 . ,SHARP) (1 . ,SHARP) (5 . ,SHARP) (2 . ,SHARP) (6 . ,SHARP)
+         (6 . ,DOUBLE-FLAT) (2  . ,DOUBLE-FLAT) (5 . ,DOUBLE-FLAT ) (1  . ,DOUBLE-FLAT) (4  . ,DOUBLE-FLAT) (0  . ,DOUBLE-FLAT) (3 . ,DOUBLE-FLAT)
+         (3  . ,DOUBLE-SHARP) (0 . ,DOUBLE-SHARP) (4 . ,DOUBLE-SHARP) (2 . ,DOUBLE-SHARP) (5 . ,DOUBLE-SHARP) (2 . ,DOUBLE-SHARP) (6 . ,DOUBLE-SHARP)
         )
        breakAlignOrder = #'(
          instrument-name
          left-edge
          ambitus
-         span-bar
          breathing-sign
          clef
-         key-signature
+         rehearsal-mark
          staff-bar
+         key-signature
          time-signature
          custos
        )
-       barCheckSynchronize = ##t
-
+       barCheckSynchronize = ##f
+       
        %% chord names:
        chordNameFunction = #ignatzek-chord-names
        majorSevenSymbol = #whiteTriangleMarkup
@@ -511,23 +526,54 @@ ScoreContext = \translator {
 
        %%
        bassFigureFormatFunction = #make-bass-figure-markup
-       metronomeMarkFormatter = #make-metronome-markup
-
+       metronomeMarkFormatter = #format-metronome-markup
+       graceSettings = #`#(
+                (Voice Stem direction 1)
+
+                ;; TODO: should take from existing definition.
+                ;; c&p from define-grobs.scm
+                
+                (Voice Stem lengths ,(map (lambda (x) (* 0.8 x)) '(3.5 3.5 3.5 4.5 5.0)))
+                (Voice Stem stem-shorten (0.4 0))
+                (Voice Stem  font-size -3)
+                (Voice NoteHead  font-size -3)
+                (Voice Dots  font-size -3)
+                (Voice Stem beamed-lengths  
+                 ,(map (lambda (x) (* 0.8 x)) '(3.26)))
+                (Voice Stem beamed-minimum-free-lengths  
+                 ,(map (lambda (x) (* 0.8 x)) '(2.5 2.0 1.5)))
+                (Voice Stem beamed-extreme-minimum-free-lengths  
+                 ,(map (lambda (x) (* 0.8 x)) '(1.83 1.5)))
+
+                (Voice Stem no-stem-extend #t)
+                (Voice Beam thickness 0.384)
+                (Voice Beam space-function ,(lambda (beam mult)
+                                               (* 0.8 (Beam::space_function
+                                                       beam mult))))
+                (Voice Beam position-callbacks (,Beam::least_squares
+                                                   ,Beam::check_concave
+                                                   ,Beam::slope_damping))
+                (Staff Accidental font-size -4)
+                (Voice Slur direction -1)
+       )
+       
        \grobdescriptions #all-grob-descriptions
 }
 
-OrchestralScoreContext= \translator {
+OrchestralScoreContext = \translator {
        \ScoreContext
 }
 
-EasyNotation =  \translator {
+EasyNotation = \translator {
        \ScoreContext
        NoteHead \override #'molecule-callback = #Note_head::brew_ez_molecule
+       NoteHead \override #'Y-extent-callback = #'()
+       NoteHead \override #'X-extent-callback = #'()
 }
 
 
 
-FiguredBassContext = \translator {
+\translator {
        \type "Engraver_group_engraver"
        \name FiguredBass 
        \consists "Figured_bass_engraver"
@@ -538,12 +584,14 @@ FiguredBassContext = \translator {
        \consistsend "Hara_kiri_engraver"
 }
 
-TabVoiceContext =   \translator {
+\translator {
       \VoiceContext
       \name "TabVoice"
       \denies "Thread"
       \consists "Tab_note_heads_engraver"
-
+      \remove "Fingering_engraver"
+      \remove "New_fingering_engraver"
+      
       Slur \override #'font-family       = #'roman
       Slur \override #'molecule-callback = #hammer-molecule-callback
       Slur \override #'direction    = #-1
@@ -557,13 +605,20 @@ TabVoiceContext =   \translator {
       \remove Accidental_engraver
 }
 
-TabStaffContext = \translator {
+\translator {
       \StaffContext
       \alias "Staff"
       \name "TabStaff"
       \denies "Voice"
 
       \description "Context for generating tablature. [DOCME]"
+
+%{
+      TODO: this context should use a special staff_symbol engraver that
+      takes the line count out of the stringTunings property.
+
+%}
+      
       
       \accepts "TabVoice"
       
@@ -575,11 +630,165 @@ TabStaffContext = \translator {
       Stem \override #'avoid-note-head = ##t
       
       % No accidental in tablature !
-      \remove Accidental_engraver
-      \remove Key_engraver
-
+      \remove "Accidental_engraver"
+      \remove "Key_engraver"
+      \remove "String_number_engraver"
       % Special "TAB" clef
       clefGlyph = #"clefs-tab"
       clefPosition = #0
 }
-   
+
+% TODO: Gregorian Chant contexts should be moved to gregorian-init.ly,
+% but this does not work (is this a bug or intended behaviour?):
+%
+% If I try to do so, I get "error: unknown escaped string:
+% `\VaticanaStaffContext'" in params-init.ly.  If I also move
+% "\translator { \Vaticana*Context }" from params-init.ly to the end
+% of gregorian-init.ly, then I get "error: parse error, unexpected
+% TRANSLATOR: \translator { \VaticanaStaffContext }" in
+% gregorian-init.ly. --jr
+
+\translator {
+  \VoiceContext
+  \name "VaticanaVoice"
+  \alias "Voice"
+  \description "Same as @code{Voice} context, except that it is accommodated for tyepsetting Gregorian Chant in the notational style of Editio Vaticana."
+
+  % We can not remove Slur_engraver, since \addlyrics depends on it.
+  % Instead, we make the grob transparent.
+  % Unfortunately, this gives us a lot of warnings ("Degenerate bow:
+  % infinite steepness reqd"), since in ligatures, all note heads are in
+  % the same paper column such that the (transparent) slurs eventually may
+  % start and end in the same column.
+  Slur \override #'transparent = ##t
+
+  % We can not remove Stem_engraver, since slurs depend on stems.  If
+  % we try anyway, lily will crash in slur.scm:16:6: "Wrong type argument
+  % in position 1 (expecting grob): ()".
+  % As a workaround, we make the grob transparent.
+  Stem \set #'transparent = ##t
+
+  % Since we do not remove stems, but only make it transparent, we have
+  % to set the length to 0.0.  Otherwise, articulation marks (such as
+  % ictus, circulus or accentus) may be vertically placed quite away from
+  % the note head.
+  Stem \set #'length = #'0.0
+
+  \remove "Ligature_bracket_engraver"
+  \consists "Vaticana_ligature_engraver"
+
+  % Set default head for notes outside of \[ \].
+  NoteHead \set #'style = #'vaticana_punctum
+
+  % Put some space before and after divisiones.
+  % FIXME: This does not seem to show any effect.
+  Script \set #'padding = #0.5
+
+  % There are no beams in Gregorian Chant notation.
+  autobeaming = ##f
+
+  % Prepare TextSpanner for \episem{Initium|Finis} use.
+  TextSpanner \set #'style = #'line
+  TextSpanner \set #'edge-height = #'(0 . 0)
+  TextSpanner \set #'padding = #0.5
+  TextSpanner \set #'enclose-bounds = ##t
+  TextSpanner \set #'edge-text = #'("" . "")
+}
+
+\translator {
+  \StaffContext
+  \name "VaticanaStaff"
+  \alias "Staff"
+  \denies "Voice"
+  \accepts "VaticanaVoice"
+  \description "Same as @code{Staff} context, except that it is accommodated for tyepsetting Gregorian Chant in the notational style of Editio Vaticana."
+
+  \remove "Time_signature_engraver"
+  \consists "Custos_engraver"
+
+  % We can not remove Bar_engraver; otherwise clefs and custodes will
+  % not show up any more among other line breaking issues.
+  % Instead, we make the grob transparent.
+  BarLine \set #'transparent = ##t
+
+  StaffSymbol \set #'line-count = #4
+  StaffSymbol \set #'thickness = #0.6
+
+  % FIXME: unit on StaffSymbol's width should be \linewidth.
+  % StaffSymbol \set #'width = #60.0
+
+  % Choose vaticana do clef on 3rd line as default.
+  clefGlyph = #"clefs-vaticana_do"
+  centralCPosition = #1
+  clefPosition = #1
+  clefOctavation = #0
+
+  % Select vaticana style font.
+  KeySignature \set #'style = #'vaticana
+  Accidental \set #'style = #'vaticana
+  Custos \set #'style = #'vaticana
+  Custos \set #'neutral-position = #3
+  Custos \set #'neutral-direction = #-1
+  Custos \set #'adjust-if-on-staffline = ##t
+
+  % Score.timing = ##f
+  % Score.barAlways = ##t
+}
+
+\translator {
+  \VoiceContext
+  \name "GregorianTranscriptionVoice"
+  \alias "Voice"
+
+  % Removing ligature bracket engraver without replacing it by some
+  % other ligature engraver would cause a "Junking event: `LigatureEvent'"
+  % warning for every "\[" and "\]".  Therefore, we make the grob
+  % transparent instead.
+  LigatureBracket \set #'transparent = ##t
+
+  % We can not remove Slur_engraver, since \addlyrics depends on it.
+  % Instead, we make the grob transparent.
+  % Unfortunately, this gives us a lot of warnings ("Degenerate bow:
+  % infinite steepness reqd"), since in ligatures, all note heads are in
+  % the same paper column such that the (transparent) slurs eventually may
+  % start and end in the same column.
+  Slur \override #'transparent = ##t
+
+  % We can not remove Stem_engraver, since slurs depend on stems.  If
+  % we try anyway, lily will crash in slur.scm:16:6: "Wrong type argument
+  % in position 1 (expecting grob): ()".
+  % As a workaround, we make the grob transparent.
+  Stem \set #'transparent = ##t
+
+  % Since we do not remove stems, but only make it transparent, we have
+  % to set the length to 0.0.  Otherwise, articulation marks (such as
+  % ictus, circulus or accentus) may be vertically placed quite away from
+  % the note head.
+  Stem \set #'length = #'0.0
+
+  % Put some space before and after divisiones.
+  % FIXME: This does not seem to show any effect.
+  Script \set #'padding = #0.5
+
+  % There are no beams in Gregorian Chant notation.
+  autobeaming = ##f
+
+  % Prepare TextSpanner for \episem{Initium|Finis} use.
+  TextSpanner \set #'style = #'line
+  TextSpanner \set #'edge-height = #'(0 . 0)
+  TextSpanner \set #'padding = #0.5
+  TextSpanner \set #'enclose-bounds = ##t
+  TextSpanner \set #'edge-text = #'("" . "")
+}
+ \translator {
+  \StaffContext
+  \name "GregorianTranscriptionStaff"
+  \alias "Staff"
+  \denies "Voice"
+  \accepts "GregorianTranscriptionVoice"
+
+  % We can not remove Bar_engraver; otherwise clefs and custodes will
+  % not show up any more among other line breaking issues.
+  % Instead, we make the grob transparent.
+  BarLine \set #'transparent = ##t
+}