From 897fae718eb87e2e1e1cc862afe0cce58de99c88 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 28 Aug 2003 09:43:47 +0000 Subject: [PATCH] * lily/my-lily-lexer.cc (My_lily_lexer): don't crash on unquoted strings before \notenames. * lily/parser.yy (lyric_element): allow markup as lyric text. This increases the number of s/r reductions to 4. * scm/new-markup.scm (fraction-markup): \fraction command. * lily/lexer.ll: allow any string without \ { } # and " in \markup mode * lily/lookup.cc (round_filled_box): rename function. (LY_DEFINE): round-filled-box: change signature. * Documentation/user/refman.itely: revise section explaining grace notes. * lily/my-lily-lexer.cc: add \accacciatura and \appoggiatura * ly/grace-init.ly (stopGraceMusic): add slurs on grace note by default * ly/engraver-init.ly (ScoreContext): new property graceSettings. --- ChangeLog | 17 +++ Documentation/user/refman.itely | 186 +++++++++++++++++--------------- lily/ambitus.cc | 2 +- lily/breathing-sign.cc | 8 +- lily/cluster.cc | 8 +- lily/include/lookup.hh | 2 +- lily/lexer.ll | 14 +-- lily/lookup.cc | 39 ++++--- lily/mensural-ligature.cc | 2 +- lily/my-lily-lexer.cc | 6 ++ lily/note-head.cc | 2 +- lily/parser.yy | 21 +++- lily/vaticana-ligature.cc | 2 +- ly/init.ly | 3 + ly/nederlands.ly | 7 ++ scm/lily.scm | 11 +- scm/molecule.scm | 15 ++- scm/new-markup.scm | 37 ++++++- scm/output-ascii-script.scm | 2 +- scm/output-lib.scm | 6 +- scm/output-pdf.scm | 4 +- scm/output-pdftex.scm | 4 +- scm/output-ps.scm | 2 +- scm/output-sketch.scm | 4 +- scm/output-sodipodi.scm | 4 +- scm/output-tex.scm | 4 +- 26 files changed, 253 insertions(+), 159 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1274a9338f..bded514059 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,22 @@ 2003-08-28 Han-Wen Nienhuys + * lily/my-lily-lexer.cc (My_lily_lexer): don't crash + on unquoted strings before \notenames. + + * lily/parser.yy (lyric_element): allow markup as lyric text. This + increases the number of s/r reductions to 4. + + * scm/new-markup.scm (fraction-markup): \fraction command. + + * lily/lexer.ll: allow any string without \ { } # and " in \markup + mode + + * lily/lookup.cc (round_filled_box): rename function. + (LY_DEFINE): round-filled-box: change signature. + + * Documentation/user/refman.itely: revise section explaining grace + notes. + * lily/translator-scheme.cc (LY_DEFINE): add ! * input/*/*.ly (vmus): use \new everywhere. diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index ef2decf484..f9a4e53500 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -2153,27 +2153,55 @@ longer be computed. @cindex ornaments @cindex grace notes -Grace notes are ornaments that are written out, like accaciatura and -appogiatura notes. +Grace notes are ornaments that are written out. The most common ones +are accacciatura, which should be played as very short. It is denoted +by a slurred small note with a slashed stem. The appoggiatura is a +grace note that takes a fixed fraction of the main note, is and +denoted as a slurred note in small print without a slash. +They are entered with the commands @code{\accacciatura} and +@code{\appoggiatura}, as demonstrated in the following example: + + +@cindex appoggiatura +@cindex accacciatura + +@lilypond[relative=2,verbatim,fragment] +b4 \accacciatura d8 c4 \appoggiatura e8 d4 +\accacciatura { g16 f } e4 +@end lilypond + +Both are special forms of the @code{\grace} command. By prefixing this +keyword to a music expression, a new one is formed, which will be +printed in a smaller font and takes up no logical time in a measure. @lilypond[relative=2,verbatim,fragment] -c4 \grace c16 c4 \grace { -c16[ d16] } c4 + c4 \grace c16 c4 \grace { + c16[ d16] } c2 c4 @end lilypond +Unlike @code{\accacciatura} and @code{\appoggiatura}, the +@code{\grace} command does not start a slur. -From the point of view of typesetting, their characteristic is that -grace notes take up take up no logical time in a measure. Internally, -timing for grace notes is done using a second time. Every point in -musical time consists of two rational numbers: one denotes the logical -time, one denotes the grace timing. The above example is shown here -with timing tuples: +Internally, timing for grace notes is done using a second, `grace' +time. Every point in time consists of two rational numbers: one +denotes the logical time, one denotes the grace timing. The above +example is shown here with timing tuples: -@lilypond[] -\score { \notes \relative c''{ - c4^"(0,0)" \grace c16_" "_"(1/4,-1/16)" c4^"(1/4,0)" \grace { - c16_"(2/4,-1/8)"[ d16^"(2/4,-1/16)" ] } c4_" "_"(2/4,0)" +@lilypond[singleline] +< + \relative c''{ + c4 \grace c16 c4 \grace { + c16[ d16] } c4 } -\paper { linewidth = 12.\cm } -} + \new Lyrics \lyrics { + \markup { (0,0) } 4 + \grace { \markup { + ( \fraction 1 4 , \fraction -1 16 ) } 16 } + \markup { (\fraction 1 4 , 0 ) } 4 + \grace { + \markup { (\fraction 2 4 , \fraction "-1" 8 ) } 16 + \markup { (\fraction 2 4 , \fraction "-1" 16 ) } 16 + } + \markup { ( \fraction 2 4 , 0 ) } + } > @end lilypond @@ -2187,28 +2215,6 @@ every eighth grace note: @end lilypond -Unbeamed eighth notes and shorter by default have a slash through the -stem. These notes are called accaciaturas, and should generally be -played as short as possible. An appogiatura takes a fixed fraction of -the main note, is and denoted without a slash. - -Such slashless notes are obtained by setting the object property -@code{stroke-style} of the @internalsref{Stem} object: -@cindex slash -@cindex grace slash - -@lilypond[fragment,verbatim] -\relative c'' \context Voice { - \grace c8 c4 \grace { c16[ c16] } c4 - \grace { - \property Voice.Stem \override #'stroke-style = #'() - c16 - \property Voice.Stem \revert #'stroke-style - } c4 -} -@end lilypond -The @code{\override} is carefully matched with a @code{\revert}: - If you want to end a note with a grace note, then the standard trick is to put the grace notes before a phantom ``space note'', e.g. @@ -2224,29 +2230,42 @@ is to put the grace notes before a phantom ``space note'', e.g. By adjusting the duration of the skip note (here it is a half-note), the space between the main-note and the grace is adjusted. -A @code{\grace} section has some default values, and LilyPond will -use those default values unless you specify otherwise inside the -@code{\grace} section. For example, if you specify \slurUp -@emph{before} your @code{\grace} section, a slur which starts inside -the @code{\grace} will not be forced up, even if the slur ends outside -of the @code{\grace}. Note the difference between the first and -second bars in this example: -@lilypond[fragment,verbatim] -\relative c'' \context Voice { - \slurUp - \grace { - a4( } - a4) a4( a2) - \slurBoth - - \grace { - \slurUp - a4( } - a4) a4( a2) - \slurBoth +A @code{\grace} section will introduce special typesetting settings, +for example, to produce smaller type, and set directions. Hence, when +introducing layout tweaks, they should be inside the grace section, +for example, +@lilypond[fragment,verbatim,relative 2] +\new Voice { + \accacciatura { + \property Voice.Stem \override #'direction = #-1 + f16-> + \property Voice.Stem \revert #'direction + } + g4 } @end lilypond +The overrides should also be reverted inside the grace section. + +If the layout of grace sections must be changed throughout the music, +then this can be accomplished through the function +@code{add-grace-property}. The following example +undefines the Stem direction grace section, so stems do not always +point up. + +@example + \new Staff @{ + #(add-grace-property "Voice" Stem direction '()) + @dots{} + @} +@end example + +@noindent +Another option is to change the variables @code{startGraceMusic}, +@code{stopGraceMusic}, @code{startAccacciaturaMusic}, +@code{stopAccacciaturaMusic}, @code{startAppoggiaturaMusic}, +@code{stopAppoggiaturaMstuic}. More information is in the file +@file{ly/grace-init.ly} @seealso @@ -2274,9 +2293,8 @@ Grace sections should only be used within sequential music expressions. Nesting or juxtaposing grace sections is not supported, and might produce crashes or other errors. -Overriding settings for grace music globally cannot be done in a -modular way. A kludge (@code{add-to-grace-init}) is defined in -@file{ly/grace-init.ly}. +Overriding settings cannot be done in separate styles for appoggiatura +and accacciatura. @node Glissando @@ -2294,7 +2312,7 @@ A glissando line can be requested by attaching a @code{\glissando} to a note: @lilypond[fragment,relative,verbatim] - c'-\glissando c' + c'\glissando c' @end lilypond @seealso @@ -2332,14 +2350,14 @@ Additional texts (such as @emph{gliss.}) is not supported. Absolute dynamic marks are specified using an variable after a -note: @code{c4-\ff}. The available dynamic marks are @code{\ppp}, +note: @code{c4\ff}. The available dynamic marks are @code{\ppp}, @code{\pp}, @code{\p}, @code{\mp}, @code{\mf}, @code{\f}, @code{\ff}, @code{\fff}, @code{\fff}, @code{\fp}, @code{\sf}, @code{\sff}, @code{\sp}, @code{\spp}, @code{\sfz}, and @code{\rfz}: @lilypond[verbatim,singleline,fragment,relative] - c'-\ppp c-\pp c -\p c-\mp c-\mf c-\f c-\ff c-\fff - c2-\sf c-\rfz + c'\ppp c\pp c \p c\mp c\mf c\f c\ff c\fff + c2\sf c\rfz @end lilypond @cindex @code{\cr} @@ -2358,8 +2376,8 @@ with @code{\!}. Because these marks are bound to notes, if you must use spacer notes if multiple marks during one note are needed: @lilypond[fragment,verbatim,center,quote] - c''-\< c''-\! d''-\decr e''-\rced - < f''1 { s4 s4-\< s4-\! \> s4-\! } > + c''\< c''\! d''\decr e''\rced + < f''1 { s4 s4\< s4\! \> s4\! } > @end lilypond This may give rise to very short hairpins. Use @code{minimum-length} in @internalsref{Voice}.@internalsref{Hairpin} to lengthen them, for @@ -2384,7 +2402,7 @@ You can also supply your own texts: \context Voice { \property Voice.crescendoText = \markup { \italic "cresc. poco" } \property Voice.crescendoSpanner = #'dashed-line - a'2-\mf-\< a a a-\! + a'2\mf\< a a a\! } @end lilypond @@ -3090,7 +3108,7 @@ Piano pedal instruction can be expressed by attaching note or chord: @lilypond[fragment,verbatim] - c'4-\sustainDown c'4-\sustainUp + c'4\sustainDown c'4\sustainUp @end lilypond What is printed can be modified by setting @code{pedal@var{X}Strings}, @@ -3103,9 +3121,9 @@ Pedals can also be indicated by a sequence of brackets, by setting the @lilypond[fragment,verbatim] \property Staff.pedalSustainStyle = #'bracket - c''4-\sustainDown d''4 e''4 - a'4-\sustainUp-\sustainDown - f'4 g'4 a'4-\sustainUp + c''4\sustainDown d''4 e''4 + a'4\sustainUp\sustainDown + f'4 g'4 a'4\sustainUp @end lilypond A third style of pedal notation is a mixture of text and brackets, @@ -3113,9 +3131,9 @@ obtained by setting @code{pedal-type} to @code{mixed}: @lilypond[fragment,verbatim] \property Staff.pedalSustainStyle = #'mixed -c''4-\sustainDown d''4 e''4 -c'4-\sustainUp-\sustainDown - f'4 g'4 a'4-\sustainUp +c''4\sustainDown d''4 e''4 +c'4\sustainUp\sustainDown + f'4 g'4 a'4\sustainUp @end lilypond The default `*Ped' style for sustain and damper pedals corresponds to @@ -3123,7 +3141,7 @@ The default `*Ped' style for sustain and damper pedals corresponds to for a sostenuto pedal: @lilypond[fragment,verbatim] -c''4-\sostenutoDown d''4 e''4 c'4 f'4 g'4 a'4-\sostenutoUp +c''4\sostenutoDown d''4 e''4 c'4 f'4 g'4 a'4\sostenutoUp @end lilypond For fine-tuning of the appearance of a pedal bracket, the properties @@ -3135,8 +3153,8 @@ may be extended to the end of the note head: @lilypond[fragment,verbatim] \property Staff.PianoPedalBracket \override #'shorten-pair = #'(0 . -1.0) -c''4-\sostenutoDown d''4 e''4 c'4 -f'4 g'4 a'4-\sostenutoUp +c''4\sostenutoDown d''4 e''4 c'4 +f'4 g'4 a'4\sostenutoUp @end lilypond @node Arpeggio @@ -3151,7 +3169,7 @@ You can specify an arpeggio sign on a chord by attaching an @lilypond[fragment,relative,verbatim] - <>-\arpeggio + <>\arpeggio @end lilypond When an arpeggio crosses staves, you attach an arpeggio to the chords @@ -3161,8 +3179,8 @@ in both staves, and set @lilypond[fragment,relative,verbatim] \context PianoStaff < \property PianoStaff.connectArpeggios = ##t - \new Staff { <>-\arpeggio } - \new Staff { \clef bass <>-\arpeggio } + \new Staff { <>\arpeggio } + \new Staff { \clef bass <>\arpeggio } > @end lilypond @@ -3173,9 +3191,9 @@ arrowhead to the wiggly line. This can be typeset by setting @lilypond[fragment,relative,verbatim] \context Voice { \property Voice.Arpeggio \set #'arpeggio-direction = #1 - <>-\arpeggio + <>\arpeggio \property Voice.Arpeggio \set #'arpeggio-direction = #-1 - <>-\arpeggio + <>\arpeggio } @end lilypond @@ -3188,7 +3206,7 @@ arpeggiate the chord. To draw these brackets, set the @lilypond[fragment,relative,verbatim] \property PianoStaff.Arpeggio \override #'molecule-callback = \arpeggioBracket - <>-\arpeggio + <>\arpeggio @end lilypond @refcommands diff --git a/lily/ambitus.cc b/lily/ambitus.cc index 0421a1e113..62104d3ac1 100644 --- a/lily/ambitus.cc +++ b/lily/ambitus.cc @@ -203,7 +203,7 @@ Ambitus::brew_molecule (SCM smob) Interval x_extent = 0.5 * Interval (-linethickness, +linethickness); Interval y_extent = 0.5 * Interval (p_min + 1.35, p_max - 1.35); Box line_box (x_extent, y_extent); - Molecule line = Lookup::roundfilledbox (line_box, blotdiameter); + Molecule line = Lookup::round_filled_box (line_box, blotdiameter); line.translate_axis (0.5 * head_min.extent (X_AXIS).length (), X_AXIS); molecule.add_molecule (line); } diff --git a/lily/breathing-sign.cc b/lily/breathing-sign.cc index e78b5a5016..bd3bc598b1 100644 --- a/lily/breathing-sign.cc +++ b/lily/breathing-sign.cc @@ -84,7 +84,7 @@ Breathing_sign::divisio_minima (SCM smob) Interval xdim (0, thickness); Interval ydim (-0.5 * staff_space, +0.5 * staff_space); Box b (xdim, ydim); - Molecule out = Lookup::roundfilledbox (b, blotdiameter); + Molecule out = Lookup::round_filled_box (b, blotdiameter); return out.smobbed_copy (); } @@ -125,7 +125,7 @@ Breathing_sign::divisio_maior (SCM smob) Interval xdim (0, thickness); Interval ydim (-0.5 * height, +0.5 * height); Box b (xdim, ydim); - Molecule out = Lookup::roundfilledbox (b, blotdiameter); + Molecule out = Lookup::round_filled_box (b, blotdiameter); return out.smobbed_copy (); } @@ -156,7 +156,7 @@ Breathing_sign::divisio_maxima (SCM smob) Interval xdim (0, thickness); Interval ydim (-0.5 * staff_size, +0.5 * staff_size); Box b (xdim, ydim); - Molecule out = Lookup::roundfilledbox (b, blotdiameter); + Molecule out = Lookup::round_filled_box (b, blotdiameter); return out.smobbed_copy (); } @@ -187,7 +187,7 @@ Breathing_sign::finalis (SCM smob) Interval xdim (0, thickness); Interval ydim (-0.5 * staff_size, +0.5 * staff_size); Box b (xdim, ydim); - Molecule line1 = Lookup::roundfilledbox (b, blotdiameter); + Molecule line1 = Lookup::round_filled_box (b, blotdiameter); Molecule line2 (line1); line2.translate_axis (0.5 * staff_space, X_AXIS); line1.add_molecule (line2); diff --git a/lily/cluster.cc b/lily/cluster.cc index af858ada86..424e1d248b 100644 --- a/lily/cluster.cc +++ b/lily/cluster.cc @@ -73,7 +73,7 @@ brew_cluster_piece (Grob *me, Array bottom_points, Array top_poi box.add_point (bottom_points[i] - hvpadding); box.add_point (Offset(top_points[i + 1][X_AXIS], top_points[i][Y_AXIS]) + hvpadding); - out.add_molecule (Lookup::roundfilledbox (box, blotdiameter)); + out.add_molecule (Lookup::round_filled_box (box, blotdiameter)); } } else if (String::compare (shape, "rightsided-stairs") == 0) @@ -84,7 +84,7 @@ brew_cluster_piece (Grob *me, Array bottom_points, Array top_poi box.add_point (Offset(bottom_points[i][X_AXIS], bottom_points[i + 1][Y_AXIS]) - hvpadding); box.add_point (top_points[i + 1] + hvpadding); - out.add_molecule (Lookup::roundfilledbox (box, blotdiameter)); + out.add_molecule (Lookup::round_filled_box (box, blotdiameter)); } } else if (String::compare (shape, "centered-stairs") == 0) @@ -99,7 +99,7 @@ brew_cluster_piece (Grob *me, Array bottom_points, Array top_poi hvpadding); box.add_point (Offset (right_xmid, top_points[i][Y_AXIS]) + hvpadding); - out.add_molecule (Lookup::roundfilledbox (box, blotdiameter)); + out.add_molecule (Lookup::round_filled_box (box, blotdiameter)); left_xmid = right_xmid; } Real right_xmid = bottom_points[size - 1][X_AXIS]; @@ -108,7 +108,7 @@ brew_cluster_piece (Grob *me, Array bottom_points, Array top_poi hvpadding); box.add_point (Offset (right_xmid, top_points[size - 1][Y_AXIS]) + hvpadding); - out.add_molecule (Lookup::roundfilledbox (box, blotdiameter)); + out.add_molecule (Lookup::round_filled_box (box, blotdiameter)); } else if (String::compare (shape, "ramp") == 0) { diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index c730a25acf..02fcea0f80 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -30,7 +30,7 @@ struct Lookup static Molecule dashed_slur (Bezier, Real thick, Real dash); static Molecule blank (Box b); static Molecule filledbox (Box b); - static Molecule roundfilledbox (Box b, Real blotdiameter); + static Molecule round_filled_box (Box b, Real blotdiameter); static Molecule repeat_slash (Real w, Real slope, Real th); static Molecule line (Real th, Offset from, Offset to); static Molecule horizontal_line (Interval w, Real th); diff --git a/lily/lexer.ll b/lily/lexer.ll index a9163c51b6..7cf2e195d2 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -499,23 +499,23 @@ HYPHEN -- } else return scan_escaped_word (str); } - {LYRICS} { + [{}] { + return YYText()[0]; + } + [^#{}"\\ \t\n\f]+ { String s (YYText ()); char c = s[s.length () - 1]; if (c == '{' || c == '}') // brace open is for not confusing dumb tools. here_input ().warning ( - _ ("Brace found at end of lyric. Did you forget a space?")); + _ ("Brace found at end of markup. Did you forget a space?")); yylval.scm = scm_makfrom0str (s.to_str0 ()); return STRING; } - {WHITE} { - - } - . { - return YYText ()[0]; + . { + return YYText()[0]; } } diff --git a/lily/lookup.cc b/lily/lookup.cc index 8fd4b2fb13..9eeb6cbdb9 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -166,7 +166,7 @@ Lookup::filledbox (Box b) * Box extent(X_AXIS) */ Molecule -Lookup::roundfilledbox (Box b, Real blotdiameter) +Lookup::round_filled_box (Box b, Real blotdiameter) { if (b.x ().length () < blotdiameter) { @@ -179,7 +179,7 @@ Lookup::roundfilledbox (Box b, Real blotdiameter) blotdiameter = b.y ().length (); } - SCM at = (scm_list_n (ly_symbol2scm ("roundfilledbox"), + SCM at = (scm_list_n (ly_symbol2scm ("round-filled-box"), gh_double2scm (-b[X_AXIS][LEFT]), gh_double2scm (b[X_AXIS][RIGHT]), gh_double2scm (-b[Y_AXIS][DOWN]), @@ -190,24 +190,6 @@ Lookup::roundfilledbox (Box b, Real blotdiameter) return Molecule (b,at); } -LY_DEFINE(ly_round_filled_box, "ly:round-filled-box", - 2, 0,0, - (SCM b, SCM blot), - "Make a box with rounded corners. B is a pair of number-pairs, and BLOT a number") -{ - SCM_ASSERT_TYPE(gh_number_p (blot), blot, SCM_ARG2, __FUNCTION__, "number") ; - SCM_ASSERT_TYPE(gh_pair_p (b), b, SCM_ARG4, __FUNCTION__, "pair") ; - - SCM_ASSERT_TYPE(ly_number_pair_p (gh_car (b)), gh_car (b), SCM_ARG1, __FUNCTION__, "number-pair") ; - SCM_ASSERT_TYPE(ly_number_pair_p (gh_cdr (b)), gh_cdr (b), SCM_ARG1, __FUNCTION__, "number-pair") ; - - Interval x (ly_scm2interval (gh_car (b))); - Interval y (ly_scm2interval (gh_cdr (b))); - - return Lookup::roundfilledbox (Box (x,y), - gh_scm2double (blot)).smobbed_copy(); - -} /* @@ -770,4 +752,19 @@ LY_DEFINE(ly_bracket ,"ly:bracket", gh_scm2double (t), gh_scm2double (p)).smobbed_copy (); } - + + + +LY_DEFINE(ly_filled_box ,"ly:round-filled-box", + 3, 0, 0, + (SCM xext, SCM yext, SCM blot), + "Make a filled-box of dimensions @var{xext}, @var{yext} and roundness @var{blot}.") +{ + SCM_ASSERT_TYPE(ly_number_pair_p (xext), xext, SCM_ARG1, __FUNCTION__, "number pair") ; + SCM_ASSERT_TYPE(ly_number_pair_p (yext), yext, SCM_ARG2, __FUNCTION__, "number pair") ; + SCM_ASSERT_TYPE(gh_number_p (blot), blot, SCM_ARG3, __FUNCTION__, "number") ; + + return Lookup::round_filled_box (Box (ly_scm2interval (xext), ly_scm2interval (yext)), + gh_scm2double (blot)).smobbed_copy (); +} + diff --git a/lily/mensural-ligature.cc b/lily/mensural-ligature.cc index a60e2fe5ed..f62e3c29ca 100644 --- a/lily/mensural-ligature.cc +++ b/lily/mensural-ligature.cc @@ -230,7 +230,7 @@ internal_brew_primitive (Grob *me, bool ledger_take_space) Interval (0, -join_left * 0.5 * staff_space); Box stem_box (x_extent, y_extent); - Molecule stem = Lookup::roundfilledbox (stem_box, blotdiameter); + Molecule stem = Lookup::round_filled_box (stem_box, blotdiameter); out.add_molecule (stem); } diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index 48f08e8e98..c69f23c5fa 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -93,7 +93,13 @@ static Keyword_ent the_key_tab[]={ My_lily_lexer::My_lily_lexer () { + // yy_flex_debug = 1; + keytable_ = new Keyword_table (the_key_tab); + + chordmodifier_tab_ = scm_make_vector (gh_int2scm (1), SCM_EOL); + pitchname_tab_ = scm_make_vector (gh_int2scm (1), SCM_EOL); + scopes_ = SCM_EOL; add_scope(ly_make_anonymous_module()); diff --git a/lily/note-head.cc b/lily/note-head.cc index b52a9a5ea1..4c291ae32d 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -86,7 +86,7 @@ Note_head::brew_ledger_lines (Grob *me, Box ledger_line (x_extent, y_extent); Molecule proto_ledger_line = - Lookup::roundfilledbox (ledger_line, blotdiameter); + Lookup::round_filled_box (ledger_line, blotdiameter); if (!take_space) proto_ledger_line.set_empty (true); diff --git a/lily/parser.yy b/lily/parser.yy index 6ff5a07dc4..5a7119fba2 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -10,7 +10,7 @@ */ /* - Two shift/reduce problems: + Four shift/reduce problems: 1. foo = bar. @@ -19,6 +19,12 @@ "bar" -> String -> string-assignment +Similar problem for + + * \markup identifier. + * \markup { } + + 2. \repeat \repeat .. \alternative @@ -291,7 +297,8 @@ yylex (YYSTYPE *s, void * v) %type exclamations questions dots optional_rest %type bass_mod -%type grace_head +%type grace_head +%type lyric_element %type bass_number br_bass_figure bass_figure figure_list figure_spec %token DIGIT %token NOTENAME_PITCH @@ -2054,8 +2061,11 @@ simple_element: scm_gc_protect_object (mus); $$ = unsmob_music (mus); } - | STRING optional_notemode_duration { + + | lyric_element optional_notemode_duration { Input i = THIS->pop_spot (); + if (!THIS->lexer_->lyric_state_b ()) + THIS->parser_error (_ ("Have to be in Lyric mode for lyrics")); Music * lreq = MY_MAKE_MUSIC("LyricEvent"); lreq->set_mus_property ("text", $1); @@ -2075,6 +2085,11 @@ simple_element: } ; +lyric_element: + full_markup { $$ = $1 } + | STRING { $$ = $1 ; } + ; + new_chord: steno_tonic_pitch optional_notemode_duration { $$ = make_chord ($1, $2, SCM_EOL); diff --git a/lily/vaticana-ligature.cc b/lily/vaticana-ligature.cc index 9a99e09943..c58ca37c8b 100644 --- a/lily/vaticana-ligature.cc +++ b/lily/vaticana-ligature.cc @@ -263,7 +263,7 @@ vaticana_brew_primitive (Grob *me, bool ledger_take_space) Interval (0, -delta_pitch * 0.5 * staff_space); // descending join Box stem_box (x_extent, y_extent); - Molecule stem = Lookup::roundfilledbox (stem_box, blotdiameter); + Molecule stem = Lookup::round_filled_box (stem_box, blotdiameter); out.add_molecule (stem); } else diff --git a/ly/init.ly b/ly/init.ly index 4608c01120..00084e627e 100644 --- a/ly/init.ly +++ b/ly/init.ly @@ -1,5 +1,7 @@ % Toplevel initialisation file. + + #(define-public point-and-click #f) #(define-public midi-debug #f) @@ -9,6 +11,7 @@ \include "declarations-init.ly" + #(ly:set-option 'new-relative) #(ly:set-point-and-click #f) diff --git a/ly/nederlands.ly b/ly/nederlands.ly index b54f851206..15e7f03e34 100644 --- a/ly/nederlands.ly +++ b/ly/nederlands.ly @@ -47,3 +47,10 @@ + +foo= \notes { + <>-\markup { \normal-size-super + % \override #'(font-family . math) "N" } + \override #'(font-family . math) "M" } +} + diff --git a/scm/lily.scm b/scm/lily.scm index 5118e58110..99e601fdbb 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -232,10 +232,15 @@ L1 is copied, L2 not. (remainder (+ a 1) 2)) -(define-public (widen-interval iv amount) +(define-public (interval-widen iv amount) (cons (- (car iv) amount) - (+ (cdr iv) amount)) -) + (+ (cdr iv) amount))) + + +(define-public (interval-union i1 i2) + (cons (min (car i1) (car i2)) + (max (cdr i1) (cdr i2)))) + (define-public (write-me message x) "Return X. Display MESSAGE and write X. Handy for debugging, possibly turned off." diff --git a/scm/molecule.scm b/scm/molecule.scm index 0c5510179b..fb604872ed 100644 --- a/scm/molecule.scm +++ b/scm/molecule.scm @@ -22,8 +22,7 @@ (stack-lines dir padding baseline (cdr mols)) padding baseline ) - ) - )) + ))) (define-public (fontify-text font-metric text) "Set TEXT with font FONT-METRIC, returning a molecule." @@ -35,11 +34,9 @@ (define-public (bracketify-molecule mol axis thick protusion padding) "Add brackets around MOL, producing a new molecule." - (let* ( - (ext (ly:molecule-get-extent mol axis)) + (let* ((ext (ly:molecule-get-extent mol axis)) (lb (ly:bracket axis ext thick (- protusion))) - (rb (ly:bracket axis ext thick protusion)) - ) + (rb (ly:bracket axis ext thick protusion))) (set! mol (ly:molecule-combine-at-edge mol (other-axis axis) 1 lb padding)) (set! mol (ly:molecule-combine-at-edge mol (other-axis axis) -1 rb padding)) mol @@ -73,9 +70,9 @@ encloses the contents. (define-public (box-molecule mol thick padding) "Add a box around MOL, producing a new molecule." (let* ( - (x-ext (widen-interval (ly:molecule-get-extent mol 0) padding)) - (y-ext (widen-interval (ly:molecule-get-extent mol 1) padding)) - (x-rule (make-filled-box-molecule (widen-interval x-ext thick) + (x-ext (interval-widen (ly:molecule-get-extent mol 0) padding)) + (y-ext (interval-widen (ly:molecule-get-extent mol 1) padding)) + (x-rule (make-filled-box-molecule (interval-widen x-ext thick) (cons 0 thick))) (y-rule (make-filled-box-molecule (cons 0 thick) y-ext))) diff --git a/scm/new-markup.scm b/scm/new-markup.scm index 03b3e1f0cf..aa5b5697c1 100644 --- a/scm/new-markup.scm +++ b/scm/new-markup.scm @@ -73,6 +73,10 @@ for the reader. ) (define-public (line-markup grob props . rest) + "A horizontal line of markups. Syntax: +\\line << MARKUPS >> +" + (stack-molecule-line (cdr (chain-assoc 'word-space props)) (map (lambda (x) (interpret-markup grob props x)) (car rest))) @@ -191,8 +195,32 @@ for the reader. grob props (cadr rest)) - (car rest) Y) - ) + (car rest) Y)) + +(define-public (fraction-markup grob props . rest) + "Syntax: \\fraction MARKUP1 MARKUP2." + + (let* + ((m1 (interpret-markup grob props (car rest))) + (m2 (interpret-markup grob props (cadr rest)))) + + (ly:molecule-align-to! m1 X CENTER) + (ly:molecule-align-to! m2 X CENTER) + + (let* + ((x1 (ly:molecule-get-extent m1 X)) + (x2 (ly:molecule-get-extent m2 X)) + (line (ly:round-filled-box (interval-union x1 x2) '(-0.05 . 0.05) 0.0)) + + ;; should stack mols separately, to maintain LINE on baseline + (stack (stack-lines -1 0.2 0.6 (list m1 line m2)))) + + (ly:molecule-align-to! stack Y CENTER) + (ly:molecule-align-to! stack X LEFT) + ;; should have EX dimension + ;; empirical anyway + (ly:molecule-translate-axis stack 0.75 Y) + ))) (define-public (note-markup grob props . rest) @@ -213,10 +241,10 @@ for the reader. 0)) (attachy (* dir 0.28)) (stemgl (if (> log 0) - (ly:round-filled-box (cons + (ly:round-filled-box (cons attachx (+ attachx stemth)) (cons (min stemy attachy) - (max stemy attachy))) + (max stemy attachy)) (/ stemth 3) ) #f)) (dot (ly:find-glyph-by-name font "dots-dot")) @@ -544,6 +572,7 @@ for the reader. (cons hbracket-markup (list markup?)) (cons bracket-markup (list markup?)) (cons note-markup (list integer? integer? ly:dir?)) + (cons fraction-markup (list markup? markup?)) (cons column-markup (list markup-list?)) (cons dir-column-markup (list markup-list?)) diff --git a/scm/output-ascii-script.scm b/scm/output-ascii-script.scm index db24d96eb0..03375c89e4 100644 --- a/scm/output-ascii-script.scm +++ b/scm/output-ascii-script.scm @@ -117,7 +117,7 @@ (if (<= dy 1) "-" "=")) (func "h-line" dx)))))) -(define (roundfilledbox breapth width depth height blot) +(define (round-filled-box breapth width depth height blot) (filledbox breapth width depth height)) (define (draw-line thick x1 y1 x2 y2) diff --git a/scm/output-lib.scm b/scm/output-lib.scm index 13fbfe9bd1..84e45228e4 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -77,9 +77,9 @@ (let* ( (mol (callback grob)) - (x-ext (widen-interval (ly:molecule-get-extent mol 0) x-padding)) - (y-ext (widen-interval (ly:molecule-get-extent mol 1) y-padding)) - (x-rule (make-filled-box-molecule (widen-interval x-ext line-thick) + (x-ext (interval-widen (ly:molecule-get-extent mol 0) x-padding)) + (y-ext (interval-widen (ly:molecule-get-extent mol 1) y-padding)) + (x-rule (make-filled-box-molecule (interval-widen x-ext line-thick) (cons 0 line-thick))) (y-rule (make-filled-box-molecule (cons 0 line-thick) y-ext)) ) diff --git a/scm/output-pdf.scm b/scm/output-pdf.scm index eaaca5fa5b..96153a63cc 100644 --- a/scm/output-pdf.scm +++ b/scm/output-pdf.scm @@ -142,7 +142,7 @@ (ly:number->string (+ depth height)) " re f ")) -(define (roundfilledbox breadth width depth height blotdiam) +(define (round-filled-box breadth width depth height blotdiam) (let* ((rad (/ blotdiam 2)) (h (- height rad)) (d (- depth rad)) @@ -173,7 +173,7 @@ "f ")) -(define (roundfilledbox breadth width depth height blot) +(define (round-filled-box breadth width depth height blot) (filledbox breadth width depth height)) (define (font-def i s) "") diff --git a/scm/output-pdftex.scm b/scm/output-pdftex.scm index f89cda7c9d..1a325fc2c4 100644 --- a/scm/output-pdftex.scm +++ b/scm/output-pdftex.scm @@ -227,8 +227,8 @@ (ly:number->string depth) "}{" (ly:number->string height) "}")) -(define (roundfilledbox x y width height blotdiam) - (embedded-pdf (list 'roundfilledbox x y width height blotdiam))) +(define (round-filled-box x y width height blotdiam) + (embedded-pdf (list 'round-filled-box x y width height blotdiam))) (define (text s) (string-append "\\hbox{" (output-tex-string s) "}")) diff --git a/scm/output-ps.scm b/scm/output-ps.scm index 22a9c91107..bd5a5df1f2 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -266,7 +266,7 @@ (numbers->string (list wid slope thick)) " draw_repeat_slash")) -(define (roundfilledbox x y width height blotdiam) +(define (round-filled-box x y width height blotdiam) (string-append " " (numbers->string diff --git a/scm/output-sketch.scm b/scm/output-sketch.scm index c5fcd6c985..86cf11c949 100644 --- a/scm/output-sketch.scm +++ b/scm/output-sketch.scm @@ -63,7 +63,7 @@ ; ((eq? keyword 'placebox) ; (dispatch (+ x (cadr expr)) (+ y (caddr expr) (cadddr expr)))) ; ((eq? keyword 'repeat-slash wid slope thick) -; ((eq? keyword 'roundfilledbox x y dx dy w h b) +; ((eq? keyword 'round-filled-box x y dx dy w h b) ; ((eq? keyword 'select-font name-mag-pair) ; ((eq? keyword 'start-system width height) ; ((eq? keyword 'stem x y z w) (filledbox x y z w)) @@ -180,7 +180,7 @@ "") -(define (roundfilledbox x y dx dy w h b) +(define (round-filled-box x y dx dy w h b) (sketch-filled-rectangle w 0 0 h x y)) (define (polygon points blotdiameter) "") ;; TODO diff --git a/scm/output-sodipodi.scm b/scm/output-sodipodi.scm index 23afde99a6..a141026597 100644 --- a/scm/output-sodipodi.scm +++ b/scm/output-sodipodi.scm @@ -258,7 +258,7 @@ ; (draw-line th x1 0 x2 0)) (define (filledbox breapth width depth height) - (roundfilledbox breapth width depth height line-thickness)) + (round-filled-box breapth width depth height line-thickness)) (define font-cruft "fill:black;stroke:none;text-anchor:start;writing-mode:lr;font-weight:normal;") @@ -333,7 +333,7 @@ (number->string (- 0 (* output-scale y))) ")")))) -(define (roundfilledbox breapth width depth height blot-diameter) +(define (round-filled-box breapth width depth height blot-diameter) (tagify "rect" "" ;;'(style . "fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;") `(style . ,(format "fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-opacity:1;stroke-width:~f;stroke-linejoin:miter;stroke-linecap:butt;" line-thickness)) diff --git a/scm/output-tex.scm b/scm/output-tex.scm index 38612c8a08..9d015948c1 100644 --- a/scm/output-tex.scm +++ b/scm/output-tex.scm @@ -249,8 +249,8 @@ (ly:number->string depth) "}{" (ly:number->string height) "}"))) -(define (roundfilledbox x y width height blotdiam) - (embedded-ps (list 'roundfilledbox x y width height blotdiam))) +(define (round-filled-box x y width height blotdiam) + (embedded-ps (list 'round-filled-box x y width height blotdiam))) (define (text s) (string-append "\\hbox{" (output-tex-string s) "}")) -- 2.39.2