From: Han-Wen Nienhuys Date: Sun, 19 May 2002 13:43:09 +0000 (+0000) Subject: autochange wierdness X-Git-Tag: release/1.5.58~11 X-Git-Url: https://git.donarmstrong.com/lilypond.git?a=commitdiff_plain;h=e8dc65718d630d261548747e09b1c94e1182d57c;p=lilypond.git autochange wierdness --- diff --git a/ChangeLog b/ChangeLog index 3a2b8f4e3a..b024226714 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,12 @@ 2002-05-19 Han-Wen + * input/tutorial/sammartini.ly: fix and document autochange + weirdness. + + * scm/pdftex.scm: resurrect PDFTeX output. Still doesn't work, but + does produce .pdftex files. + * lily/note-collision.cc (check_meshing_chords): move file from collision.cc, implement merged note heads (there you go, Drarn :-) diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index b0baf887d7..cc22005e4b 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -55,30 +55,30 @@ provided in @ref{Tuning output} and @ref{Interpretation context}. The syntactical details are described at the end of the manual. @menu -* Overview:: -* Note entry:: -* Staff notation:: -* Polyphony:: -* Beaming:: -* Expressive marks:: -* Ornaments:: -* Repeats:: -* Rhythmic music:: -* Piano music:: -* Lyrics:: -* Chords:: -* Writing parts:: -* Custodes:: -* Figured bass:: -* Tuning output:: -* Page layout:: -* Output formats:: -* Sound:: -* Music entry:: -* Skipping corrected music:: -* Interpretation context:: -* Syntactic details:: -* Lexical details:: +* Overview:: +* Note entry:: +* Staff notation:: +* Polyphony:: +* Beaming:: +* Expressive marks:: +* Ornaments:: +* Repeats:: +* Rhythmic music:: +* Piano music:: +* Lyrics:: +* Chords:: +* Writing parts:: +* Custodes:: +* Figured bass:: +* Tuning output:: +* Page layout:: +* Output formats:: +* Sound:: +* Music entry:: +* Skipping corrected music:: +* Interpretation context:: +* Syntactic details:: +* Lexical details:: @end menu @c . {Overview} @@ -140,15 +140,15 @@ brevity we omit obligatory lint such as @code{\score} blocks and @menu -* Notes:: -* Pitches:: -* Rests:: -* Skips:: -* Durations:: -* Ties:: -* Tuplets:: -* Defining pitch names:: -* Easy Notation note heads :: +* Notes:: +* Pitches:: +* Rests:: +* Skips:: +* Durations:: +* Ties:: +* Tuplets:: +* Defining pitch names:: +* Easy Notation note heads :: @end menu @c . {Notes} @@ -553,11 +553,11 @@ the @code{-f ps} option of lilypond produces the correct result. @cindex Staff notation @menu -* Key signature:: -* Clef:: -* Time signature:: -* Unmetered music:: -* Bar lines:: +* Key signature:: +* Clef:: +* Time signature:: +* Unmetered music:: +* Bar lines:: @end menu @c . {Key} @@ -1128,11 +1128,11 @@ horizontal, falls two staff spaces: @c . {Slurs} @menu -* Slurs :: -* Phrasing slurs:: -* Breath marks:: -* Tempo:: -* Text spanners:: +* Slurs :: +* Phrasing slurs:: +* Breath marks:: +* Tempo:: +* Text spanners:: @end menu @node Slurs @@ -1296,11 +1296,11 @@ An application---or rather, a hack---is to fake octavation indications. @section Ornaments @cindex Ornaments @menu -* Articulations:: -* Text scripts:: -* Grace notes:: -* Glissando :: -* Dynamics:: +* Articulations:: +* Text scripts:: +* Grace notes:: +* Glissando :: +* Dynamics:: @end menu @c . {Articulation} @@ -1637,11 +1637,11 @@ Make beat or measure repeats. These look like percent signs. @end table @menu -* Repeat syntax:: -* Manual repeat commands:: -* Tremolo repeats:: -* Tremolo subdivisions:: -* Measure repeats:: +* Repeat syntax:: +* Manual repeat commands:: +* Tremolo repeats:: +* Tremolo subdivisions:: +* Measure repeats:: @end menu @node Repeat syntax @@ -1700,11 +1700,13 @@ the specified number of repeats. } @end lilypond -@subsection Unfolding repeats for MIDI output. +@subsection Repeats and MIDI +@subsection Repeats and MIDI @cindex expanding repeats -See @file{input/test/unfold-all-repeats.ly}. +For instructions on how to unfoldi repeats for MIDI output, see +the example file @file{input/test/unfold-all-repeats.ly}. @refbugs @@ -1837,7 +1839,7 @@ with slashes, and repeating that measure with percents. @menu -* Rhythmic staves:: +* Rhythmic staves:: @end menu @node Rhythmic staves @@ -1867,11 +1869,11 @@ behavior. In this section we discuss the @internalsref{PianoStaff} and some other pianistic peculiarities. @menu -* Automatic staff changes:: -* Manual staff switches:: -* Pedals:: -* Arpeggio:: -* Voice follower lines:: +* Automatic staff changes:: +* Manual staff switches:: +* Pedals:: +* Arpeggio:: +* Voice follower lines:: @end menu @@ -1883,13 +1885,14 @@ other pianistic peculiarities. Voices can switch automatically between the top and the bottom staff. The syntax for this is @example - \autochange @var{contexttype} @var{musicexp} -@end example -This will switch the interpretation context of @var{musicexp} between a -@var{contexttype} named @code{up} and @code{down}. Typically, you use -@internalsref{Staff} for @var{contexttype}. The autochanger switches on basis -of pitch (central C is the turning point), and it looks ahead skipping -over rests to switch rests in advance. + \autochange @var{contexttype} \context @var{childcontexttype} + @var{musicexp} @end example This will switch the +interpretation context of @var{musicexp} between a @var{contexttype} +named @code{up} and @code{down}. Typically, you use +@internalsref{Staff} for @var{contexttype}, and @internalsref{Voice} +for @var{childcontexttype}. The autochanger switches on basis of pitch +(central C is the turning point), and it looks ahead skipping over +rests to switch rests in advance. @lilypond[verbatim,singleline] \score { \notes \context PianoStaff < @@ -2092,10 +2095,10 @@ The associated grob is @internalsref{VoiceFollower}. @menu -* Lyrics mode:: -* Printing lyrics:: +* Lyrics mode:: +* Printing lyrics:: * Automatic syllable durations:: -* More stanzas:: +* More stanzas:: @end menu @c . {Lyrics mode} @@ -2320,8 +2323,8 @@ not attempt to be intelligent. If you enter @code{f bes d}, it does not interpret this as an inversion. @menu -* Chords mode:: -* Printing named chords:: +* Chords mode:: +* Printing named chords:: @end menu @c . {Chords mode} @@ -2542,14 +2545,14 @@ problems in orchestral music. @c . {Transpose} @menu -* Rehearsal marks:: -* Bar numbers:: -* Instrument names:: -* Transpose:: +* Rehearsal marks:: +* Bar numbers:: +* Instrument names:: +* Transpose:: * Sound output for transposing instruments:: -* Multi measure rests:: -* Automatic part combining:: -* Hara kiri staves:: +* Multi measure rests:: +* Automatic part combining:: +* Hara kiri staves:: @end menu @c . {Rehearsal marks} @@ -2935,13 +2938,13 @@ affecting a whole set of objects. Second, you can select one specific object, and set a grob property in that object. @menu -* Tuning groups of grobs :: -* Tuning per grob :: -* What to tune?:: -* Font selection:: -* Text markup:: -* Invisible grobs:: -* Dirty tricks:: +* Tuning groups of grobs :: +* Tuning per grob :: +* What to tune?:: +* Font selection:: +* Text markup:: +* Invisible grobs:: +* Dirty tricks:: @end menu @node Tuning groups of grobs @@ -3487,13 +3490,13 @@ and (La)@TeX{} putting the notation on a page, including page breaks. The part of LilyPond is documented here. @menu -* Paper block:: -* Paper variables:: -* Font Size:: -* Paper size:: -* Line break:: -* Page break:: -* Output scaling:: +* Paper block:: +* Paper variables:: +* Font Size:: +* Paper size:: +* Line break:: +* Page break:: +* Output scaling:: @end menu @c . {Paper block} @@ -3743,10 +3746,10 @@ meaning that you don't have access to continuously scaled fonts. LilyPond can output processed music in different output formats. @menu -* TeX output:: -* PostScript output:: -* Scheme output:: -* ASCIIScript output:: +* TeX output:: +* PostScript output:: +* Scheme output:: +* ASCIIScript output:: @end menu @node TeX output @@ -3930,8 +3933,8 @@ It is currently not possible to use the percussion channel (generally channel 10 of a MIDI file). @menu -* MIDI block:: -* MIDI instrument names:: +* MIDI block:: +* MIDI instrument names:: @end menu @c . {MIDI block} @@ -3991,9 +3994,9 @@ number. @section Music entry @cindex Music entry @menu -* Relative:: -* Bar check:: -* Point and click:: +* Relative:: +* Bar check:: +* Point and click:: @end menu When entering music with LilyPond, it is easy to introduce errors. This @@ -4211,12 +4214,12 @@ c d b bes a g c2 } @section Interpretation context @menu -* Creating contexts:: -* Default contexts:: -* Context properties:: -* Engravers and performers:: +* Creating contexts:: +* Default contexts:: +* Context properties:: +* Engravers and performers:: * Changing context definitions:: -* Defining new contexts:: +* Defining new contexts:: @end menu @@ -4563,13 +4566,13 @@ such an identifier outside of @code{\score}, you must do This section describes details that were too boring to be put elsewhere. @menu -* Top level:: -* Identifiers:: -* Music expressions:: +* Top level:: +* Identifiers:: +* Music expressions:: * Manipulating music expressions:: -* Assignments:: -* Lexical modes:: -* Ambiguities:: +* Assignments:: +* Lexical modes:: +* Ambiguities:: @end menu @c . {Top level} @@ -4808,7 +4811,7 @@ More examples are given in the distributed example files in @c . {Span requests} @menu -* Span requests:: +* Span requests:: @end menu @node Span requests @@ -4967,15 +4970,15 @@ right time between Even more boring details, now on lexical side of the input parser. @menu -* Comments:: -* Direct Scheme:: -* Keywords:: -* Integers:: -* Reals:: -* Strings:: -* Main input:: -* File inclusion:: -* Version information:: +* Comments:: +* Direct Scheme:: +* Keywords:: +* Integers:: +* Reals:: +* Strings:: +* Main input:: +* File inclusion:: +* Version information:: @end menu diff --git a/Documentation/user/tutorial.itely b/Documentation/user/tutorial.itely index 62cb86775f..8fa404fa62 100644 --- a/Documentation/user/tutorial.itely +++ b/Documentation/user/tutorial.itely @@ -1019,6 +1019,10 @@ The following piece of music is played twice. The first argument indicates the type of repeat. In this case, @code{"volta"} means that prima volta/secunda volta brackets are used for the alternative endings---if there were any. + +A special notation for repeats allows you to get correct repeats in +MIDI output. However, some extra trickery is needed to get this +working, See @ref{Repeats and MIDI}. @separate @example @@ -1822,10 +1826,10 @@ will be at the left. @node A piano excerpt @section A piano excerpt -Our fourth subject is a piece of piano music. The fragment in the input -file is a piano reduction of the G major Sinfonia by Giovanni Battista -Sammartini. It was composed around 1740. It's in the source package -under the name @file{sammartini.ly}. +Our fourth subject is a piece of piano music. The fragment in the +input file is a piano reduction of the G major Sinfonia by Giovanni +Battista Sammartini. It was composed around 1740. It's in the source +package under the name @file{sammartini.ly}. @lilypond[verbatim] \include "paper16.ly" @@ -1864,11 +1868,11 @@ oboes = \notes \relative c'' \context Voice = oboe { } hoomPah = \repeat unfold 8 \notes - \transpose c' { \stemUp c8 \stemBoth \stemDown c'8 \stemBoth } + \transpose c' { \stemUp c8 \stemBoth \stemDown g'8 \stemBoth } bassvoices = \notes \relative c' { c4 g8. b,16 - \autochange Staff \hoomPah + \autochange Staff \context Voice \hoomPah \translator Staff = down \stemDown [c8 c'8] r4 r4 @@ -2135,7 +2139,7 @@ having to worry about getting the motive in a wrong octave. @example bassvoices = \notes \relative c' @{ c4 g8. b,16 -\autochange Staff \hoomPah +\autochange Staff \hoomPah \context Voice @end example @cindex staff switch, automatic @cindex cross staff voice, automatic diff --git a/input/bugs/bizarre-beam.ly b/input/bugs/bizarre-beam.ly new file mode 100644 index 0000000000..2a8ecf7465 --- /dev/null +++ b/input/bugs/bizarre-beam.ly @@ -0,0 +1,3 @@ + + +\score{ \notes {[g'' g''] }} diff --git a/input/regression/collision-heads.ly b/input/regression/collision-heads.ly index 04ef2f7326..7726cac131 100644 --- a/input/regression/collision-heads.ly +++ b/input/regression/collision-heads.ly @@ -14,7 +14,7 @@ if the black note heads are from 8th or shorter notes. \property Staff.NoteCollision \override #'merge-differently-headed = ##t c2 - c4. c8 + c8 c4. c2 } \context Voice = VB { diff --git a/input/tutorial/sammartini.ly b/input/tutorial/sammartini.ly index c8ff8a10f0..d9f648fa17 100644 --- a/input/tutorial/sammartini.ly +++ b/input/tutorial/sammartini.ly @@ -33,11 +33,11 @@ oboes = \notes \relative c'' \context Voice = oboe { } hoomPah = \repeat unfold 8 \notes - \transpose c' { c8 \stemDown c'8 \stemUp } + \transpose c' { c8 \stemDown g'8 \stemUp } bassvoices = \notes \relative c' { c4 g8. b,16 - \autochange Staff \hoomPah + \autochange Staff \context Voice \hoomPah \translator Staff = down \stemDown [c8 c'8] r4 r4 diff --git a/lily/relative-octave-music.cc b/lily/relative-octave-music.cc index 4d7251166d..b9aeb445a3 100644 --- a/lily/relative-octave-music.cc +++ b/lily/relative-octave-music.cc @@ -25,7 +25,7 @@ Relative_octave_music::Relative_octave_music (SCM l) Relative_octave_music::Relative_octave_music () { - set_mus_property ("type", ly_symbol2scm ("relative-octave-music")); + set_mus_property ("type", ly_symbol2scm ("relative-octave-music")); } ADD_MUSIC (Relative_octave_music); diff --git a/scm/lily.scm b/scm/lily.scm index 656c8a7bd6..7506323a65 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -132,6 +132,7 @@ (scm pysk) (scm ascii-script) (scm sketch) + (scm pdftex) ) (define output-alist @@ -142,6 +143,7 @@ ("as" . ,as-output-expression) ("pysk" . ,pysk-output-expression) ("sketch" . ,sketch-output-expression) + ("pdftex" . ,pdftex-output-expression) )) diff --git a/scm/pdf.scm b/scm/pdf.scm index 044fd5b097..15b37c91b8 100644 --- a/scm/pdf.scm +++ b/scm/pdf.scm @@ -229,9 +229,18 @@ (define (define-origin a b c ) "") (define (no-origin) "") +(define my-eval-in-module eval) + +(if (or (equal? (minor-version) "4") + (equal? (minor-version) "3.4")) + (begin + (set! my-eval-in-module eval-in-module) + + )) + +(define-public (pdf-output-expression expr port) + (display (my-eval-in-module expr this-module) port) ) -(define (scm-pdf-output) - (primitive-eval (pdf-scm 'all-definitions))) ; Local Variables: ; scheme-program-name: "guile" diff --git a/scm/pdftex.scm b/scm/pdftex.scm index b2c22ba52d..04d15ba650 100644 --- a/scm/pdftex.scm +++ b/scm/pdftex.scm @@ -12,6 +12,13 @@ (define-module (scm pdftex)) +(use-modules (scm pdf) + (guile) + (ice-9 regex) + (ice-9 string-fun) + ) + +(define this-module (current-module)) (define (unknown) "%\n\\unknown%\n") @@ -40,19 +47,19 @@ )) (define (beam width slope thick) - (embedded-pdf ((pdf-scm 'beam) width slope thick))) + (embedded-pdf (list 'beam width slope thick))) (define (bracket arch_angle arch_width arch_height height arch_thick thick) - (embedded-pdf ((pdf-scm 'bracket) arch_angle arch_width arch_height height arch_thick thick))) + (embedded-pdf (list 'bracket arch_angle arch_width arch_height height arch_thick thick))) (define (dashed-slur thick dash l) - (embedded-pdf ((pdf-scm 'dashed-slur) thick dash l))) + (embedded-pdf (list 'dashed-slur thick dash l))) (define (char i) (string-append "\\char" (inexact->string i 10) " ")) (define (dashed-line thick on off dx dy) - (embedded-pdf ((pdf-scm 'dashed-line) thick on off dx dy))) + (embedded-pdf (list 'dashed-line thick on off dx dy))) (define (font-load-command name-mag command) (string-append @@ -63,13 +70,26 @@ "\n")) (define (ez-ball c l b) - (embedded-pdf ((pdf-scm 'ez-ball) c l b))) + (embedded-pdf (list 'ez-ball c l b))) + + + +(if (or (equal? (minor-version) "4") + (equal? (minor-version) "3.4")) + (define (embedded-pdf expr) + (let ((ps-string + (with-output-to-string + (lambda () (pdf-output-expression expr (current-output-port)))))) + (string-append "\\embeddedpdf{" ps-string "}"))) + (define (embedded-pdf expr) + (let + ((os (open-output-string))) + (pdf-output-expression expr os) + (string-append "\\embeddedpdf{" (get-output-string os) "}")))) -(define (embedded-pdf s) - (string-append "\\embeddedpdf{ " s "}")) (define (comment s) - (string-append "% " s)) + (simple-format #f "% ~a\n" s)) (define (end-output) (begin @@ -83,7 +103,31 @@ "") (define (repeat-slash w a t) - (embedded-pdf ((pdf-scm 'repeat-slash) w a t))) + (embedded-pdf (list 'repeat-slash w a t))) +(define (fontify name-mag-pair exp) + (string-append (select-font name-mag-pair) + exp)) + + +(define (tex-encoded-fontswitch name-mag) + (let* ((iname-mag (car name-mag)) + (ename-mag (cdr name-mag))) + (cons iname-mag + (cons ename-mag + (string-append "magfont" + (string-encode-integer + (hashq (car ename-mag) 1000000)) + "m" + (string-encode-integer + (inexact->exact (* 1000 (cdr ename-mag))))))))) +(define (define-fonts internal-external-name-mag-pairs) + (set! font-name-alist (map tex-encoded-fontswitch + internal-external-name-mag-pairs)) + (apply string-append + (map (lambda (x) + (font-load-command (car x) (cdr x))) + (map cdr font-name-alist)))) + (define (font-switch i) (string-append @@ -140,7 +184,7 @@ (number->dim y) "}{" (number->dim x) "}{" s "}\n")) (define (bezier-sandwich l thick) - (embedded-pdf ((pdf-scm 'bezier-sandwich) l thick))) + (embedded-pdf (list 'bezier-sandwich `(quote ,l) thick))) (define (start-system ht) (string-append"\\vbox to " (number->dim ht) "{\\hbox{%\n")) @@ -157,7 +201,7 @@ "height " (number->dim height) " ")) (define (roundfilledbox x width y height blotdiam) - (embedded-pdf ((pdf-scm 'roundfilledbox) x width y height blotdiam))) + (embedded-pdf (list 'roundfilledbox x width y height blotdiam))) (define (text s) (string-append "\\hbox{" (output-tex-string s) "}")) @@ -175,5 +219,15 @@ (define (no-origin) "") -(define (scm-pdftex-output) - (primitive-eval (pdftex-scm 'all-definitions))) + +(define my-eval-in-module eval) + +(if (or (equal? (minor-version) "4") + (equal? (minor-version) "3.4")) + (begin + (set! my-eval-in-module eval-in-module) + + )) + +(define-public (pdftex-output-expression expr port) + (display (my-eval-in-module expr this-module) port) )