From d5eeec223e9eecd780ee7be5de5730b20164b703 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 22:43:29 +0000 Subject: [PATCH] lilypond-1.3.6 --- TODO | 72 ++--- buildscripts/set-lily.sh | 2 + lily/all-font-metrics.cc | 54 +++- lily/atom.cc | 18 +- lily/bar-number-engraver.cc | 2 +- lily/bar-script-engraver.cc | 2 +- lily/bar.cc | 2 + lily/base-span-bar-engraver.cc | 2 +- lily/beam.cc | 20 +- lily/break-align-item.cc | 8 +- lily/chord.cc | 11 +- lily/clef-engraver.cc | 2 +- lily/clef-item.cc | 3 +- lily/collision.cc | 2 - lily/dots.cc | 21 +- lily/font-metric.cc | 100 +++++++ lily/grace-align-item.cc | 5 +- lily/include/all-font-metrics.hh | 44 ++++ lily/include/atom.hh | 12 +- lily/include/dots.hh | 6 +- lily/include/font-metric.hh | 26 +- lily/include/lily-guile.hh | 8 +- lily/include/lily-proto.hh | 1 + lily/include/local-key-item.hh | 11 +- lily/include/lookup.hh | 5 - lily/include/ly-smobs.icc | 3 +- lily/include/note-head.hh | 3 + lily/include/paper-def.hh | 2 +- lily/include/paper-outputter.hh | 13 +- lily/include/staff-symbol-referencer.hh | 3 +- lily/include/tfm-reader.hh | 7 +- lily/include/tfm.hh | 2 +- lily/key-engraver.cc | 2 +- lily/key-item.cc | 5 +- lily/key.cc | 2 - lily/lily-guile.cc | 28 +- lily/local-key-item.cc | 20 +- lily/lookup.cc | 201 ++++++-------- lily/main.cc | 2 +- lily/mark-engraver.cc | 2 +- lily/multi-measure-rest.cc | 6 +- lily/my-lily-lexer.cc | 3 +- lily/note-head.cc | 44 +++- lily/note-heads-engraver.cc | 7 - lily/paper-def.cc | 58 ++-- lily/paper-outputter.cc | 142 +++++----- lily/paper-score.cc | 69 +++-- lily/rest.cc | 9 +- lily/scope.cc | 6 +- lily/score-element.cc | 8 +- lily/script-engraver.cc | 2 +- lily/script.cc | 4 +- lily/separating-line-group-engraver.cc | 2 +- lily/staff-margin-engraver.cc | 2 +- lily/staff-performer.cc | 4 +- lily/staff-symbol-referencer.cc | 17 +- lily/stem-info.cc | 14 +- lily/stem-tremolo.cc | 4 +- lily/tfm-reader.cc | 103 ++++---- lily/tfm.cc | 7 - lily/translator-group.cc | 2 +- lily/translator.cc | 2 +- ly/init.fly | 2 +- ly/paper11.ly | 2 + .../J.S.Bach/Petites-Preludes/preludes-1.ly | 158 ++++++----- .../J.S.Bach/Petites-Preludes/preludes-2.ly | 70 ++--- .../J.S.Bach/Petites-Preludes/preludes-3.ly | 33 ++- .../J.S.Bach/Petites-Preludes/preludes-4.ly | 196 ++++++++------ .../J.S.Bach/Petites-Preludes/preludes-5.ly | 248 ++++++++++-------- .../J.S.Bach/Petites-Preludes/preludes-6.ly | 123 +++++---- .../Petites-Preludes/preludes-score.ly | 2 +- mutopia/J.S.Bach/wtk1-fugue2.ly | 3 +- scm/generic-property.scm | 15 +- scm/lily.scm | 141 ++++++---- tex/lilyponddefs.tex | 8 - 75 files changed, 1306 insertions(+), 944 deletions(-) create mode 100644 lily/font-metric.cc create mode 100644 lily/include/all-font-metrics.hh diff --git a/TODO b/TODO index 23f829958f..1b7b210072 100644 --- a/TODO +++ b/TODO @@ -9,8 +9,10 @@ Most of the items are marked in the code as well Grep -i for TODO, FIXME and ugh/ugr/urg. .* TODO -. * make this file understandable for 3rd parties. -. * break align order from SCM list. +. * agressive type-checking for SCM stuff. +. * TODO^2: +. *make a TODO.texi, like http://www.gnu.org/software/guile/ideas.html +. * make this file understandable for 3rd parties. . * \accepts -> \acceptedby . * context in embedded SCM errors. . * eradicate all VIRTUAL_COPY_CONS () macros ; use indexed creation, @@ -18,7 +20,6 @@ Grep -i for TODO, FIXME and ugh/ugr/urg. ctor_dict["Score_element"]->clone_func (orig); ctor_dict["Score_element"]->create_func (); - . * acc at tied note after linebreak. . * fix font-naming and selecting . * fix naming: \interline Context.staffLineLeading, staff_line_leading (), @@ -26,27 +27,22 @@ staff_position staff_space . * chord tonic: placement of accidental C#, Cb (from scm and C++) . * note head on stem err msg in dutch. . * why need to run -C mf twice? -. * setting indent to 0 with \shape fails . * here's no difference at all in output. When either is jacked up to 7.0, everything works and matches up; when either is set just a bit above the default 5.0 (5.4 is what I was hoping to use), stems miss note heads. So it's some sort of a numerical (truncation/roundoff) problem. John +. * fix #'margin-shape; setting indent to 0 with \shape fails . * Fixed size staff/system heights; -. * ly2dvi : don't repeat opus if same. -. * breaks before mmrests are favored. -. * hara kiri _8 clef. -. * junk -M ? +. * +. * ly2dvi : don't repeat opus if same. +. * hara kiri _8 clef. +. * junk -M ? . * mudela-book doco . * fix or replace feta-accordion.mf . * script engraver . * bracket pdf hack - . * Mondrup: -- I would like an option to define the number of systems on which the -score must be distributed. As it is now it seems that I may only -influence that indirectly through the gourlay_maxmeasures property. - - if I change the property minVerticalAlign in a multi staff score with lyrics the change affects the lyrics too. I would like the change to _only_ affect staves. @@ -67,15 +63,14 @@ ChoirStaff bar line types in the rest of the scores . * make all Feta (including dynamics) available to the user in textual scripts. Examples: "D.S. al \coda", "\mf espress.". -. * Write script that uses --find-old-relative to do auto relativization. +. * Write script that uses --find-old-relative to do auto relativization. . * Junk shared cruft (duration, moment) in lib/ .* Cleanups needed -. * \$ and $ identifier syntax in examples. +. * \$ and $ identifier syntax in examples. . * Junk ghost positioning objects eg, Script leans on Staffside leans on Staff. -. * bracket ps code. . * Key_engraver, Local_key_item . * Think of comprehensive solution for "if (grace_b == self_grace_b_)" . * String[String.length] doesn't trap. @@ -87,6 +82,12 @@ ChoirStaff bar line types in the rest of the scores . * junk Music_iterator::first_b_ . * Bezier +.* ACCIDENTALS +. * half-sharps, half-flats +. * adaptive accidental spacing. +. * accidentals closer to note head + + .* Beams . * [c8. c16 c16 c16] in 6/8 timesig. . * Rewrite Stem, Beam (hairy) @@ -123,13 +124,9 @@ singer knows where to break the words. In bar 27, there's a crescendo that's supposed to start at the start of the grace notes and extend to the note after the grace notes. -. * 5. Sometimes lyrics extend past the right end of the staff. I guess that -this is a similar problem (if not another symptom of the same problem) as -one of the spacing bugs mentioned in the TODO. -. * 4. Lyrics and grace sections don't go too well together. - The words are aligned with the main note, not the start of the - grace note. This is usually wrong, but is sometimes right. -. * decimal point in \paper {} +. * 4. Lyrics and grace sections don't go too well together. + The words are aligned with the main note, not the start of the + grace note. This is usually wrong, but is sometimes right. . * tie-direction . * repeats and partial measures. . * rhythmic staff & accidentals. @@ -152,7 +149,6 @@ one of the spacing bugs mentioned in the TODO. . * Matanya's tips: . * don't shorten stems/staffs closer to each other. -. * accidentals closer to note head . * to space the staffs/staffgroups contained in the score. . * heavier beams? @@ -245,8 +241,6 @@ to provide IO handling for TeX stream, mudela stream, data-file. . * split error/warning in error/warning/non_fatal_error . * add a Duration_convert member to Duration_iter to set parameters. Junk global duration settings. -. * en-,discouraged linebreaking: -. * handle DISALLOW < penalty > FORCE . * discourage breaking of slurs . * fix variable define/lookup parser global<->paper . * fix title/instrument placements; see input/test/title.ly @@ -254,16 +248,12 @@ to provide IO handling for TeX stream, mudela stream, data-file. . * I'd like to change the \repetitions command to Jan's suggested syntax: \repeat "repeatsymbol" 2 {...}, but I'm not sure that I understand the implementation of repeats well enough. -. * add full cello suites to web site (kom op, Maarten!) . * add mudela-book-doc source to webstie. -. * Rethink Time_description -\cadenza , \meter, should all be \properties . * fix singleStaffBracket . * rename . * partial -> anacrouse . * move paper vars into engraver properties . * add new glyphs to font.ly -. * check for groff / troff/ nroff et . * more intelligent file searching . * disable spaces in TeX stuff . * handle ^C for tmp/file creation. @@ -274,7 +264,7 @@ to provide IO handling for TeX stream, mudela stream, data-file. touching it. . * put errorlevel in Input class . * junk nesting slurs -. * distinguish between unset and empty properties. + .* FONT . * the bracket is ugly (wings are too parabolic, should be more circular) @@ -331,14 +321,16 @@ touching it. . * patch: don't touch timestamp if all patches fail. . * MetaPost: should not generate setgray for unfill -. * mfplain.ini not in tetex 0.9 + . * mf-to-table -> add space 'before ; in AFM output. (-> check AFM spec. Is this a bug in afm2tfm?) . * check out GCC signatures? . * glibc 2.0: f = fopen ("/dev/null", "r") assert (feof (f)) -. * tetex: mfplain.mem +. * tetex: mfplain.mem -> INSTALL +. * mfplain.ini not in tetex 0.9 -> INSTALL + .* PROJECTS . * Scripts: @@ -350,7 +342,6 @@ spec. Is this a bug in afm2tfm?) . * stack parameterised scripts for fingering and footing: . * convert-mudela: -. * automatically add a \version if not present. . * better parsing . * make smarter . * convert-mudela -e empty.ly @@ -364,7 +355,6 @@ spec. Is this a bug in afm2tfm?) . * use properties for: . * default tempo. -. * cadenza mode? . * page handling: . * PS output @@ -390,6 +380,7 @@ spec. Is this a bug in afm2tfm?) . * \header . * output header info to MIDI too. +. * dump \header into easily parsable format. . * a musical dictionary. See Documentation/vocabulary-*, other languages: @@ -465,6 +456,7 @@ hesitate to ask. . * speed up PS code. . * PS lines to .eps files . * write custom prolog +. * fix ps font switching . * more spanners (smallish) . * Glissando @@ -485,7 +477,6 @@ hesitate to ask. . * should adjust stemlength for flag number. . * breaking: -. * saving them . * specify number of lines .* INPUTLANGUAGE @@ -504,15 +495,10 @@ hesitate to ask. .* SMALLISH PROJECTS -. * A range for context errors (eg. mark both { and }. ) - . * lyric in staff (sharpsharp in staff, text below) . * write Dynamic_line (to group dynamics horizontally) -. * half-sharps, half-flats - -. * adaptive accidental spacing. . * handle EOF graciously in error messages. @@ -529,15 +515,13 @@ hesitate to ask. (where "to" is a tiny bow) . * auxilliary file for caching info. + . * Text_crescendo .* IDEAS . * Output data structures of Mudela in XML/SGML. . * create libmudela, or liblily_frontend . * move MIDI stuff (including Quantization) to a ANSI C libmidi library. -. * Spacing_request for manually adjusting spacing -. * caching breakpoints -. * used fixedpoint arithmetic for min. energy. * OUTLINE SETUP .* .EMACS diff --git a/buildscripts/set-lily.sh b/buildscripts/set-lily.sh index 15e4633b78..199d1a5c5b 100644 --- a/buildscripts/set-lily.sh +++ b/buildscripts/set-lily.sh @@ -99,3 +99,5 @@ echo Starting configuration echo (set -x; TEX_TFMDIR=$TEX_TFMDIR ./configure --prefix=$prefix --enable-debugging --enable-printing --enable-checking --disable-optimise) +echo "making tags in background" +make TAGS >& log & diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc index 0ecfbf4420..eddad21ed0 100644 --- a/lily/all-font-metrics.cc +++ b/lily/all-font-metrics.cc @@ -1,10 +1,21 @@ +/* + all-font-metrics.cc -- implement All_font_metrics + + source file of the GNU LilyPond music typesetter + + (c) 1999 Han-Wen Nienhuys + + */ #include "main.hh" -#include "all-fonts.hh" +#include "all-font-metrics.hh" #include "debug.hh" #include "warn.hh" #include "afm.hh" #include "tfm.hh" +#include "dictionary-iter.hh" +#include "lily-guile.hh" +#include "tfm-reader.hh" const char * default_font_sz_ = "cmr10"; @@ -26,6 +37,9 @@ All_font_metrics::find_afm (String name) *mlog << "[" << path; Adobe_font_metric * afm_p = new Adobe_font_metric (read_afm_file (path)); + + afm_p->name_str_ = name; + *mlog << "]" << flush ; afm_p_dict_[name] = afm_p; @@ -33,6 +47,22 @@ All_font_metrics::find_afm (String name) return afm_p_dict_[name]; } +Scaled_font_metric * +All_font_metrics::find_scaled (String nm, int m) +{ + Scaled_font_metric * s=0; + String index = nm + "@" + to_str (m); + if (!scaled_p_dict_.elem_b (index)) + { + Font_metric *f = find_font (nm); + s = new Scaled_font_metric (f, m); + scaled_p_dict_[index] = s; + return s; + } + else + return scaled_p_dict_[index]; +} + Tex_font_metric * All_font_metrics::find_tfm (String name) { @@ -42,10 +72,11 @@ All_font_metrics::find_tfm (String name) path = search_path_.find (path); if (path.empty_b ()) return 0; - + *mlog << "[" << path; - Tex_font_metric * tfm_p = new Tex_font_metric; - tfm_p->read_file (path); + Tex_font_metric * tfm_p = Tex_font_metric_reader::read_file (path); + tfm_p->name_str_ = name; + *mlog << "]" << flush ; tfm_p_dict_[name] = tfm_p; @@ -76,3 +107,18 @@ All_font_metrics::find_font (String name) error (_f ("(search path: `%s'", search_path_.str ())); error (_ ("Giving up")); } + +SCM +All_font_metrics::font_descriptions () const +{ + SCM l = SCM_EOL; + for (Dictionary_iter ai(afm_p_dict_); ai.ok (); ai++) + l = gh_cons (ai.val ()->description (), l); + for (Dictionary_iter ai(tfm_p_dict_); ai.ok (); ai++) + l = gh_cons(ai.val ()->description (), l); + + for (Dictionary_iter ai(scaled_p_dict_); ai.ok (); ai++) + l = gh_cons (ai.val ()->description (),l); + + return l; +} diff --git a/lily/atom.cc b/lily/atom.cc index c222778aba..e71f371a3f 100644 --- a/lily/atom.cc +++ b/lily/atom.cc @@ -15,9 +15,25 @@ #include "lookup.hh" #include "main.hh" #include "global-ctor.hh" +#include "font-metric.hh" Atom::Atom(SCM s) { func_ = s; - magn_ = gh_int2scm (0); +} + +void +Atom::fontify (Font_metric * met) +{ + + SCM desc = ly_quote_scm (met->description ()); + SCM font_switch = gh_list (ly_symbol2scm ("select-font"), + desc, + SCM_UNDEFINED); + + SCM f =func_; + func_ = gh_list (ly_symbol2scm ("string-append"), + font_switch , f, + SCM_UNDEFINED); + } diff --git a/lily/bar-number-engraver.cc b/lily/bar-number-engraver.cc index c8a0aa01bb..e28939ca67 100644 --- a/lily/bar-number-engraver.cc +++ b/lily/bar-number-engraver.cc @@ -18,7 +18,7 @@ Bar_number_engraver::Bar_number_engraver() axis_ = Y_AXIS; type_ = "barNumber"; visibility_lambda_ - = ly_ch_C_eval_scm ("postbreak-only-visibility"); + = ly_eval_str ("postbreak-only-visibility"); } void diff --git a/lily/bar-script-engraver.cc b/lily/bar-script-engraver.cc index c8becdc046..627ca68fc6 100644 --- a/lily/bar-script-engraver.cc +++ b/lily/bar-script-engraver.cc @@ -25,7 +25,7 @@ Bar_script_engraver::Bar_script_engraver () text_p_ =0; hang_on_clef_b_ = false; visibility_lambda_ - = ly_ch_C_eval_scm ("non-postbreak-visibility"); + = ly_eval_str ("non-postbreak-visibility"); } void diff --git a/lily/bar.cc b/lily/bar.cc index f2d3d187ea..ad6fb103f4 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -76,6 +76,8 @@ Bar::do_pre_processing () break; } } + + if (remove_elt_property ("at-line-start") == SCM_BOOL_T // UGR. && (break_status_dir () == RIGHT) && (type_str_ == "")) { diff --git a/lily/base-span-bar-engraver.cc b/lily/base-span-bar-engraver.cc index 5b3ea4437e..13e43b22af 100644 --- a/lily/base-span-bar-engraver.cc +++ b/lily/base-span-bar-engraver.cc @@ -54,7 +54,7 @@ Base_span_bar_engraver::acknowledge_element (Score_element_info i) String visnam = String(name()) + "-visibility"; spanbar_p_->set_elt_property ("visibility-lambda", - ly_ch_C_eval_scm (visnam.ch_C())); + ly_eval_str (visnam.ch_C())); if (use_priority_b_) { diff --git a/lily/beam.cc b/lily/beam.cc index 64ab8ea41f..c489e8f6e7 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -283,14 +283,14 @@ Beam::get_default_dir () const SCM a = get_elt_property ("beam-dir-algorithm"); - if (a == gh_symbol2scm ("majority")) // should get default from paper. + if (a == ly_symbol2scm ("majority")) // should get default from paper. beam_dir = (count[UP] == count[DOWN]) ? neutral_dir : (count[UP] > count[DOWN]) ? UP : DOWN; - else if (a == gh_symbol2scm ("mean")) + else if (a == ly_symbol2scm ("mean")) // mean center distance beam_dir = (total[UP] == total[DOWN]) ? neutral_dir : (total[UP] > total[DOWN]) ? UP : DOWN; - else if (a == gh_symbol2scm ("median")) + else if (a == ly_symbol2scm ("median")) { // median center distance if (count[DOWN] && count[UP]) @@ -350,7 +350,7 @@ Beam::check_stemlengths_f (bool set_b) { Real interbeam_f = paper_l ()->interbeam_f (multiple_i_); - Real beam_f = paper_l ()->get_var ("beam_thickness");; + Real beam_f = gh_scm2double (get_elt_property ("beam-thickness")); Real staffline_f = paper_l ()-> get_var ("stafflinethickness"); Real epsilon_f = staffline_f / 8; Real dy_f = 0.0; @@ -515,13 +515,13 @@ Beam::quantise_dy () SCM q = get_elt_property ("slope-quantisation"); - if (q == gh_symbol2scm ("none")) + if (q == ly_symbol2scm ("none")) return; Real interline_f = stems_[0]->staff_line_leading_f (); Real internote_f = interline_f / 2; Real staffline_f = paper_l ()->get_var ("stafflinethickness"); - Real beam_f = paper_l ()->get_var ("beam_thickness");; + Real beam_f = gh_scm2double (get_elt_property ("beam-thickness"));; Real dx_f = stems_.top ()->hpos_f () - stems_[0]->hpos_f (); @@ -574,7 +574,7 @@ Beam::quantise_left_y (bool extend_b) Real space = stems_[0]->staff_line_leading_f (); Real internote_f = space /2; Real staffline_f = paper_l ()->get_var ("stafflinethickness"); - Real beam_f = paper_l ()->get_var ("beam_thickness");; + Real beam_f = gh_scm2double (get_elt_property ("beam-thickness"));; /* [TODO] @@ -603,7 +603,7 @@ Beam::quantise_left_y (bool extend_b) Real beamdy_f = beamdx_f * slope_f_ * internote_f; Array allowed_position; - if (q == gh_symbol2scm ("normal")) + if (q == ly_symbol2scm ("normal")) { if ((multiple_i_ <= 2) || (abs (beamdy_f) >= staffline_f / 2)) allowed_position.push (straddle); @@ -611,7 +611,7 @@ Beam::quantise_left_y (bool extend_b) allowed_position.push (sit); allowed_position.push (hang); } - else if (q == gh_symbol2scm ("traditional")) + else if (q == ly_symbol2scm ("traditional")) { // TODO: check and fix TRADITIONAL if ((multiple_i_ <= 2) || (abs (beamdy_f) >= staffline_f / 2)) @@ -707,7 +707,7 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const Real interbeam_f = paper_l ()->interbeam_f (multiple_i_); Real internote_f = here->staff_line_leading_f ()/2; - Real beam_f = paper_l ()->get_var ("beam_thickness");; + Real beam_f = gh_scm2double (get_elt_property ("beam-thickness"));; Real dy = interbeam_f; Real stemdx = staffline_f; diff --git a/lily/break-align-item.cc b/lily/break-align-item.cc index dd6ab6490d..1d6c6cb891 100644 --- a/lily/break-align-item.cc +++ b/lily/break-align-item.cc @@ -17,8 +17,6 @@ /* Handle spacing for prefatory matter. - - TODO: rewrite this. It is kludgy */ @@ -68,7 +66,7 @@ Break_align_item::do_pre_processing() next_origin = ly_str02scm ("begin-of-note"); SCM extra_space - = scm_eval (scm_listify (ly_symbol ("break-align-spacer"), + = scm_eval (scm_listify (ly_symbol2scm ("break-align-spacer"), current_origin, next_origin, SCM_UNDEFINED)); SCM symbol = SCM_CAR (extra_space); Real spc = gh_scm2double (SCM_CADR(extra_space)); @@ -113,12 +111,12 @@ Break_align_item::do_pre_processing() Real stretch_distance =0.; - if (SCM_CAR (symbol_list) == gh_symbol2scm ("extra-space")) + if (SCM_CAR (symbol_list) == ly_symbol2scm ("extra-space")) { spring_len += dists.top (); stretch_distance = dists.top (); } - else if (SCM_CAR (symbol_list) == gh_symbol2scm ("minimum-space")) + else if (SCM_CAR (symbol_list) == ly_symbol2scm ("minimum-space")) { spring_len = spring_len >? dists.top (); stretch_distance = spring_len; diff --git a/lily/chord.cc b/lily/chord.cc index f6e1341d9e..30a5ae9300 100644 --- a/lily/chord.cc +++ b/lily/chord.cc @@ -485,7 +485,7 @@ Chord::ly_text2molecule (SCM scm) const Molecule Chord::pitch2molecule (Musical_pitch p) const { - SCM name = scm_eval (gh_list (gh_symbol2scm ("user-pitch-name"), ly_quote_scm (pitch2scm (p)), SCM_UNDEFINED)); + SCM name = scm_eval (gh_list (ly_symbol2scm ("user-pitch-name"), ly_quote_scm (pitch2scm (p)), SCM_UNDEFINED)); if (name != SCM_UNSPECIFIED) { @@ -493,9 +493,14 @@ Chord::pitch2molecule (Musical_pitch p) const } Molecule mol = lookup_l ()->text ("", p.str ().left_str (1).upper_str (), paper_l ()); + + /* + We want the smaller size, even if we're big ourselves. + */ if (p.accidental_i_) mol.add_at_edge (X_AXIS, RIGHT, - paper_l ()->lookup_l (-2)->accidental (p.accidental_i_, 0), 0); + + paper_l ()->lookup_l (-2)->afm_find (String ("accidentals-") + to_str (p.accidental_i_)), 0.0); return mol; } @@ -533,7 +538,7 @@ Chord::user_chord_name (Array pitch_arr, Chord_name* name_p) cons for (int i= chord_type.size (); i--; ) chord = gh_cons (pitch2scm (chord_type[i]), chord); - SCM name = scm_eval (gh_list (gh_symbol2scm ("user-chord-name"), ly_quote_scm (chord), SCM_UNDEFINED)); + SCM name = scm_eval (gh_list (ly_symbol2scm ("user-chord-name"), ly_quote_scm (chord), SCM_UNDEFINED)); if (name != SCM_UNSPECIFIED) { name_p->modifier_mol = ly_text2molecule (gh_car (name)); diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index 3d33c6cc7e..452fda6c67 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -116,7 +116,7 @@ Clef_engraver::acknowledge_element (Score_element_info info) create_clef(); if(!default_clef) clef_p_->set_elt_property("visibility-lambda", - ly_ch_C_eval_scm ("all-visibility")); + ly_eval_str ("all-visibility")); } /* ugh; should make Clef_referenced baseclass */ diff --git a/lily/clef-item.cc b/lily/clef-item.cc index 6503c3a1d5..32a7d93273 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -81,7 +81,8 @@ Clef_item::do_add_processing () Molecule* Clef_item::do_brew_molecule_p() const { - Molecule*output = new Molecule (lookup_l ()->clef (symbol_)); + Molecule*output = new Molecule (lookup_l ()->afm_find (String ("clefs-" + symbol_))); + return output; } diff --git a/lily/collision.cc b/lily/collision.cc index 0c08134b88..48148c21ef 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -52,8 +52,6 @@ Collision::do_pre_processing() This should be done better, probably. - TODO: forced hshift - */ Array< Shift_tup > Collision::automatic_shift () diff --git a/lily/dots.cc b/lily/dots.cc index d4c8e62eed..8eda51a6d2 100644 --- a/lily/dots.cc +++ b/lily/dots.cc @@ -14,25 +14,26 @@ Dots::Dots () { dots_i_ =0; - resolve_dir_ =CENTER; } void Dots::do_post_processing () { - if (!resolve_dir_) - resolve_dir_ = UP; - - if (!(position_i_ % 2)) - position_i_ += resolve_dir_; - if (!dots_i_) { set_elt_property ("transparent", SCM_BOOL_T); set_empty (true, X_AXIS, Y_AXIS); } -} + else + { + if (!get_direction ()) + set_direction (UP); + int p = int (position_f ()); + if (!(p % 2)) + set_position (p + get_direction ()); + } +} Molecule* Dots::do_brew_molecule_p () const { @@ -41,7 +42,7 @@ Dots::do_brew_molecule_p () const Interval (0,0))); out->add_molecule (fill); - Molecule d = lookup_l ()->dots (); + Molecule d = lookup_l ()->afm_find (String ("dots-dot")); Real dw = d.dim_[X_AXIS].length (); d.translate_axis (-dw, X_AXIS); @@ -50,7 +51,7 @@ Dots::do_brew_molecule_p () const d.translate_axis (2*dw,X_AXIS); out->add_molecule (d); } - out->translate_axis (staff_line_leading_f () * position_i_ /2., Y_AXIS); + return out; } diff --git a/lily/font-metric.cc b/lily/font-metric.cc new file mode 100644 index 0000000000..8c8a8e31a7 --- /dev/null +++ b/lily/font-metric.cc @@ -0,0 +1,100 @@ +/* + font-metric.cc -- implement Font_metric + + source file of the GNU LilyPond music typesetter + + (c) 1999 Han-Wen Nienhuys + + */ + +#include +#include + + +#include "font-metric.hh" + +Box +Font_metric::text_dimension (String text) const +{ + Interval ydims; + Real w=0.0; + + for (int i = 0; i < text.length_i (); i++) + { + + if (text[i]=='\\') + { + for (i++; (i < text.length_i ()) && isalpha(text[i]); i++) + ; + // ugh. + i--; // Compensate for the increment in the outer loop! + } + else + { + Character_metric const *c = get_char ((unsigned char)text[i],false); + + // Ugh, use the width of 'x' for unknown characters + if (c->dimensions()[X_AXIS].length () == 0) + c = get_char ((unsigned char)'x',false); + + w += c->dimensions()[X_AXIS].length (); + ydims.unite (c->dimensions()[Y_AXIS]); + } + } + if (ydims.empty_b ()) + ydims = Interval (0,0); + + return Box(Interval (0, w), ydims); +} + + +Box +Scaled_font_metric::text_dimension (String t) const +{ + Real realmag = pow (1.2, magstep_i_); + Box b (orig_l_->text_dimension (t)); + + return Box(b[X_AXIS]* realmag, b[Y_AXIS]*realmag); +} + + +Box +Character_metric::dimensions () const +{ + return Box(Interval(0,0), Interval(0,0)); +} + +Font_metric::~Font_metric () +{ +} + +Character_metric::~Character_metric() +{ +} + +Character_metric const * +Font_metric::get_char (int, bool)const +{ + return 0; +} + +Scaled_font_metric::Scaled_font_metric (Font_metric* m, int s) +{ + magstep_i_ = s; + orig_l_ = m; +} + +SCM +Font_metric::description () const +{ + return gh_cons (ly_symbol2scm (name_str_.ch_C()), gh_int2scm (0)); +} + + +SCM +Scaled_font_metric::description () const +{ + SCM od = orig_l_->description (); + gh_set_cdr_x (od, gh_int2scm (magstep_i_)); + return od; +} diff --git a/lily/grace-align-item.cc b/lily/grace-align-item.cc index 49739fdad7..3ffb02c42d 100644 --- a/lily/grace-align-item.cc +++ b/lily/grace-align-item.cc @@ -10,6 +10,7 @@ #include "grace-align-item.hh" #include "lookup.hh" #include "paper-column.hh" +#include "paper-def.hh" Grace_align_item::Grace_align_item () { @@ -20,7 +21,9 @@ Grace_align_item::Grace_align_item () void Grace_align_item::do_pre_processing () { - Real nhw = lookup_l ()->notehead (2, "").dim_[X_AXIS].length(); + Real nhw = // lookup_l ()->notehead (2, "").dim_[X_AXIS].length(); + paper_l ()->get_var ("quartwidth"); + threshold_interval_[MIN] = nhw* 1.5; column_l ()->set_elt_property ("contains-grace", SCM_BOOL_T); diff --git a/lily/include/all-font-metrics.hh b/lily/include/all-font-metrics.hh new file mode 100644 index 0000000000..432da7ea4c --- /dev/null +++ b/lily/include/all-font-metrics.hh @@ -0,0 +1,44 @@ +/* + all-fonts.hh -- declare All_font_metrics + + source file of the GNU LilyPond music typesetter + + (c) 1998--1999 Han-Wen Nienhuys + + */ + +#ifndef ALL_FONTS_HH +#define ALL_FONTS_HH + +#include "dictionary.hh" +#include "file-path.hh" +#include "lily-proto.hh" +#include "font-metric.hh" +#include "lily-guile.hh" + +/** + Interface to all .afm files living in the filesystem. + */ +class All_font_metrics +{ + Dictionary afm_p_dict_; + Dictionary tfm_p_dict_; + Dictionary scaled_p_dict_; + File_path search_path_; +public: + + Adobe_font_metric *find_afm (String name); + Tex_font_metric *find_tfm (String); + Font_metric *find_font (String name); + Scaled_font_metric* find_scaled (String , int); + + All_font_metrics (String search_path); + + SCM font_descriptions () const; +}; + + + + +#endif /* ALL_FONTS_HH */ + diff --git a/lily/include/atom.hh b/lily/include/atom.hh index 9f8c4ef097..bd566cf911 100644 --- a/lily/include/atom.hh +++ b/lily/include/atom.hh @@ -16,19 +16,17 @@ #include "lily-guile.hh" class Atom { + Offset off_; + friend class Molecule; + friend class Paper_outputter; public: Atom (SCM s); - Offset off_; + /* SCM expression that (when evaluated) gives a TeX string representing a musical notation symbol. */ Protected_scm func_; - Protected_scm font_; - - /* - TODO: move this into the font_ field. - */ - Protected_scm magn_; + void fontify (Font_metric*); }; diff --git a/lily/include/dots.hh b/lily/include/dots.hh index 2806cb1cc4..05aeec680d 100644 --- a/lily/include/dots.hh +++ b/lily/include/dots.hh @@ -12,18 +12,20 @@ #include "item.hh" #include "staff-symbol-referencer.hh" +#include "directional-element.hh" + /** The dots to go with a notehead/rest. A separate class, since they are a party in collision resolution. */ -class Dots : public Item, public Staff_symbol_referencer +class Dots : public Item, public Staff_symbol_referencer, + public Directional_element { protected: virtual Molecule * do_brew_molecule_p () const; virtual void do_post_processing (); public: int dots_i_; - Direction resolve_dir_; Dots (); }; diff --git a/lily/include/font-metric.hh b/lily/include/font-metric.hh index 13c6aca493..03152c7be8 100644 --- a/lily/include/font-metric.hh +++ b/lily/include/font-metric.hh @@ -11,25 +11,33 @@ #define FONT_METRIC_HH #include "box.hh" -/* - sigh. - - signature -> Internal compiler error -*/ +#include "lily-guile.hh" struct Character_metric { - virtual Box dimensions () const=0; - virtual ~Character_metric () {} + virtual Box dimensions () const; + virtual ~Character_metric (); }; struct Font_metric { - virtual Character_metric const *get_char (int ascii, bool warn) const=0; - virtual ~Font_metric () {} + String name_str_; + virtual SCM description () const; + virtual Character_metric const *get_char (int ascii, bool warn) const; + virtual ~Font_metric (); + virtual Box text_dimension (String) const; }; +struct Scaled_font_metric : public Font_metric +{ + Font_metric *orig_l_; + int magstep_i_; + + Scaled_font_metric (Font_metric*, int); + virtual SCM description () const; + virtual Box text_dimension (String) const; +}; #endif /* FONT_METRIC_HH */ diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index dfdf39ffbf..696e5a3739 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -16,10 +16,10 @@ #include "direction.hh" SCM ly_str02scm (char const*c); -SCM ly_ch_C_eval_scm (char const*c); -SCM ly_symbol (String name); -String symbol_to_string (SCM); -SCM ly_set_scm (String name , SCM val); +SCM ly_eval_str (char const*c); +SCM ly_symbol2scm (char const *); +String ly_symbol2string (SCM); +SCM ly_set_x (String name , SCM val); SCM ly_append (SCM a, SCM b); SCM ly_eval (SCM a); diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index 8db92ce5c2..0970b575dd 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -91,6 +91,7 @@ struct Engraver_group_engraver; struct Extender; struct Extender_req; struct Folded_repeat_iterator; +struct Font_metric; struct General_script_def; struct Global_translator; struct Grace_align_item; diff --git a/lily/include/local-key-item.hh b/lily/include/local-key-item.hh index e4007af316..b11793cd92 100644 --- a/lily/include/local-key-item.hh +++ b/lily/include/local-key-item.hh @@ -30,17 +30,18 @@ struct Local_key_cautionary_tuple /** Accidentals which can be different for each octave. - TODO: - update item if Items are removed - - TODO - figure out private/public + TODO + + Make an item for each accidental separately, and make a + Accidental_column to group them. */ + class Local_key_item : public Note_head_side, public Staff_symbol_referencer { Array accidental_arr_; + Molecule accidental (int,bool) const; public: int c0_position_i_; Local_key_item (); diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index 7d2f0b5cb1..f49115097c 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -27,20 +27,15 @@ public: Lookup (Lookup const&); Molecule simple_bar (String s, Real w, Paper_def*) const; - Molecule accidental (int, bool cautionary) const; Molecule afm_find (String, bool warn=true) const; - Molecule notehead (int, String) const; Molecule bar (String, Real height, Paper_def*) const; Molecule beam (Real, Real, Real) const; - Molecule clef (String) const; Molecule dashed_slur (Array controls, Real thick, Real dash) const; - Molecule dots () const; Molecule ledger_line (Interval) const; Molecule fill (Box b) const; Molecule filledbox (Box b) const; Molecule hairpin (Real width, Real height, Real thick, bool decresc, bool continued) const; Molecule tuplet_bracket (Real dy, Real dx, Real gap, Real thick,Real height, Direction dir) const; - Molecule rest (int, bool outside, String) const; Molecule accordion (SCM arg, Real interline_f) const; Molecule slur (Array controls, Real thick) const; Molecule text (String style, String text, Paper_def*) const; diff --git a/lily/include/ly-smobs.icc b/lily/include/ly-smobs.icc index 2bb82ae41b..3ee8d6db51 100644 --- a/lily/include/ly-smobs.icc +++ b/lily/include/ly-smobs.icc @@ -54,6 +54,7 @@ CL::smobify_self () \ SCM_SETCDR(s,me_p); \ scm_protect_object (s); \ \ +/* no scm_done_malloc() ! */ \ do_smobify_self(); \ return s; \ } \ @@ -66,7 +67,7 @@ CL::free_smob (SCM ses) \ return 0; \ SCM_CAR(ses) = SCM_EOL;\ \ - return sizeof(CL); \ + return 0;\ } \ ADD_SCM_INIT_FUNC(CL, CL::init_smobs)\ diff --git a/lily/include/note-head.hh b/lily/include/note-head.hh index 9b2650f486..3becb11874 100644 --- a/lily/include/note-head.hh +++ b/lily/include/note-head.hh @@ -22,6 +22,9 @@ public: void flip_around_stem (Direction); static int compare (Note_head * const &a, Note_head *const &b) ; protected: + Molecule make_molecule () const; + + virtual Interval do_width () const; virtual void do_pre_processing(); virtual Molecule* do_brew_molecule_p() const; diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh index 310cfd29d0..b3147fb9e6 100644 --- a/lily/include/paper-def.hh +++ b/lily/include/paper-def.hh @@ -89,7 +89,7 @@ public: static void reset_default_count(); void output_settings (Paper_outputter*) const; - Paper_outputter* paper_outputter_p (Paper_stream*, Scope*, String) const; + Paper_stream* paper_stream_p () const; String base_output_str () const; diff --git a/lily/include/paper-outputter.hh b/lily/include/paper-outputter.hh index f5c103d0a7..5a17fb60f9 100644 --- a/lily/include/paper-outputter.hh +++ b/lily/include/paper-outputter.hh @@ -14,6 +14,7 @@ #include "array.hh" #include "string.hh" #include "lily-guile.hh" +#include "protected-scm.hh" #ifdef __powerpc__ #include "protected-scm.hh" @@ -25,8 +26,12 @@ class Paper_outputter { public: - Paper_outputter (Paper_stream *); - ~Paper_outputter (); + Protected_scm molecules_; + SCM last_cons_; + Paper_outputter (); + + void dump_onto (Paper_stream *); + void output_int_def (String k, int v); void output_Real_def (String k, Real v); @@ -39,12 +44,10 @@ public: void output_molecule (Molecule const *, Offset, char const *); void output_comment (String s); void output_scheme (SCM scm); + void start_line (Real height); void stop_line (); void stop_last_line (); - void switch_to_font (String fontname); - - Paper_stream* outstream_l_; }; #endif // PAPER_OUTPUTTER_HH diff --git a/lily/include/staff-symbol-referencer.hh b/lily/include/staff-symbol-referencer.hh index 5fc62e0ed0..2dc8ae8c00 100644 --- a/lily/include/staff-symbol-referencer.hh +++ b/lily/include/staff-symbol-referencer.hh @@ -19,9 +19,10 @@ */ class Staff_symbol_referencer : public virtual Score_element { + int position_i_; protected: Staff_symbol * staff_sym_l_; - int position_i_; + public: Staff_symbol_referencer (); void set_position (int); diff --git a/lily/include/tfm-reader.hh b/lily/include/tfm-reader.hh index b1c15a3b95..7d802d09a8 100644 --- a/lily/include/tfm-reader.hh +++ b/lily/include/tfm-reader.hh @@ -19,10 +19,11 @@ class Tex_font_metric_reader { public: - Tex_font_metric_reader (String name); - Tex_font_metric read_tfm (); + static Tex_font_metric * read_file (String name); private: + Tex_font_metric_reader (Tex_font_metric *, String name); + Real get_U32_fix_f (); Real get_U32_fix_scaled_f (); String get_bcpl_str (); @@ -33,7 +34,7 @@ private: Tex_font_char_metric read_char (); void read_lig_kern_program (Array* ligature_arr_p, Array * kern_arr_p); - Tex_font_metric tfm_; + Tex_font_metric *tfm_l_; Binary_source_file input_; }; diff --git a/lily/include/tfm.hh b/lily/include/tfm.hh index b14eea6be7..47ebad8434 100644 --- a/lily/include/tfm.hh +++ b/lily/include/tfm.hh @@ -149,7 +149,7 @@ public: void clear (int n); Character_metric const *get_char (int, bool) const; Tex_font_char_metric const &find_ascii (int ascii, bool warn=true) const; - void read_file (String name); + String str () const; Tfm_info info_; diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index f69786091b..d477f00620 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -93,7 +93,7 @@ Key_engraver::acknowledge_element (Score_element_info info) if (!def) { item_p_->set_elt_property ("visibility-lambda", - ly_ch_C_eval_scm ("all-visibility")); + ly_eval_str ("all-visibility")); } } diff --git a/lily/key-item.cc b/lily/key-item.cc index f85303ff71..7b7631fe9a 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -113,7 +113,8 @@ Key_item::do_brew_molecule_p() const || (old_pitch_arr_[i] == pitch_arr_[j] && old_acc_arr_[i] != acc_arr_[j])) { - Molecule m =lookup_l ()->accidental (0,false); + Molecule m =lookup_l ()->afm_find ("accidentals-0"); + m.translate_axis (calculate_position(old_pitch_arr_[i], old_acc_arr_[i]) * inter, Y_AXIS); output->add_at_edge (X_AXIS, RIGHT, m,0); } @@ -132,7 +133,7 @@ Key_item::do_brew_molecule_p() const for (int i =0; i < pitch_arr_.size(); i++) { - Molecule m =lookup_l ()->accidental (acc_arr_[i],false); + Molecule m = lookup_l ()->afm_find ("accidentals-" + to_str (acc_arr_[i])); m.translate_axis (calculate_position(pitch_arr_[i], acc_arr_[i]) * inter, Y_AXIS); output->add_at_edge (X_AXIS, RIGHT, m, 0); } diff --git a/lily/key.cc b/lily/key.cc index bc93f17044..1e2b30c276 100644 --- a/lily/key.cc +++ b/lily/key.cc @@ -5,8 +5,6 @@ (c) 1997--1999 Han-Wen Nienhuys - TODO - transposition. */ #include "key.hh" diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 2ecad9547a..20f470b0bd 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -27,7 +27,7 @@ ly_str02scm (char const*c) } SCM -ly_ch_C_eval_scm (char const*c) +ly_eval_str (char const*c) { // this all really sucks, guile should take char const* arguments! return gh_eval_str ((char*)c); @@ -92,38 +92,34 @@ ly_parse_scm (char const* s, int* n) /* scm_m_quote doesn't use any env, but needs one for a good signature in GUILE. */ - +// apparently env arg is ignored. SCM ly_quote_scm (SCM s) { - return scm_m_quote (scm_cons2 (SCM_EOL, s, SCM_EOL) ,SCM_EOL); // apparently env arg is ignored. + return scm_m_quote (scm_cons2 (SCM_EOL, s, SCM_EOL) ,SCM_EOL); } -/* - See: libguile/symbols.c - SCM - scm_string_to_symbol(s) - -*/ SCM -ly_symbol (String name) +ly_symbol2scm(const char *s) { - return gh_symbol2scm ((char*)name.ch_C()); + return gh_symbol2scm ((char *)s); } String -symbol_to_string (SCM s) +ly_symbol2string (SCM s) { return String((Byte*)SCM_CHARS (s), (int) SCM_LENGTH(s)); } +#if 0 SCM -ly_set_scm (String name, SCM val) +ly_set_x (String name, SCM val) { return scm_sysintern ((char*)name.ch_C(), val); } +#endif /** Read a file, and shove it down GUILE. GUILE also has file read @@ -146,7 +142,7 @@ read_lily_scm_file (String fn) Simple_file_storage f(s); - ly_ch_C_eval_scm ((char *) f.ch_C()); + ly_eval_str ((char *) f.ch_C()); *mlog << "]" << flush; } @@ -168,7 +164,9 @@ ly_gulp_file (SCM name) Simple_file_storage f(s); - return ly_str02scm (f.ch_C()); + SCM result = ly_str02scm (f.ch_C()); + *mlog << "]"; + return result; } void diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index 6e35416a18..479fc4ba1d 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -33,6 +33,7 @@ Local_key_item::add_pitch (Musical_pitch p, bool cautionary) } + void Local_key_item::do_pre_processing() { @@ -40,6 +41,21 @@ Local_key_item::do_pre_processing() Note_head_side::do_pre_processing (); } +Molecule +Local_key_item::accidental (int j, bool cautionary) const +{ + Molecule m (lookup_l ()->afm_find (String ("accidentals-") + to_str (j))); + if (cautionary) + { + Molecule open = lookup_l ()->afm_find (String ("accidentals-(")); + Molecule close = lookup_l ()->afm_find (String ("accidentals-)")); + m.add_at_edge(X_AXIS, LEFT, Molecule(open), 0); + m.add_at_edge(X_AXIS, RIGHT, Molecule(close), 0); + } + + return m; +} + Molecule* Local_key_item::do_brew_molecule_p() const { @@ -68,8 +84,8 @@ Local_key_item::do_brew_molecule_p() const Real dy = (c0_position_i_ + p.notename_i_) * note_distance; - Molecule m (lookup_l ()->accidental (p.accidental_i_, - accidental_arr_[i].cautionary_b_)); + + Molecule m (accidental (p.accidental_i_, accidental_arr_[i].cautionary_b_)); m.translate_axis (dy, Y_AXIS); octave_mol_p->add_at_edge (X_AXIS, RIGHT, m, 0); diff --git a/lily/lookup.cc b/lily/lookup.cc index 1b7c19e116..35bdc323a3 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -21,7 +21,7 @@ #include "file-path.hh" #include "main.hh" #include "lily-guile.hh" -#include "all-fonts.hh" +#include "all-font-metrics.hh" #include "afm.hh" #include "scope.hh" #include "molecule.hh" @@ -75,20 +75,6 @@ Lookup::ledger_line (Interval xwid) const } -Molecule -Lookup::accidental (int j, bool cautionary) const -{ - Molecule m(afm_find (String ("accidentals-") + to_str (j))); - if (cautionary) - { - Molecule open = afm_find (String ("accidentals-(")); - Molecule close = afm_find (String ("accidentals-)")); - m.add_at_edge(X_AXIS, LEFT, Molecule(open), 0); - m.add_at_edge(X_AXIS, RIGHT, Molecule(close), 0); - } - return m; -} - Molecule @@ -116,32 +102,20 @@ Lookup::afm_find (String s, bool warn) const return m; } - Atom at (gh_list (gh_symbol2scm ("char"), + Atom at (gh_list (ly_symbol2scm ("char"), gh_int2scm (cm.code ()), SCM_UNDEFINED)); - at.font_ = ly_symbol (font_name_.ch_C()); - at.magn_ = gh_int2scm (0); - + + at.fontify (afm_l_); m.dim_ = cm.dimensions(); m.add_atom (&at); return m; } -Molecule -Lookup::notehead (int j, String type) const -{ - if (j > 2) - j = 2; - if (type == "harmonic" || type == "cross") - j = 2; - - return afm_find (String ("noteheads-") + to_str (j) + type); -} - Molecule Lookup::simple_bar (String type, Real h, Paper_def* paper_l) const { - SCM thick = ly_symbol ("barthick_" + type); + SCM thick = ly_symbol2scm (("barthick_" + type).ch_C()); Real w = 0.0; if (paper_l->scope_p_->elem_b (thick)) @@ -241,7 +215,7 @@ Lookup::beam (Real slope, Real width, Real thick) const Molecule m; Atom at - (gh_list (gh_symbol2scm ("beam"), + (gh_list (ly_symbol2scm ("beam"), gh_double2scm (width), gh_double2scm (slope), gh_double2scm (thick), @@ -253,12 +227,6 @@ Lookup::beam (Real slope, Real width, Real thick) const return m; } -Molecule -Lookup::clef (String st) const -{ - return afm_find (String ("clefs-" + st)); -} - SCM offset2scm (Offset o) { @@ -288,7 +256,7 @@ Lookup::dashed_slur (Array controls, Real thick, Real dash) const } Atom at - (gh_list (gh_symbol2scm ("dashed-slur"), + (gh_list (ly_symbol2scm ("dashed-slur"), gh_double2scm (thick), gh_double2scm (dash), ly_quote_scm (array_to_list (sc, 4)), @@ -299,11 +267,6 @@ Lookup::dashed_slur (Array controls, Real thick, Real dash) const return m; } -Molecule -Lookup::dots () const -{ - return afm_find (String ("dots-dot")); -} @@ -315,11 +278,6 @@ Lookup::fill (Box b) const return m; } -Molecule -Lookup::rest (int j, bool o, String style) const -{ - return afm_find (String ("rests-") + to_str (j) + (o ? "o" : "") + style); -} Molecule @@ -346,7 +304,7 @@ Lookup::filledbox (Box b ) const { Molecule m; - Atom at (gh_list (gh_symbol2scm ("filledbox"), + Atom at (gh_list (ly_symbol2scm ("filledbox"), gh_double2scm (-b[X_AXIS][LEFT]), gh_double2scm (b[X_AXIS][RIGHT]), gh_double2scm (-b[Y_AXIS][DOWN]), @@ -358,16 +316,52 @@ Lookup::filledbox (Box b ) const return m; } +/* + TODO: THIS IS UGLY. Since the user has direct access to TeX + strings, we try some halfbaked attempt to detect TeX trickery. + */ +String +sanitise_TeX_string (String text) +{ + int brace_count =0; + for (int i= 0; i < text.length_i (); i++) + { + if (text[i] == '\\') + continue; + + if (text[i] == '{') + brace_count ++; + else if (text[i] == '}') + brace_count --; + } + + if(brace_count) + { + warning (_f ("Non-matching braces in text `%s', adding braces", text.ch_C())); + if (brace_count < 0) + { + text = to_str ('{', -brace_count) + text; + } + else + { + text = text + to_str ('}', brace_count); + } + } + + return text; +} /** - Magnification steps. These are powers of 1.2. The numbers are - taken from Knuth's plain.tex: */ - + TODO! + */ +String +sanitise_PS_string (String t) +{ + return t; +} /** - TODO: THIS IS UGLY. Since the user has direct access to TeX - strings, we try some halfbaked attempt to detect TeX trickery. */ Molecule @@ -385,86 +379,49 @@ Lookup::text (String style, String text, Paper_def *paper_l) const } - Real realmag = 1.0; if (paper_l->scope_p_->elem_b ("magnification_" + style)) { font_mag = (int)paper_l->get_var ("magnification_" + style); - realmag = pow (1.2, font_mag); } /* UGH. */ - SCM l = ly_ch_C_eval_scm (("(style-to-cmr \"" + style + "\")").ch_C()); + SCM l = ly_eval_str (("(style-to-cmr \"" + style + "\")").ch_C()); if (l != SCM_BOOL_F) { style = ly_scm2string (gh_cdr(l)) +to_str ((int)font_h); } - Real w = 0; - Interval ydims (0,0); - - Font_metric* afm_l = all_fonts_global_p->find_font (style); - DEBUG_OUT << "\nChars: "; - - - int brace_count =0; - for (int i = 0; i < text.length_i (); i++) - { - - if (text[i]=='\\') - { - for (i++; (i < text.length_i ()) && isalpha(text[i]); i++) - ; - i--; // Compensate for the increment in the outer loop! - } - else - { - if (text[i] == '{') - brace_count ++; - else if (text[i] == '}') - brace_count --; - Character_metric *c = (Character_metric*)afm_l-> - get_char ((unsigned char)text[i],false); - - // Ugh, use the width of 'x' for unknown characters - if (c->dimensions()[X_AXIS].length () == 0) - c = (Character_metric*)afm_l->get_char ((unsigned char)'x',false); - w += c->dimensions()[X_AXIS].length (); - ydims.unite (c->dimensions()[Y_AXIS]); - } - } - - if(brace_count) - { - warning (_f ("Non-matching braces in text `%s', adding braces", text.ch_C())); - - if (brace_count < 0) - { - text = to_str ('{', -brace_count) + text; - } - else - { - text = text + to_str ('}', brace_count); - } - } + - ydims *= realmag; - m.dim_.x () = Interval (0, w*realmag); - m.dim_.y () = ydims; + Font_metric* metric_l = 0; + if (font_mag) + metric_l = all_fonts_global_p->find_scaled (style, font_mag); + else + metric_l = all_fonts_global_p->find_font (style); - Atom at (gh_list (gh_symbol2scm ("text"), + + if (output_global_ch == "tex") + text = sanitise_TeX_string (text); + else if (output_global_ch == "ps") + text = sanitise_PS_string (text); + + m.dim_ = metric_l->text_dimension (text); + + Atom at (gh_list (ly_symbol2scm ("text"), ly_str02scm (text.ch_C()), SCM_UNDEFINED)); - at.font_ = ly_symbol (style); - at.magn_ = gh_int2scm (font_mag); + at.fontify (metric_l); m.add_atom (&at); return m; } + + Molecule Lookup::time_signature (int num, int den, Paper_def *paper_l) const { @@ -509,11 +466,13 @@ Lookup::staff_brace (Real y, int staff_size) const int maxht = 7 * minht; int idx = int (((maxht - step) ? 0; - - SCM f = ly_symbol (String ("feta-braces" + to_str (staff_size))); - SCM e =gh_list (gh_symbol2scm ("char"), gh_int2scm (idx), SCM_UNDEFINED); + + + String nm = String ("feta-braces" + to_str (staff_size)); + SCM e =gh_list (ly_symbol2scm ("char"), gh_int2scm (idx), SCM_UNDEFINED); Atom at (e); - at.font_ = f; + + at.fontify (all_fonts_global_p->find_font (nm)); m.dim_[Y_AXIS] = Interval (-y/2,y/2); m.dim_[X_AXIS] = Interval (0,0); @@ -526,8 +485,8 @@ Lookup::hairpin (Real width, Real height, Real thick, bool decresc, bool continu { Molecule m; - String hairpin = String (decresc ? "de" : "") + "crescendo"; - Atom at (gh_list (ly_symbol (hairpin), + const char* hairpin = decresc ? "decrescendo" : "crescendo"; + Atom at (gh_list (ly_symbol2scm (hairpin), gh_double2scm (thick), gh_double2scm (width), gh_double2scm (height), @@ -546,7 +505,7 @@ Lookup::tuplet_bracket (Real dy , Real dx, Real thick, Real gap, { Molecule m; - Atom at (gh_list(gh_symbol2scm ("tuplet"), + Atom at (gh_list(ly_symbol2scm ("tuplet"), gh_double2scm (height), gh_double2scm (gap), gh_double2scm (dx), @@ -575,7 +534,7 @@ Lookup::slur (Array controls, Real linethick) const scontrols[i] = offset2scm (controls[indices[i]]); - Atom at (gh_list (ly_symbol ("bezier-sandwich"), + Atom at (gh_list (ly_symbol2scm ("bezier-sandwich"), ly_quote_scm (array_to_list (scontrols, 8)), gh_double2scm (linethick), SCM_UNDEFINED)); @@ -590,7 +549,7 @@ Molecule Lookup::staff_bracket (Real height, Paper_def* paper_l) const { Molecule m; - Atom at ( gh_list (gh_symbol2scm ("bracket"), + Atom at ( gh_list (ly_symbol2scm ("bracket"), gh_double2scm (paper_l->get_var("bracket_arch_angle")), gh_double2scm (paper_l->get_var("bracket_arch_width")), gh_double2scm (paper_l->get_var("bracket_arch_height")), @@ -613,7 +572,7 @@ Lookup::volta (Real h, Real w, Real thick, bool vert_start, bool vert_end) const { Molecule m; - Atom at (gh_list (gh_symbol2scm ("volta"), + Atom at (gh_list (ly_symbol2scm ("volta"), gh_double2scm (h), gh_double2scm (w), gh_double2scm (thick), diff --git a/lily/main.cc b/lily/main.cc index c4062cb1a4..246e763587 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -13,7 +13,7 @@ #include "lily-guile.hh" #include "lily-version.hh" -#include "all-fonts.hh" +#include "all-font-metrics.hh" #include "proto.hh" #include "dimensions.hh" #include "getopt-long.hh" diff --git a/lily/mark-engraver.cc b/lily/mark-engraver.cc index 17da3985e1..e00947c9ab 100644 --- a/lily/mark-engraver.cc +++ b/lily/mark-engraver.cc @@ -18,7 +18,7 @@ Mark_engraver::Mark_engraver () mark_req_l_ = 0; axis_ = Y_AXIS; type_ = "mark"; - visibility_lambda_ = ly_ch_C_eval_scm ("mark-visibility"); + visibility_lambda_ = ly_eval_str ("mark-visibility"); } void diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index 95f7040bc7..8dbfec3c83 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -82,13 +82,15 @@ Multi_measure_rest::do_brew_molecule_p () const } else if (measures_i_ == 1 || measures_i_ == 2 || measures_i_ == 4) { - s = lookup_l ()->rest (- intlog2(measures_i_), 0, ""); + s = lookup_l ()->afm_find ("rests-" + to_str (- intlog2(measures_i_))); s.translate_axis (-s.extent ()[X_AXIS].length () / 2, X_AXIS); } else { - s = lookup_l ()->rest (-4, 0, ""); + String idx = ("rests-") + to_str (-4); + s = lookup_l ()->afm_find (idx); } + mol_p->add_molecule (s); Real interline_f = staff_line_leading_f (); if (measures_i_ == 1 && rest_symbol) diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index 0ec8964888..b271010fd7 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -67,7 +67,6 @@ static Keyword_ent the_key_tab[]={ {"addlyrics", ADDLYRICS}, {"score", SCORE}, {"script", SCRIPT}, - {"shape", SHAPE}, {"skip", SKIP}, {"textscript", TEXTSCRIPT}, {"tempo", TEMPO}, @@ -97,7 +96,7 @@ My_lily_lexer::lookup_keyword (String s) Identifier* My_lily_lexer::lookup_identifier (String s) { - SCM sym = ly_symbol (s.ch_C()); + SCM sym = ly_symbol2scm (s.ch_C()); for (int i = scope_l_arr_.size (); i--; ) if (scope_l_arr_[i]->elem_b (sym)) diff --git a/lily/note-head.cc b/lily/note-head.cc index a8ee5f3f9a..f8e9195607 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -29,11 +29,23 @@ void Note_head::do_pre_processing () { Rhythmic_head::do_pre_processing (); + // 8 ball looks the same as 4 ball: - if (balltype_i_ > 2) + String type; + SCM style = get_elt_property ("style"); + if (style != SCM_UNDEFINED) + { + type = ly_scm2string (style); + } + + + if (balltype_i_ > 2 || type == "harmonic" || type == "cross") balltype_i_ = 2; + if (dots_l_) // move into Rhythmic_head? dots_l_->set_position(int (position_f ())); + + } @@ -50,9 +62,21 @@ Note_head::compare (Note_head *const &a, Note_head * const &b) Interval Note_head::do_width () const { - Molecule a = lookup_l ()->notehead (balltype_i_, ""); // UGH - Interval i = a.dim_[X_AXIS]; - return i; + return make_molecule ().dim_[X_AXIS]; +} + +Molecule +Note_head::make_molecule () const +{ + String type; + SCM style = get_elt_property ("style"); + if (style != SCM_UNDEFINED) + { + type = ly_scm2string (style); + } + + return lookup_l()->afm_find (String ("noteheads-") + + to_str (balltype_i_) + type); } Molecule* @@ -63,17 +87,9 @@ Note_head::do_brew_molecule_p() const int streepjes_i = abs (position_f ()) < sz ? 0 - : (abs(position_f ()) - sz) /2; - + : (abs((int)position_f ()) - sz) /2; - String type; - SCM style = get_elt_property ("style"); - if (style != SCM_UNDEFINED) - { - type = ly_scm2string (style); - } - - Molecule* out = new Molecule (lookup_l()->notehead (balltype_i_, type)); + Molecule* out = new Molecule (make_molecule ()); Box b = out->dim_; diff --git a/lily/note-heads-engraver.cc b/lily/note-heads-engraver.cc index 3ce360fed0..c364004151 100644 --- a/lily/note-heads-engraver.cc +++ b/lily/note-heads-engraver.cc @@ -69,13 +69,6 @@ Note_heads_engraver::do_process_requests() Dots * d = new Dots; note_p->dots_l_ = d; d->dots_i_ = note_req_l->duration_.dots_i_; - - SCM dir = get_property ("verticalDirection",0); - if (isdir_b (dir)) - { - d->resolve_dir_ = to_dir (dir); - } - announce_element (Score_element_info (d,0)); dot_p_arr_.push (d); } diff --git a/lily/paper-def.cc b/lily/paper-def.cc index 39b8fcf165..eb209453de 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -7,6 +7,7 @@ */ #include +#include "all-font-metrics.hh" #include "string.hh" #include "misc.hh" #include "paper-def.hh" @@ -58,14 +59,14 @@ Paper_def::Paper_def (Paper_def const&s) Real Paper_def::get_var (String s) const { - return get_realvar (ly_symbol (s)); + return get_realvar (ly_symbol2scm (s.ch_C())); } Real Paper_def::get_realvar (SCM s) const { if (!scope_p_->elem_b (s)) - error (_f ("unknown paper variable: `%s'", symbol_to_string (s))); + error (_f ("unknown paper variable: `%s'", ly_symbol2string (s))); Real * p = scope_p_->elem (s)->access_content_Real (false); if (!p) { @@ -76,23 +77,37 @@ Paper_def::get_realvar (SCM s) const return *p; } + Interval Paper_def::line_dimensions_int (int n) const { - if (!shape_int_a_.size ()) + SCM s = default_properties_ [ly_symbol2scm ("margin-shape")]; + if (!gh_pair_p (s)) { Real lw = get_var ("linewidth"); Real ind = n? 0.0:get_var ("indent"); return Interval (ind, lw); } - - if (n >= shape_int_a_.size ()) - n = shape_int_a_.size () -1; - return shape_int_a_[n]; -} + + SCM last = SCM_EOL; + while (gh_pair_p (s) && n --) + { + last = s; + s = gh_cdr (s); + } + if (s == SCM_EOL) + { + s = last; + } + + SCM pair = gh_car (s); + + return Interval (gh_scm2double (gh_car (pair)), + gh_scm2double (gh_cdr (pair))); +} Real Paper_def::length_mom_to_dist (Moment d,Real k) const @@ -181,33 +196,6 @@ Paper_def::reset_default_count() default_count_i_ = 0; } -Paper_outputter* -Paper_def::paper_outputter_p (Paper_stream* os_p, Scope* header_l, String origin_str) const -{ - Paper_outputter* p = new Paper_outputter (os_p); - - // for now; breaks -fscm output - p->output_comment (_ ("Outputting Score, defined at: ")); - p->output_comment (origin_str); - - p->output_version(); - if (header_global_p) - p->output_scope (header_global_p, "mudela"); - if (header_l) - p->output_scope (header_l, "mudela"); - if (scope_p_) - p->output_scope (scope_p_, "mudelapaper"); - - - // *p->outstream_l_ << *scope_p_->elem (String (output_global_ch) + "setting")->access_content_String (false); - - SCM scm = gh_list (ly_symbol ("experimental-on"), SCM_UNDEFINED); - p->output_scheme (scm); - scm = gh_list (ly_symbol ("header-end"), SCM_UNDEFINED); - p->output_scheme (scm); - - return p; -} Paper_stream* Paper_def::paper_stream_p () const diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 14316cad02..293475c0d6 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -26,41 +26,23 @@ #include "lily-version.hh" #include "atom.hh" -Paper_outputter::Paper_outputter (Paper_stream *s) +Paper_outputter::Paper_outputter () { - outstream_l_ = s; - output_header (); - - if (output_global_ch == String ("scm")) - *outstream_l_->os << "" - "(primitive-load-path 'lily.scm)\n" - "(eval (tex-scm 'all-definitions))\n" - ";(eval (ps-scm 'all-definitions))\n" - "(display (map (lambda (x) (string-append (eval x) \"\\n\")) '(\n" - ; + molecules_ = gh_cons (SCM_EOL, SCM_EOL); + last_cons_ = molecules_; } -Paper_outputter::~Paper_outputter () -{ - SCM scm = gh_list (ly_symbol ("end-output"), SCM_UNDEFINED); - output_scheme (scm); - - if (String (output_global_ch) == "scm") - { - *outstream_l_->os << ")))"; - } -} void Paper_outputter::output_header () { if (safe_global_b) { - ly_set_scm ("security-paranoia", SCM_BOOL_T); - // ly_ch_C_eval_scm ("(set! security-paranoia #t)"); + // ly_set_x ("security-paranoia", SCM_BOOL_T); + gh_define ("security-paranoia", SCM_BOOL_T); } String s = String ("(eval (") + output_global_ch + "-scm 'all-definitions))"; - ly_ch_C_eval_scm (s.ch_C ()); + ly_eval_str (s.ch_C ()); String creator; if (no_timestamps_global_b) @@ -83,42 +65,23 @@ Paper_outputter::output_header () gh_list (ly_str02scm (creator.ch_l ()), ly_str02scm (generate.ch_l ()), SCM_UNDEFINED); -#ifndef NPRINT - DEBUG_OUT << "output_header\n"; - if (flower_dstream && !flower_dstream->silent_b ("Guile")) - { - gh_display (args_scm); gh_newline (); - } -#endif - SCM scm = gh_cons (gh_symbol2scm ("header"), args_scm); + SCM scm = gh_cons (ly_symbol2scm ("header"), args_scm); output_scheme (scm); } void Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm) { - if (flower_dstream) - *outstream_l_ << String ("\n%start: ") << nm << "\n"; - - if (flower_dstream) { output_comment (nm); } -#ifdef ATOM_SMOB - for (SCM ptr = m->atom_list_; ptr != SCM_EOL; ptr = SCM_CDR(ptr)) - { - Atom *i = Atom::atom_l (SCM_CAR(ptr)); -#else for (Cons *ptr = m->atom_list_; ptr; ptr = ptr->next_) { Atom * i = ptr->car_; -#endif -#if 0 - } -#endif + Offset a_off = i->off_; a_off += o; @@ -137,21 +100,13 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm) } } - if (i->font_) - { - output_scheme (gh_list (ly_symbol ("select-font"), - ly_str02scm (symbol_to_string (i->font_).ch_C()), - SCM (i->magn_), - SCM_UNDEFINED)); - } - SCM box_scm - = gh_list (gh_symbol2scm ("placebox"), + = gh_list (ly_symbol2scm ("placebox"), gh_double2scm (a_off.x ()), gh_double2scm (a_off.y ()), SCM(i->func_), SCM_UNDEFINED); - + output_scheme (box_scm); } } @@ -159,32 +114,58 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm) void Paper_outputter::output_comment (String str) { - if (String (output_global_ch) == "scm") - { - *outstream_l_ << "; " << str << "\n"; - } - else - { - *outstream_l_ << "% " << str << "\n"; - } + output_scheme (gh_list (ly_symbol2scm ("comment"), + ly_str02scm ((char*)str.ch_C()), + SCM_UNDEFINED) + ); } void Paper_outputter::output_scheme (SCM scm) { - if (String (output_global_ch) == "scm") + SCM c = gh_cons (scm,gh_cdr (last_cons_)); + gh_set_cdr_x(last_cons_, c); + last_cons_ = c; +} + + +void +Paper_outputter::dump_onto (Paper_stream *os) +{ + + if (output_global_ch == String ("scm")) + *os << "" + "(primitive-load-path 'lily.scm)\n" + "(eval (tex-scm 'all-definitions))\n" + ";(eval (ps-scm 'all-definitions))\n" + "(display (map (lambda (x) (string-append (eval x) \"\\n\")) '(\n" + ; + + for (SCM s = gh_cdr (molecules_); gh_pair_p (s); s = gh_cdr (s)) { - SCM result = scm_eval (scm_listify (ly_symbol ("scm->string"), ly_quote_scm (scm), SCM_UNDEFINED)); - *outstream_l_->os << ly_scm2string (result) << endl; + if (String (output_global_ch) == "scm") + { + SCM result = scm_eval (scm_listify (ly_symbol2scm ("scm->string"), + ly_quote_scm (gh_car (s)), SCM_UNDEFINED)); + + *os << ly_scm2string (result); + } + else + { + SCM result = scm_eval (gh_car (s)); + char *c=gh_scm2newstr (result, NULL); + + *os << c; + free (c); + } + } - else - { - SCM result = scm_eval (scm); - char *c=gh_scm2newstr (result, NULL); - *outstream_l_ << c; - free (c); + + if (String (output_global_ch) == "scm") + { + *os << ")))"; } } @@ -235,7 +216,7 @@ Paper_outputter::start_line (Real height) programming_error ("Improbable system height"); height = 50 CM; } - SCM scm = gh_list (ly_symbol ("start-line"), + SCM scm = gh_list (ly_symbol2scm ("start-line"), gh_double2scm (height), SCM_UNDEFINED); output_scheme (scm); @@ -244,7 +225,7 @@ Paper_outputter::start_line (Real height) void Paper_outputter::output_font_def (int i, String str) { - SCM scm = gh_list (ly_symbol ("font-def"), + SCM scm = gh_list (ly_symbol2scm ("font-def"), gh_int2scm (i), ly_str02scm (str.ch_l ()), SCM_UNDEFINED); @@ -256,7 +237,7 @@ void Paper_outputter::output_Real_def (String k, Real v) { - SCM scm = gh_list (ly_symbol ("lily-def"), + SCM scm = gh_list (ly_symbol2scm ("lily-def"), ly_str02scm (k.ch_l ()), ly_str02scm (to_str(v).ch_l ()), SCM_UNDEFINED); @@ -269,7 +250,7 @@ void Paper_outputter::output_String_def (String k, String v) { - SCM scm = gh_list (ly_symbol ("lily-def"), + SCM scm = gh_list (ly_symbol2scm ("lily-def"), ly_str02scm (k.ch_l ()), ly_str02scm (v.ch_l ()), SCM_UNDEFINED); @@ -281,7 +262,7 @@ Paper_outputter::output_String_def (String k, String v) void Paper_outputter::output_int_def (String k, int v) { - SCM scm = gh_list (ly_symbol ("lily-def"), + SCM scm = gh_list (ly_symbol2scm ("lily-def"), ly_str02scm (k.ch_l ()), ly_str02scm (to_str (v).ch_l ()), SCM_UNDEFINED); @@ -295,14 +276,17 @@ Paper_outputter::output_int_def (String k, int v) void Paper_outputter::stop_line () { - SCM scm = gh_list (ly_symbol ("stop-line"), SCM_UNDEFINED); + SCM scm = gh_list (ly_symbol2scm ("stop-line"), SCM_UNDEFINED); output_scheme (scm); } void Paper_outputter::stop_last_line () { - SCM scm = gh_list (ly_symbol ("stop-last-line"), SCM_UNDEFINED); + SCM scm = gh_list (ly_symbol2scm ("stop-last-line"), SCM_UNDEFINED); + output_scheme (scm); + scm = gh_list (ly_symbol2scm ("end-output"), SCM_UNDEFINED); output_scheme (scm); } + diff --git a/lily/paper-score.cc b/lily/paper-score.cc index 12eacc3071..e51b01cef3 100644 --- a/lily/paper-score.cc +++ b/lily/paper-score.cc @@ -21,6 +21,7 @@ #include "paper-outputter.hh" #include "file-results.hh" #include "misc.hh" +#include "all-font-metrics.hh" Paper_score::Paper_score () { @@ -109,10 +110,6 @@ Paper_score::calc_breaking () void Paper_score::process () { - Dictionary type_stats; - type_stats["Item"] =0; - type_stats["Spanner"] =0; - type_stats["Total"]=0; print (); *mlog << _ ("Preprocessing elements...") << " " << flush; @@ -125,9 +122,38 @@ Paper_score::process () Array breaking = calc_breaking (); - Paper_stream* paper_stream_p = paper_l_->paper_stream_p (); - outputter_l_ = paper_l_->paper_outputter_p (paper_stream_p, header_l_, origin_str_); + outputter_l_ = new Paper_outputter ; + outputter_l_->output_header (); + outputter_l_->output_version(); + + if (header_global_p) + outputter_l_->output_scope (header_global_p, "mudela"); + if (header_l_) + outputter_l_->output_scope (header_l_, "mudela"); + + outputter_l_->output_comment (_ ("Outputting Score, defined at: ")); + outputter_l_->output_comment (origin_str_); + + if (paper_l_->scope_p_) + outputter_l_->output_scope (paper_l_->scope_p_, "mudelapaper"); + + SCM scm = gh_list (ly_symbol2scm ("experimental-on"), SCM_UNDEFINED); + outputter_l_->output_scheme (scm); + scm = gh_list (ly_symbol2scm ("header-end"), SCM_UNDEFINED); + outputter_l_->output_scheme (scm); + + + /* + This is tricky: we have to put the font definitions before the + actual output, but we don't know all fonts in advanced: generating + the output might trigger loading of a new font. So we store the + place to insert the font definitions, generate the output and then + insert the definitions + + */ + SCM before_output = outputter_l_->last_cons_; + Link_array lines; for (int i=0; i < breaking.size (); i++) { @@ -149,28 +175,25 @@ Paper_score::process () line_l->post_processing (); *mlog << i << flush; - line_l->output_all (i + 1 == lines.size()); + line_l->output_all (i + 1 == lines.size ()); *mlog << ']' << flush; - } + } + + SCM font_names = ly_quote_scm (all_fonts_global_p->font_descriptions ()); + gh_set_cdr_x (before_output, + gh_cons (gh_list (ly_symbol2scm ("define-fonts"), + font_names, + SCM_UNDEFINED), + gh_cdr (before_output))); + Paper_stream* psp = paper_l_->paper_stream_p (); + outputter_l_->dump_onto (psp); // huh? delete outputter_l_; - delete paper_stream_p; + outputter_l_ = 0; - - - /* - todo: sort output - */ - if (experimental_features_global_b) - { - for (Dictionary_iter i(type_stats); i.ok(); i++) - { - *mlog << i.key () << ": " << i.val () << " objects\n"; - } - } - *mlog << '\n' << flush; - + delete psp; + } Link_array diff --git a/lily/rest.cc b/lily/rest.cc index a7974c5ead..fbfbdb5ff1 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -18,7 +18,7 @@ void Rest::do_add_processing () { if (balltype_i_ == 0) - position_i_ += 2; // guh. + set_position (position_f () + 2); Rhythmic_head::do_add_processing (); } @@ -56,11 +56,10 @@ Rest::do_brew_molecule_p () const { style = ly_scm2string (style_sym); } - - Molecule s(lookup_l ()->rest (balltype_i_, ledger_b, style)); - Molecule * m = new Molecule ( Molecule (s)); - return m; + String idx = ("rests-") + to_str (balltype_i_) + (ledger_b ? "o" : "") + style; + + return new Molecule(lookup_l ()->afm_find (idx)); } diff --git a/lily/scope.cc b/lily/scope.cc index be98f18612..5262ea179d 100644 --- a/lily/scope.cc +++ b/lily/scope.cc @@ -58,14 +58,14 @@ Scope::Scope () bool Scope::elem_b (String s) const { - return elem_b (ly_symbol (s.ch_C())); + return elem_b (ly_symbol2scm (s.ch_C())); } Identifier *& Scope::elem (String s) { - return elem (ly_symbol (s.ch_C())); + return elem (ly_symbol2scm (s.ch_C())); } @@ -78,7 +78,7 @@ String Scope_iter::key () const { SCM s= Hash_table_iter::key (); - return symbol_to_string (s); + return ly_symbol2string (s); } bool diff --git a/lily/score-element.cc b/lily/score-element.cc index fd619447f0..9c4e59c1a5 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -91,7 +91,7 @@ Score_element::dependency_size () const SCM Score_element::get_elt_property (String nm) const { - SCM sym = ly_symbol (nm); + SCM sym = ly_symbol2scm (nm.ch_C()); SCM s = scm_assq(sym, element_property_alist_); if (s != SCM_BOOL_F) @@ -99,7 +99,7 @@ Score_element::get_elt_property (String nm) const if (pscore_l_) { - SCM sym2 = ly_symbol (name () + ("::" + nm)); + SCM sym2 = ly_symbol2scm ((name () + ("::" + nm)).ch_C()); SCM val; // should probably check for Type::sym as well. @@ -117,7 +117,7 @@ SCM Score_element::remove_elt_property (String key) { SCM s = get_elt_property (key); - SCM sym = ly_symbol (key); + SCM sym = ly_symbol2scm (key.ch_C()); element_property_alist_ = scm_assq_remove_x (element_property_alist_, sym); return s; } @@ -128,7 +128,7 @@ Score_element::remove_elt_property (String key) void Score_element::set_elt_property (String k, SCM v) { - SCM s = ly_symbol (k); + SCM s = ly_symbol2scm (k.ch_C( )); element_property_alist_ = scm_assoc_set_x (element_property_alist_, s, v); } diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index 5ca373ff10..34163ddc53 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -41,7 +41,7 @@ Script_engraver::do_process_requests() { Articulation_req* l=script_req_l_arr_[i]; - SCM list = ly_ch_C_eval_scm (("(articulation-to-scriptdef \"" + l->articulation_str_ + "\")").ch_C()); + SCM list = ly_eval_str (("(articulation-to-scriptdef \"" + l->articulation_str_ + "\")").ch_C()); if (list == SCM_BOOL_F) { diff --git a/lily/script.cc b/lily/script.cc index ebceea43ab..e5c43f2051 100644 --- a/lily/script.cc +++ b/lily/script.cc @@ -40,12 +40,12 @@ Script::get_molecule(Direction d) const assert (s != SCM_UNDEFINED); SCM key = SCM_CAR (s); - if (key == ly_symbol ("feta")) + if (key == ly_symbol2scm ("feta")) { return lookup_l ()->afm_find ("scripts-" + ly_scm2string (index_cell (gh_cdr (s), d))); } - else if (key == ly_symbol ("accordion")) + else if (key == ly_symbol2scm ("accordion")) { return lookup_l ()->accordion (s, paper_l()->get_var("interline")); } diff --git a/lily/separating-line-group-engraver.cc b/lily/separating-line-group-engraver.cc index 797ecfd76f..b48a0e7689 100644 --- a/lily/separating-line-group-engraver.cc +++ b/lily/separating-line-group-engraver.cc @@ -38,7 +38,7 @@ Separating_line_group_engraver::do_removal_processing () } else { - sep_span_p_->padding_f_ = paper_l ()->get_realvar (ly_symbol ("postBreakPadding")); + sep_span_p_->padding_f_ = paper_l ()->get_realvar (ly_symbol2scm ("postBreakPadding")); } sep_span_p_->set_bounds (RIGHT, get_staff_info ().command_pcol_l ()); diff --git a/lily/staff-margin-engraver.cc b/lily/staff-margin-engraver.cc index 44dfb2df24..0d6e1e7984 100644 --- a/lily/staff-margin-engraver.cc +++ b/lily/staff-margin-engraver.cc @@ -18,7 +18,7 @@ Staff_margin_engraver::Staff_margin_engraver () { axis_ = X_AXIS; type_ = "margin"; - visibility_lambda_ = ly_ch_C_eval_scm ("postbreak-only-visibility"); + visibility_lambda_ = ly_eval_str ("postbreak-only-visibility"); } diff --git a/lily/staff-performer.cc b/lily/staff-performer.cc index 1ec7d19054..f00bb39f52 100644 --- a/lily/staff-performer.cc +++ b/lily/staff-performer.cc @@ -96,10 +96,10 @@ String Staff_performer::new_instrument_str () { // mustn't ask Score for instrument: it will return piano! - SCM minstr = get_property (gh_symbol2scm ("midiInstrument"), 0); + SCM minstr = get_property (ly_symbol2scm ("midiInstrument"), 0); if (!gh_string_p(minstr)) - minstr = get_property (gh_symbol2scm ("instrument"), 0); + minstr = get_property (ly_symbol2scm ("instrument"), 0); if (ly_scm2string (minstr) == instrument_str_) return ""; diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc index 2c6a3a17bc..4a0a5b7558 100644 --- a/lily/staff-symbol-referencer.cc +++ b/lily/staff-symbol-referencer.cc @@ -50,7 +50,12 @@ Staff_symbol_referencer::staff_symbol_l () const Real Staff_symbol_referencer::staff_line_leading_f () const { - return (staff_sym_l_) ? staff_sym_l_->staff_line_leading_f_ : paper_l ()->get_var ("interline"); + if (staff_sym_l_) + return staff_sym_l_->staff_line_leading_f_; + else if (pscore_l_ && paper_l ()) + paper_l ()->get_var ("interline"); + + return 0.0; } Real @@ -80,9 +85,11 @@ Staff_symbol_referencer::do_pre_processing () void Staff_symbol_referencer::set_position (int p) { - /* - UGH. Use position_f() as well. - */ - position_i_ = p; + Real halfspace = staff_line_leading_f ()* 0.5; + translate_axis (- halfspace * position_f (), Y_AXIS); + if (staff_sym_l_) + translate_axis (halfspace * p, Y_AXIS); + else + position_i_ = p; } diff --git a/lily/stem-info.cc b/lily/stem-info.cc index 4cab4ff111..d7e80d2425 100644 --- a/lily/stem-info.cc +++ b/lily/stem-info.cc @@ -25,11 +25,18 @@ Stem_info::Stem_info () /* FIXME: y dims should not be in internote. - */ + + + GURG UGRGINRG INA UG R + + JUNKME -> This should be in Beam +*/ Stem_info::Stem_info (Stem*s, int mult) { mult_i_ =mult; stem_l_ = s; + Beam* beam_l = stem_l_->beam_l_; + x_ = stem_l_->hpos_f (); set_direction (stem_l_->get_direction ()); SCM bd = stem_l_->remove_elt_property ("beam-dir"); @@ -39,7 +46,7 @@ Stem_info::Stem_info (Stem*s, int mult) Paper_def* paper_l = stem_l_->paper_l (); Real internote_f = stem_l_->staff_line_leading_f ()/2; Real interbeam_f = paper_l->interbeam_f (mult_i_); - Real beam_f = paper_l->get_var ("beam_thickness");; + Real beam_f = gh_scm2double (beam_l->get_elt_property ("beam-thickness")); // strangely enough, dim(chord_start_f) == pt (and not internote!) @@ -114,9 +121,6 @@ Stem_info::Stem_info (Stem*s, int mult) idealy_f_ = maxy_f_ ? idealy_f_; - // interstaff beam - Beam* beam_l = stem_l_->beam_l_; - interstaff_f_ = calc_interstaff_dist (stem_l_, beam_l) / internote_f; idealy_f_ += interstaff_f_* beam_dir_; miny_f_ += interstaff_f_ * beam_dir_; diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index 5ada498afd..bbc4b0b50a 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -50,11 +50,11 @@ Stem_tremolo::do_brew_molecule_p () const } Real interbeam_f = paper_l ()->interbeam_f (mult); - Real w = 1.5 * lookup_l ()->notehead (2, "").dim_[X_AXIS].length (); + Real w = gh_scm2double (get_elt_property ("beam-width")); Real space = stem_l_->staff_line_leading_f (); Real internote_f = space/2; - Real beam_f = paper_l ()->get_var ("beam_thickness"); + Real beam_f = gh_scm2double (get_elt_property ("beam-thickness")); int beams_i = 0; Real slope_f = internote_f / 4 / internote_f; // HUH? diff --git a/lily/tfm-reader.cc b/lily/tfm-reader.cc index 284d97cda8..31fea32ab2 100644 --- a/lily/tfm-reader.cc +++ b/lily/tfm-reader.cc @@ -19,22 +19,29 @@ static const Real fix_to_real (Fix f); -Tex_font_metric_reader::Tex_font_metric_reader (String name) +Tex_font_metric_reader::Tex_font_metric_reader (Tex_font_metric* fp, String name) : input_ (name) { - tfm_.clear (TFM_SIZE); -} - -Tex_font_metric -Tex_font_metric_reader::read_tfm () -{ + tfm_l_=fp; + tfm_l_->clear (TFM_SIZE); read_header (); read_params (); read_char_metrics (); - return tfm_; + +} + +Tex_font_metric * +Tex_font_metric_reader::read_file (String name) +{ + Tex_font_metric * tfmp = new Tex_font_metric; + Tex_font_metric_reader tfm_reader (tfmp, name); + + return tfmp; } + + static const Real fix_to_real (Fix f) { @@ -55,7 +62,7 @@ Tex_font_metric_reader::get_U32_fix_f () Real Tex_font_metric_reader::get_U32_fix_scaled_f () { - return get_U32_fix_f () * tfm_.info_.design_size; + return get_U32_fix_f () * tfm_l_->info_.design_size; } String @@ -76,8 +83,8 @@ Tex_font_metric_reader::read_header () (void) file_length; U16 header_length = input_.get_U16 (); - tfm_.info_.first_charcode = input_.get_U16 (); - tfm_.info_.last_charcode = input_.get_U16 (); + tfm_l_->info_.first_charcode = input_.get_U16 (); + tfm_l_->info_.last_charcode = input_.get_U16 (); U16 width_word_count = input_.get_U16 (); U16 height_word_count = input_.get_U16 (); U16 depth_word_count = input_.get_U16 (); @@ -88,38 +95,38 @@ Tex_font_metric_reader::read_header () U16 extensible_word_count = input_.get_U16 (); (void)extensible_word_count; - tfm_.header_.param_word_count = input_.get_U16 (); - tfm_.info_.parameter_count = tfm_.header_.param_word_count; - - tfm_.header_.char_info_pos = (6 + header_length) * 4; - tfm_.header_.width_pos = tfm_.header_.char_info_pos - + (tfm_.info_.last_charcode - - tfm_.info_.first_charcode + 1) * 4; - tfm_.header_.height_pos = tfm_.header_.width_pos + width_word_count * 4; - tfm_.header_.depth_pos = tfm_.header_.height_pos + height_word_count * 4; - tfm_.header_.italic_correction_pos = tfm_.header_.depth_pos + tfm_l_->header_.param_word_count = input_.get_U16 (); + tfm_l_->info_.parameter_count = tfm_l_->header_.param_word_count; + + tfm_l_->header_.char_info_pos = (6 + header_length) * 4; + tfm_l_->header_.width_pos = tfm_l_->header_.char_info_pos + + (tfm_l_->info_.last_charcode + - tfm_l_->info_.first_charcode + 1) * 4; + tfm_l_->header_.height_pos = tfm_l_->header_.width_pos + width_word_count * 4; + tfm_l_->header_.depth_pos = tfm_l_->header_.height_pos + height_word_count * 4; + tfm_l_->header_.italic_correction_pos = tfm_l_->header_.depth_pos + depth_word_count * 4; - tfm_.header_.lig_kern_pos = tfm_.header_.italic_correction_pos + tfm_l_->header_.lig_kern_pos = tfm_l_->header_.italic_correction_pos + italic_correction_word_count * 4; - tfm_.header_.kern_pos = tfm_.header_.lig_kern_pos + lig_kern_word_count * 4; + tfm_l_->header_.kern_pos = tfm_l_->header_.lig_kern_pos + lig_kern_word_count * 4; /* We don't care about the extensible table. */ if (header_length < 2) error (_f ("TFM header of `%s' has only %u word(s)", input_.name_str ().ch_C (), header_length)); - tfm_.info_.checksum = input_.get_U32 (); - tfm_.info_.design_size = get_U32_fix_f (); + tfm_l_->info_.checksum = input_.get_U32 (); + tfm_l_->info_.design_size = get_U32_fix_f (); /* Although the coding scheme might be interesting to the caller, the font family and face byte probably aren't. So we don't read them. */ - tfm_.info_.coding_scheme = header_length > 2 + tfm_l_->info_.coding_scheme = header_length > 2 ? get_bcpl_str () : "unspecified"; DEBUG_OUT << format_str ("TFM checksum = %u, design_size = %fpt, coding scheme = `%s'.\n", - tfm_.info_.checksum, - tfm_.info_.design_size, - tfm_.info_.coding_scheme.ch_C ()); + tfm_l_->info_.checksum, + tfm_l_->info_.design_size, + tfm_l_->info_.coding_scheme.ch_C ()); } /* Although TFM files are only usable by TeX if they have at least seven @@ -132,34 +139,34 @@ void Tex_font_metric_reader::read_params () { /* If we have no font parameters at all, we're done. */ - if (tfm_.header_.param_word_count == 0) + if (tfm_l_->header_.param_word_count == 0) return; //brrr /* Move to the beginning of the parameter table in the file. */ - input_.seek_ch_C (-4 * tfm_.header_.param_word_count); + input_.seek_ch_C (-4 * tfm_l_->header_.param_word_count); /* It's unlikely but possible that this TFM file has more fontdimens than we can deal with. */ - if (tfm_.header_.param_word_count > TFM_MAX_FONTDIMENS) + if (tfm_l_->header_.param_word_count > TFM_MAX_FONTDIMENS) { warning (_f ("%s: TFM file has %u parameters, which is more than the %u I can handle", input_.name_str ().ch_C (), - tfm_.header_.param_word_count, + tfm_l_->header_.param_word_count, TFM_MAX_FONTDIMENS)); - tfm_.header_.param_word_count = TFM_MAX_FONTDIMENS; + tfm_l_->header_.param_word_count = TFM_MAX_FONTDIMENS; } /* The first parameter is different than all the rest, because it isn't scaled by the design size. */ - tfm_.info_.parameters[(TFM_SLANT_PARAMETER) - 1] = get_U32_fix_f (); + tfm_l_->info_.parameters[(TFM_SLANT_PARAMETER) - 1] = get_U32_fix_f (); - for (Char_code i = 2; i <= tfm_.header_.param_word_count; i++) - tfm_.info_.parameters[i - 1] = get_U32_fix_scaled_f (); + for (Char_code i = 2; i <= tfm_l_->header_.param_word_count; i++) + tfm_l_->info_.parameters[i - 1] = get_U32_fix_scaled_f (); #ifdef PRINT - for (Char_code i = 1; i <= tfm_.header_.param_word_count; i++) - DEBUG_OUT << format_str ("TFM parameter %d: %.3f", i, tfm_.info_.parameters[i - 1]); + for (Char_code i = 1; i <= tfm_l_->header_.param_word_count; i++) + DEBUG_OUT << format_str ("TFM parameter %d: %.3f", i, tfm_l_->info_.parameters[i - 1]); #endif } @@ -169,12 +176,12 @@ Tex_font_metric_reader::read_params () void Tex_font_metric_reader::read_char_metrics () { - for (int i = tfm_.info_.first_charcode; i <= tfm_.info_.last_charcode; i++) + for (int i = tfm_l_->info_.first_charcode; i <= tfm_l_->info_.last_charcode; i++) { Tex_font_char_metric tfm_char = read_char_metric (i); if (tfm_char.exists_b_) - tfm_.ascii_to_metric_idx_[tfm_char.code_] = tfm_.char_metrics_.size (); - tfm_.char_metrics_.push (tfm_char); + tfm_l_->ascii_to_metric_idx_[tfm_char.code_] = tfm_l_->char_metrics_.size (); + tfm_l_->char_metrics_.push (tfm_char); } } @@ -189,12 +196,12 @@ Tex_font_metric_reader::read_char_metric (Char_code code) /* If the character is outside the declared bounds in the file, don't try to read it. */ - if (code < tfm_.info_.first_charcode || code > tfm_.info_.last_charcode) + if (code < tfm_l_->info_.first_charcode || code > tfm_l_->info_.last_charcode) return tfm_char; //brr /* Move to the appropriate place in the `char_info' array. */ - input_.seek_ch_C (tfm_.header_.char_info_pos + (code - tfm_.info_.first_charcode) * 4); + input_.seek_ch_C (tfm_l_->header_.char_info_pos + (code - tfm_l_->info_.first_charcode) * 4); /* Read the character. */ tfm_char = read_char (); @@ -232,10 +239,10 @@ Tex_font_metric_reader::read_char () #define GET_CHAR_DIMEN(d) \ if (d##_index != 0) \ { \ - input_.seek_ch_C (tfm_.header_.##d##_pos + d##_index*4); \ + input_.seek_ch_C (tfm_l_->header_.##d##_pos + d##_index*4); \ tfm_char.d##_fix_ = input_.get_U32 (); \ tfm_char.d##_ = fix_to_real (tfm_char.d##_fix_) \ - * tfm_.info_.design_size; \ + * tfm_l_->info_.design_size; \ } GET_CHAR_DIMEN (width); @@ -258,7 +265,7 @@ Tex_font_metric_reader::read_char () if (tag == 1) { - input_.seek_ch_C (tfm_.header_.lig_kern_pos + remainder * 4); + input_.seek_ch_C (tfm_l_->header_.lig_kern_pos + remainder * 4); read_lig_kern_program (&tfm_char.ligature_arr_, &tfm_char.kern_arr_); } @@ -296,7 +303,7 @@ Tex_font_metric_reader::read_lig_kern_program (Array * ligature_ar kern_element.character = next_char; char const* old_pos = input_.pos_ch_C (); - input_.seek_ch_C (tfm_.header_.kern_pos + remainder * 4); + input_.seek_ch_C (tfm_l_->header_.kern_pos + remainder * 4); kern_element.kern = get_U32_fix_scaled_f (); input_.set_pos (old_pos); diff --git a/lily/tfm.cc b/lily/tfm.cc index 96175d18b7..a46d2a8dab 100644 --- a/lily/tfm.cc +++ b/lily/tfm.cc @@ -62,7 +62,6 @@ Tex_font_metric::find_ascii (int ascii, bool warn) const { warning (_f ("Can't find ascii character: `%d'", ascii)); - } return dummy_static_char_metric; } @@ -91,10 +90,4 @@ Tex_font_metric::clear (int n) ascii_to_metric_idx_.push (-1); } -void -Tex_font_metric::read_file (String name) -{ - Tex_font_metric_reader tfm_reader (name); - *this = tfm_reader.read_tfm (); -} diff --git a/lily/translator-group.cc b/lily/translator-group.cc index f74aef58d4..e20daeb0aa 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -469,5 +469,5 @@ Translator_group::get_property (SCM sym, Translator_group **where_l) const void Translator_group::set_property (String id, SCM val) { - properties_dict_[ly_symbol (id)] = val; + properties_dict_[ly_symbol2scm (id.ch_C())] = val; } diff --git a/lily/translator.cc b/lily/translator.cc index c70b629ce8..515a85af9b 100644 --- a/lily/translator.cc +++ b/lily/translator.cc @@ -166,7 +166,7 @@ Translator::output_def_l () const SCM Translator::get_property (String id, Translator_group **where_l) const { - return daddy_trans_l_->get_property (ly_symbol (id), where_l); + return daddy_trans_l_->get_property (ly_symbol2scm (id.ch_C()), where_l); } SCM diff --git a/ly/init.fly b/ly/init.fly index ab3e85547d..8786d94ed8 100644 --- a/ly/init.fly +++ b/ly/init.fly @@ -1,6 +1,6 @@ % Toplevel initialisation file. -\version "1.1.52"; +\version "1.3.5"; \include "declarations.ly" diff --git a/ly/paper11.ly b/ly/paper11.ly index 25222f488d..71b75cdf2f 100644 --- a/ly/paper11.ly +++ b/ly/paper11.ly @@ -18,6 +18,8 @@ paper_eleven = \paper { font_number = 4.; font_dynamic = 10.; font_mark = 6.; + + % UGH! magnification_dynamic = -4.0; -1=\font "feta11" diff --git a/mutopia/J.S.Bach/Petites-Preludes/preludes-1.ly b/mutopia/J.S.Bach/Petites-Preludes/preludes-1.ly index e816b51716..60dec520c8 100644 --- a/mutopia/J.S.Bach/Petites-Preludes/preludes-1.ly +++ b/mutopia/J.S.Bach/Petites-Preludes/preludes-1.ly @@ -1,15 +1,48 @@ +%{ + + Six Petits Preludes, + Collection Johann Peter Kellner + ca 1703 - 1707 + + Kellner was a student of Bach's that copied some 90 works of his master. + +%} \header{ -filename = "preludes-1.ly"; -% -% page 1 -% -% Clavierb"uchlein f"ur W. Fr. Bach -% Clav. W. Fr. Bach: 2-Praeambulum I -% ca 1720 -composer = "Johann Sebastian Bach (1685-1750)"; -enteredby = "jcn"; -copyright = "public domain"; + copyright = "public domain"; + source = "Ed. Henry Lemoine Urtext"; + title = "Pr\\\"aludum"; + + opus = "BWV 924"; + composer = "Johann Sebastian Bach (1685-1750)"; + enteredby = "jcn,hwn"; + + % mutopia headers. + mutopiatitle = "Prelude"; + mutopiacomposer = "J.S.Bach"; + mutopiaopus = "BWV924"; + mutopiainstrument = "Piano"; + style = "baroque"; + copyright = "Public Domain"; + maintainer = "Jan Nieuwenhuizen"; + maintainer_email = "janneke@gnu.org"; + tagline = "\\\\This music is part of the Mutopia project, http://sca.uwaterloo.ca/Mutopia/\\\\It has been typeset and placed in the public domain by " + \maintainer + ".\\\\Unrestricted modification and redistribution is permitted and encouraged - copy this music and share it!"; + maintainer = "janneke@gnu.org"; + lastupdated = "1999/Nov/14"; } +%{ + +TODO: this file needs additional layouting: the trills look +differently in Lemoine, and the sharps should be below the trill. + +Additionally, the performance of trills should be explained. + +Lemoine puts fermatas on ending bar lines everywhere. + +1.2.x versions of lily contain a version with dynamics and fingerings. + +%} + + \version "1.3.4"; @@ -17,26 +50,24 @@ copyright = "public domain"; upper = \context Staff=upper \notes\relative c { \context Voice=i \property Voice . textStyle = "italic" -% rediculous dim... -% r16\p_"legato"\< g''-1( c-3 )e-5 r g,-1( c )e - r16\p\< g''-1( c-3 )e-5 r g,-1( c )e - r g,( c )d r b-1( d-2 \!)g-5 | - r16\mf a,( d-2 ) g-5 r a,(\< d )f-4 - r a,( d )e-3 r c-1( e-2 \!)a-5 | - r16\f b, e a-5 r b, e-3 g-5 - r c,-1 e-3 f-4 r g, d'-3 f-5 | -% all text is fat currently... -% r g,-"poco a poco dim." d'-4 e r g, c-2 e - r g, d'-4 e r g, c-2 e - r a,-1 c-3 d-4 r e, b'-3 d-5 | - r e, b' c-4 r e, a-2 c - r f,-1 a-3 bes-4 r c, g'-3 bes-5 | - r c, g' a-4 r c, f-2 a - r d, f-2 b-5 r e, g-2 c-5 | - r\p d, g c-5 r d, g b-4 - r c, g'-3 b-5 r c, fis-2 a-4 | - r b, d a'-5 r b, d g-4 - r a, c g'-5 r a, c f!-4 | + + r16 g'' c e r g, c e + r g, c d r b d g | + r16 a, d g r a, d f + r a, d e r c e a | + r16 b, e a r b, e g + r c, e f r g, d' f | + + r g, d' e r g, c e + r a, c d r e, b' d | + r e, b' c r e, a c + r f, a bes r c, g' bes | + r c, g' a r c, f a + r d, f b r e, g c | + r d, g c r d, g b + r c, g' b r c, fis a | + r b, d a' r b, d g + r a, c g' r a, c f! | % ugh arpeggio < { \stemup f4 r } @@ -44,43 +75,41 @@ upper = \context Staff=upper \notes\relative c { > \stemboth \translator Staff=lower\stemup - r16 g,,-5( b-4 d - [ f-1 \translator Staff=upper\stemdown g16-1 b d ] | - \stemup )b + r16 g,, b d + [ f \translator Staff=upper\stemdown g16 b d ] | + \stemup b \translator Staff=lower\stemdown - [ g-5( b-4 d-2 ] f-1 + [ g b d ] f \translator Staff=upper\stemup - [ g16-1 b-2 d ] )b + [ g16 b d ] b \translator Staff=lower\stemup \clef "violin"; - [ g-4 b-2 d-1 ] + [ g b d ] \stemup % urg, below translator change affects previous beam too!? % howto separate translator command from previous beam end? - \translator Staff=upper f-2 g-3 b-5 f-2 | + \translator Staff=upper f g b f | \stemboth - e-1\f c'-5( g-3 f-2 e-1 c'-5 g-3 e-2 - )d c'-5( f,-3 e-2 d-1 b'-5 f-3 d-2 | - )c b'-5( e,-3 d-2 c-1 a'-5 e-3 c-2 - )b-1 a'-5( d,-3 c-2 b-1 g'-5 d-3 b-2 | -% )a g'-5 c,-4 b a-"poco a poco dim." fis'-5 c-2 a-1 - )a g'-5 c,-4 b a fis'-5 c-2 a-1 - b-2 f' d-4 c b f' d-4 b-2 | - g e' c-3 b a e'-5 c-3 a-1 - fis-2 d' b-3 a g-1 d'-5 b-4 g-2 | - e c'-5 a-4 g-3 fis-2 c'-5 a-4 fis-2 - d c'-5 b-4 a b-4 g-2 d'-5 f,-1 | - g-4 e-2 f-1 d'-5 c-4 b a g - f'-5 d-3 es-4 c-2 fis,-1 es'-4 d-3 c-2 | -% b-1 d-5 b-3 g-1 as-4-"cresc. e rall." f-2 g-3 d-1 - b-1 d-5 b-3 g-1 as-4 f-2 g-3 d-1 - es-2 fis-3 a-4 c-5 + e c' g f e c' g e + d c' f, e d b' f d | + c b' e, d c a' e c + b a' d, c b g' d b | + a g' c, b a fis' c a + b f' d c b f' d b | + g e' c b a e' c a + fis d' b a g d' b g | + e c' a g fis c' a fis + d c' b a b g d' f, | + g e f d' c b a g + f' d es c fis, es' d c | + b d b g as f g d + es fis a c < { \stemup r c8 b16 } - \context Voice=ii { \stemdown d,8 f-2 } + \context Voice=ii { \stemdown d,8 f } > \stemboth | - + \bar "|."; } @@ -88,13 +117,13 @@ upper = \context Staff=upper \notes\relative c { lower = \context Staff=lower \notes\relative c{ \context Voice=i \property Voice . textStyle = "roman" - c4-5 e-3 g-\mordent^"(\\textsharp)" g,4 | - d'4-\mordent-5 f-3 a-\mordent^"(\\textsharp)" a,4 | - e'-5 e'-\mordent-1 a,-4 b-\upprall | - c4 e,-4 fis gis-\downprall | - a4 c,-4 d e-\upprall | - f4-1 e d-3-\prall c | - g'-\mordent^"(\\textsharp)" g, g'-\mordent g, | + c4 e g^"\\textsharp"-\mordent g,4 | + d'4-\mordent f a-\mordent^"\\textsharp" a,4 | + e' e'-\mordent a, b-\upprall | + c4 e, fis gis-\downprall | + a4 c, d e-\upprall | + f4 e d-\prall c | + g'-\mordent^"\\textsharp" g, g'-\mordent g, | g'-\mordent g, g'-\mordent g, | g' r s s | s s s s \clef "bass"; | < @@ -122,10 +151,7 @@ global = \notes{ \lower > > - \paper{ - % no slur damping - slur_slope_damping = 10.0; - } + \paper { linewidth = 18.0 \cm; } \midi{ \tempo 4 = 80; } \header { opus = "BWV 924"; diff --git a/mutopia/J.S.Bach/Petites-Preludes/preludes-2.ly b/mutopia/J.S.Bach/Petites-Preludes/preludes-2.ly index 2c08fa9e0d..b10faa565d 100644 --- a/mutopia/J.S.Bach/Petites-Preludes/preludes-2.ly +++ b/mutopia/J.S.Bach/Petites-Preludes/preludes-2.ly @@ -13,26 +13,31 @@ \header{ copyright = "public domain"; source = "Ed. Henry Lemoine Urtext"; - - + title = "Pr\\\"aludum"; composer = "Johann Sebastian Bach (1685-1750)"; enteredby = "jcn,hwn"; - copyright = "public domain"; + + opus= "393"; % mutopia headers. mutopiatitle = "Prelude"; mutopiacomposer = "J.S.Bach"; + mutopiaopus = "BWV939"; mutopiainstrument = "Piano"; style = "baroque"; copyright = "Public Domain"; - tagline = "\\\\This music is part of the Mutopia project, http://sca.uwaterloo.ca/Mutopia/\\\\It has been typeset and placed in the public domain by Jan Nieuwenhuizen.\\\\Unrestricted modification and redistribution is permitted and encouraged - copy this music and share it!"; + + maintainer = "Jan Nieuwenhuizen"; + maintainer_email = "janneke@gnu.org"; + tagline = "\\\\This music is part of the Mutopia project, http://sca.uwaterloo.ca/Mutopia/\\\\It has been typeset and placed in the public domain by " + \maintainer + ".\\\\Unrestricted modification and redistribution is permitted and encouraged - copy this music and share it!"; maintainer = "janneke@gnu.org"; - lastupdated = "1999/Nov/8"; + lastupdated = "1999/Nov/14"; } + + %{ Old versions of LilyPond include this prelude with dynamics and fingerings. - %} @@ -41,11 +46,11 @@ Old versions of LilyPond include this prelude with dynamics and fingerings. upper = \context Staff \notes\relative c{ \context Voice=i \property Voice . textStyle = "italic" - r8 c'( e g e c bes' g | - )a c,( f a f c c' a | - )b g( b d b g f' d | + r8 c' e g e c bes' g | + a c, f a f c c' a | + b g b d b g f' d | < - {\stemup )e2 r4 e } + {\stemup e2 r4 e } \context Voice = ii {\stemdown r4 } > \stemboth | @@ -59,9 +64,9 @@ upper = \context Staff \notes\relative c{ \context Voice = ii { \stemdown } > \stemboth - g, 8( b d + g, 8 b d < - { \stemup )b 4 e } + { \stemup b 4 e } \context Voice = ii { \stemdown g, 4 b } > \stemboth | @@ -70,18 +75,18 @@ upper = \context Staff \notes\relative c{ \context Voice=ii { \stemdown c2 r4 e, 4 ~ e 8 } > \stemboth - d,( fis a fis d c' a | - )b g( b d b g f'! d | - )e g,( c e c g g' e | - )fis a,( c fis c a a' fis | + d, fis a fis d c' a | + b g b d b g f'! d | + e g, c e c g g' e | + fis a, c fis c a a' fis | < - { \stemup )g2 } + { \stemup g2 } \context Voice = ii { \stemdown } > \stemboth - r4 b4( | + r4 b4 | c,8 e g c g e bes' g | - )a16-> g f e d c b ! a + a16 g f e d c b ! a b g a b c d e f | g4 < @@ -90,8 +95,8 @@ upper = \context Staff \notes\relative c{ > \stemboth < - { \stemup c1^5 } - \context Voice=ii { \stemdown e, 1_1} + { \stemup c1 } + \context Voice=ii { \stemdown e, 1} > \stemboth \bar "|."; @@ -104,20 +109,20 @@ lower = \context Staff \notes\relative c{ \context Voice=ii { \stemdown c,1 ~ | c ~ | c } > \stemboth | - r8 c( e g e c c' e, | - )fis d( fis a fis d d' fis, | - )g2 r4 g( | - )a8 a,( c e c a g' e | - )fis2 r4 d | + r8 c e g e c c' e, | + fis d fis a fis d d' fis, | + g2 r4 g | + a8 a, c e c a g' e | + fis2 r4 d | g-\mordent-"(\\textsharp)" g, 4 g'-\mordent g, | % mordents in brackets... g'-\mordent g, g'-\mordent g, | g'-\mordent g, g'-\mordent g, | - g'8 g,( b d b g f'! d | - )e c e g e c c' e, | - \property Voice . textStyle = "finger" - f1^"3\\_1" ~ | - f8 d e c g'4 g,^"5\\_2" | + g'8 g, b d b g f'! d | + e c e g e c c' e, | + + f1 | + f8 d e c g'4 g, | \bar "|."; } @@ -139,7 +144,8 @@ global = \notes{ > > \paper{ - } + linewidth = 18.0 \cm; + } \midi{ \tempo 4 = 100; } \header { opus = "BWV 939"; diff --git a/mutopia/J.S.Bach/Petites-Preludes/preludes-3.ly b/mutopia/J.S.Bach/Petites-Preludes/preludes-3.ly index 894117f60c..a733c64230 100644 --- a/mutopia/J.S.Bach/Petites-Preludes/preludes-3.ly +++ b/mutopia/J.S.Bach/Petites-Preludes/preludes-3.ly @@ -6,7 +6,9 @@ - Kellner was a student of Bach's. + + Kellner was a student of Bach's that copied some 90 works of his master. + %} \header{ @@ -25,16 +27,23 @@ mutopiainstrument = "Piano"; style = "baroque"; copyright = "Public Domain"; - tagline = "\\\\This music is part of the Mutopia project, http://sca.uwaterloo.ca/Mutopia/\\\\It has been typeset and placed in the public domain by Jan Nieuwenhuizen.\\\\Unrestricted modification and redistribution is permitted and encouraged - copy this music and share it!"; + + maintainer = "Jan Nieuwenhuizen"; + maintainer_email = "janneke@gnu.org"; + tagline = "\\\\This music is part of the Mutopia project, http://sca.uwaterloo.ca/Mutopia/\\\\It has been typeset and placed in the public domain by " + \maintainer + ".\\\\Unrestricted modification and redistribution is permitted and encouraged - copy this music and share it!"; maintainer = "janneke@gnu.org"; - lastupdated = "1999/Oct/16"; - + lastupdated = "1999/Nov/14"; } + %{ TODO: this file needs additional layouting: the upper voice should switch staffs to avoid leger lines. +Not all editions agree on the last note: ed. Lemoine has a quarter +note, some have dotted half notes. + + %} \version "1.3.4"; @@ -85,9 +94,11 @@ upper = \notes \transpose c'' { r16 [fis, c es] [c fis, c fis,] r fis, r fis, | r16 [fis, c es] [c fis, c fis,] r fis, r fis, | r16 [g, b, d] [b, g, b, d] [es c a, fis] | + + \context Staff < - \context Voice=i {\stemup g2.-\fermata\mf} - \context Voice=ii {\stemdown } + \context Voice=i {\stemup g4-\fermata} + \context Voice=ii {\stemdown } > \stemboth \bar "|."; @@ -102,12 +113,12 @@ lower = \notes{ c4 r [as8 f] | c4 r [as8 f] | - c4-- r [es8 c] | - bes,!4-- r [es8 c] | - as,!4-- r [es8 c] | + c4 r [es8 c] | + bes,!4 r [es8 c] | + as,!4 r [es8 c] | - g,4-- r [es8 c] | - fis,4-- r [es8 c] | + g,4 r [es8 c] | + fis,4 r [es8 c] | fis,4 r [fis8 d] | g,4 r [d8 bes,] | diff --git a/mutopia/J.S.Bach/Petites-Preludes/preludes-4.ly b/mutopia/J.S.Bach/Petites-Preludes/preludes-4.ly index d5eeedface..f99e470e2a 100644 --- a/mutopia/J.S.Bach/Petites-Preludes/preludes-4.ly +++ b/mutopia/J.S.Bach/Petites-Preludes/preludes-4.ly @@ -1,73 +1,96 @@ +%{ + + Six Petits Preludes, + Collection Johann Peter Kellner + ca 1703 - 1707 + + Kellner was a student of Bach's that copied some 90 works of his master. + +%} \header{ -filename = "preludes-4.ly"; -% -% page 8 -% -% Clavierb"uchlein f"ur W. Fr. Bach -% Clav. W. Fr. Bach: 27-Praeludium ex d neutral -% ca 1720 -composer = "Johann Sebastian Bach (1685-1750)"; -enteredby = "jcn"; -copyright = "public domain"; + copyright = "public domain"; + source = "Ed. Henry Lemoine Urtext"; + title = "Pr\\\"aludum"; + opus = "BWV 925"; + composer = "Johann Sebastian Bach (1685-1750)"; + enteredby = "jcn,hwn"; + + % mutopia headers. + mutopiatitle = "Prelude"; + mutopiacomposer = "J.S.Bach"; + mutopiaopus = "BWV925"; + mutopiainstrument = "Piano"; + style = "baroque"; + copyright = "Public Domain"; + maintainer = "Jan Nieuwenhuizen"; + maintainer_email = "janneke@gnu.org"; + tagline = "\\\\This music is part of the Mutopia project, http://sca.uwaterloo.ca/Mutopia/\\\\It has been typeset and placed in the public domain by " + \maintainer + ".\\\\Unrestricted modification and redistribution is permitted and encouraged - copy this music and share it!"; + maintainer = "janneke@gnu.org"; + lastupdated = "1999/Nov/14"; } -\version "1.3.4"; + +%{ + +This stretches LilyPond capabilities a little. + +%} one = \context Staff \notes\relative c { \context Voice=i \property Voice . textStyle = "italic" -% r16\p_"legato" - r16\p +% r16_"legato" + r16 \property Voice . textStyle = "finger" - d'-1( fis-3 d-1 a'-2 b-3 cis-4 a-3 - d-3 cis-2 d-1 e-2 d-1 fis-3 e-2 d-1 | + d'( fis d a' b cis a + d cis d e d fis e d | \property Voice . textStyle = "finger" \stemup - )cis4-2 fis-5 ~ fis8 fis-4 e4-3 ~ | - e16\< \stemboth a,16( cis a d-2 e fis d-1 - g-3 fis g a-4 g-3 b a \!g | + )cis4 fis ~ fis8 fis e4 ~ | + e16 \stemboth a,16( cis a d e fis d + g fis g a g b a g | \stemup -% )fis4-"2\\_3" e8-2 a-5 | - )fis4 e8-2 a-5 | + + )fis4 e8 a | %5 - < )g!16-5 d> fis-2 g-3 a-4 + < )g!16 d> fis g a \stemboth - g-3 b a g | + g b a g | \property Voice . textStyle = "italic" -% fis_"dim." e fis-3 g fis-3 a-5 g fis - fis e fis-3 g fis-3 a-5 g fis + + fis e fis g fis a g fis \property Voice . textStyle = "finger" % e4-"2\\_5" ~ e16 e,( fis g | e4 ~ e16 e,( fis g | \property Voice . textStyle = "italic" -% a-4_"dim." g-1 a b a-2 c-4 b a - a-4 g-1 a b a-2 c-4 b a - g-1 fis-2 g-3 a g-3 b a g | + + a g a b a c b a + g fis g a g b a g | \stemup - )fis4\p + )fis4 \skip 4*7; | %10 \property Voice . textStyle = "finger" -% d'4.\mf cis8-"4\\_5" ~ cis b4-5 a8-"4\\_5" ~ | - d'4.\mf cis8 ~ cis b4-5 a8 ~ | +% d'4. cis8-"4\\_5" ~ cis b4 a8-"4\\_5" ~ | + d'4. cis8 ~ cis b4 a8 ~ | \property Voice . textStyle = "italic" -% a g4-5 fis8-4 ~ fis16 fis-4-"dim." e-3 d-2 - a g4-5 fis8-4 ~ fis16 fis-4 e-3 d-2 + + a g4 fis8 ~ fis16 fis e d \property Voice . textStyle = "finger" % e4-"3\\_5" ~ | e4 ~ | - e16 e-5 d cis d4-5 ~ d16 d-5 cis b cis4-5 | + e16 e d cis d4 ~ d16 d cis b cis4 | \stemboth - fis,16-1\p a-2 d-5\< c-4 b-1 d-2 g-5 fis-4 - d-1 b'-5 a g fis-2 e-1 d-4 \!c!-3 | - b-2 d-1 g a fis8-\prall e16-4 d-3 + fis,16 a d c b d g fis + d b' a g fis e d c! | + b d g a fis8-\prall e16 d d8. e16~ e d8 cis16 | %15 \stemup - r16 d-1\< fis d g a b g-1 c-3 b c d c e d-4 \!c | - b4-5 a ~ a8 g-5 ~ g16 fis8-4 e16-3 | - fis8-4 e-5~ e d-5~ d4 cis-4 | -% d2\p-"rall." ~ d16 a-2( b-3 cis-4 )d4-5 | - d2\p ~ d16 a-2( b-3 cis-4 )d4-5 | + r16 d fis d g a b g c b c d c e d c | + b4 a ~ a8 g ~ g16 fis8 e16 | + fis8 e~ e d~ d4 cis | + + d2 ~ d16 a( b cis )d4 | \bar "|."; } @@ -75,92 +98,92 @@ two = \context Staff \notes\relative c{ \context Voice=ii \stemup \property Voice . textStyle = "finger" - fis4-1( e8-2 a4 a4 gis8-2 | + fis4( e8 a4 a4 gis8 | ) a8 \translator Staff=upper \stemdown -% a'4 a8 b4.-"2\\_1" cis8 ~ | + a'4 a8 b4. cis8 ~ | cis8 \translator Staff=lower \stemup a,8 ~ a d ~ d d4-> cis8 | d8 \translator Staff=upper \stemdown - d'4-> cis8-1 ~ cis b4-1 b8 | + d'4-> cis8 ~ cis b4 b8 | %5 r8 a4 a8 \translator Staff=lower \stemup - g8-1( fis-2 )e4-1 ~ | - e4 d ~ d16 d-1 cis-2 b-1 cis4-2 ~ | - cis8 a-3 d4.-1 d4^> cis8-2 | + g8( fis )e4 ~ | + e4 d ~ d16 d cis b cis4 ~ | + cis8 a d4. d4^> cis8 | \translator Staff=upper \stemdown - d4 \stemboth r16 b-1\< d-2 b~ - r16 cis,-1 e-2 \!cis~ | - r16 d,-1 fis-2 d~ - r16 fis-1 a fis~ | + d4 \stemboth r16 b d b~ + r16 cis, e cis~ | + r16 d, fis d~ + r16 fis a fis~ | %10 \stemdown fis4 e d cis | b a b4. b8 | a4 \translator Staff=lower \stemup - r16 b-3 fis-1 a-2 g4-1 r16 a-3 e-1 g-2 | + r16 b fis a g4 r16 a e g | \skip 1*1; s16 \translator Staff=upper \stemdown - d'8.-1 ~ d8 c d4 a8 g | + d'8. ~ d8 c d4 a8 g | %15 - fis8 \translator Staff=lower \stemup c'-1 b4-1 \stemdown + a'4.> \stemdown a'8~ | - a g-3~ g16 e fis8~ fis16 d8.~ d8. cis!16 | + a g~ g16 e fis8~ fis16 d8.~ d8. cis!16 | \translator Staff=lower \stemup \context Staff < - \context Voice=i { \stemup d8-2 a~ a4 } - \context Voice=ii { \stemdown a8-1 g fis16-2 e-1 fis-2 d-1 } + \context Voice=i { \stemup d8 a~ a4 } + \context Voice=ii { \stemdown a8 g fis16 e fis d } > \stemup - g-1 fis-2 g-1 a-2 g-1 b-3 a-2 g-1 ~ | - g g-1 fis-2 e-1 fis4-2 ~ fis2 + g fis g a g b a g ~ | + g g fis e fis4 ~ fis2 \bar "|."; } three = \notes\relative c{ \context Voice=iii \stemdown - d4-3 cis-4 b e-3 | - a16 a,-5\mf( cis-3 a-5 d-2 e-1 fis-2 d-4 - g-1 fis-3 g a g b a g | - )fis4 fis e a-4 | - d16 \stemboth d,-5\f( fis-3 d-5 a'-2 b-1 cis-2 a-4 - d-1 cis-3 d e d-4 fis-2 e-1 ) d | + d4 cis b e | + a16 a,( cis a d e fis d + g fis g a g b a g | + )fis4 fis e a | + d16 \stemboth d,( fis d a' b cis a + d cis d e d fis e ) d | %5 - cis-3 b-4 cis-3 d-2 c-4 e-2 d-3 c-4 - \stemdown b4-5 cis8-4 b-3( | - a-4 )fis-5 b-2 a-3 gis-4 e-5 a-3 g-4 | - fis4. d8-5 e4-5 a4-3 | + cis b cis d c e d c + \stemdown b4 cis8 b( | + a )fis b a gis e a g | + fis4. d8 e4 a4 | \stemboth - r16 d,-4( fis-2 d-4 )g8-.-1 g,-.-5 - r16 e'-4( g-2 e-4 )a8-. a,-.-5 | - r16 fis'-4( a fis )b8-. b,-. r16 g'-4( b g )d'8-. d,-. | + r16 d,( fis d )g8-. g,-. + r16 e'( g e )a8-. a,-. | + r16 fis'( a fis )b8-. b,-. r16 g'( b g )d'8-. d,-. | %10 - r16 d,16-5( fis-3 d a'-2 b-1 cis-2 a-4 d b-5 d-3 b - fis'-2 g a-2 fis-4 | - )fis16 g,( b g d'-2 e fis-2 d-4 )g8-. g,-. r16 cis-4( e cis | - )fis8-. fis,-. \stemdown r16 b-4( d b )e8-. e,-. - r16 a-4 cis a | + r16 d,16( fis d a' b cis a d b d b + fis' g a fis | + )fis16 g,( b g d' e fis d )g8-. g,-. r16 cis( e cis | + )fis8-. fis,-. \stemdown r16 b( d b )e8-. e,-. + r16 a cis a | \stemboth - d-1 e-3 fis-2 d-4 g-1 fis-2 e-3 d-1 cis!-3 a-5 b cis - d-2 e fis-2 d-4 | - g8 e-3 \stemdown a a, b8.-4 g16-5 a4-4 | + d e fis d g fis e d cis! a b cis + d e fis d | + g8 e \stemdown a a, b8. g16 a4 | %15 - d8-5 a'-2~ a g-3~ g g-3 fis4-4 | + d8 a'~ a g~ g g fis4 | \stemup - r16 g-2 b-1 g-3 d'8.-1 c16-1 b8.-2 bes16-3 a8-1 g | + r16 g b g d'8. c16 b8. bes16 a8 g | \stemdown - r16 a,-2 cis!-1 a'-2 d,-1 e fis d e8-1 d-2 e-1 a,-2 | - d a-2~ a16 a-2 b cis-2 d2 | + r16 a, cis! a' d, e fis d e8 d e a, | + d a~ a16 a b cis d2 | } four = \context Staff \notes\relative c{ @@ -175,7 +198,7 @@ four = \context Staff \notes\relative c{ \skip 1*2; | s4 \translator Staff=lower \stemup - a4 ~ a16 d,-2 g8-1 fis e-1 | + a4 ~ a16 d, g8 fis e | %15 \stemdown d1 ~ | @@ -205,6 +228,7 @@ global = \notes{ > > \paper{ + linewidth = 18.0 \cm; } \midi{ \tempo 4 = 70; } \header{ diff --git a/mutopia/J.S.Bach/Petites-Preludes/preludes-5.ly b/mutopia/J.S.Bach/Petites-Preludes/preludes-5.ly index 0ccb570c2e..fe9c171ea7 100644 --- a/mutopia/J.S.Bach/Petites-Preludes/preludes-5.ly +++ b/mutopia/J.S.Bach/Petites-Preludes/preludes-5.ly @@ -1,184 +1,202 @@ +%{ + + Six Petits Preludes, + Collection Johann Peter Kellner + ca 1703 - 1707 + + Kellner was a student of Bach's that copied some 90 works of his master. + +%} + \header{ -filename = "preludes-5.ly"; -% -% page 2 -% -% Clavierb"uchlein f"ur W. Fr. Bach -% Clav. W. Fr. Bach: 4-Praeludium 2 -% ca 1720 -composer = "Johann Sebastian Bach (1685-1750)"; -enteredby = "jcn"; -copyright = "public domain"; + copyright = "public domain"; + source = "Ed. Henry Lemoine Urtext"; + title = "Pr\\\"aludum"; + opus = "BWV 926"; + composer = "Johann Sebastian Bach (1685-1750)"; + enteredby = "jcn,hwn"; + + % mutopia headers. + mutopiatitle = "Prelude"; + mutopiacomposer = "J.S.Bach"; + mutopiaopus = "BWV926"; + mutopiainstrument = "Piano"; + style = "baroque"; + copyright = "Public Domain"; + maintainer = "Jan Nieuwenhuizen"; + maintainer_email = "janneke@gnu.org"; + tagline = "\\\\This music is part of the Mutopia project, http://sca.uwaterloo.ca/Mutopia/\\\\It has been typeset and placed in the public domain by " + \maintainer + ".\\\\Unrestricted modification and redistribution is permitted and encouraged - copy this music and share it!"; + maintainer = "janneke@gnu.org"; + lastupdated = "1999/Nov/14"; + } -\version "1.3.4"; +\version "1.3.4"; -upper = \context Staff \notes\relative c{ +upper = \context Staff \notes\relative c + \context Voice=i { \property Voice . textStyle = "italic" - \context Voice=i -% d'8-1\p a'-5-"legato" f-3 d-1 a'-5 f-3 | - d'8-1\p a'-5 f-3 d-1 a'-5 f-3 | - d-1 a'-5 f-3 d-1 a'-5 f-3 | - d-1\< bes'-4 g-2 d-1 bes'-4 \!g-2 | - d-1 bes'-4 g-2 d-1 bes'-5 g-3 | + + + [d'8 a' f d a' f] | + d a' f d a' f | + d bes' g d bes' g | + d bes' g d bes' g | %5 - cis,-1\mf g'-4 e-2 cis-1 g'-4 e-2 | - cis-1 bes'-5 g-4 e-2 a-5 g-4 | - f-3\< d-1 f-2 a-4 f-1 a-2 | - d-5 a-1 d-2 f-4 d-1 \!f-2 | - b\> f-3 e d c-3 b | + cis, g' e cis g' e | + cis bes' g e a g | + f d f a f a | + d a d f d f | + b ( f e d c b | %10 - a gis-3 fis e d'-5 \!b-2 | + a gis fis )e d' b | < { \stemup \property Voice . textStyle = "roman" - c4-\mordent^"(\\textsharp)"\p r r | + c4-\mordent^"(\\textsharp)" r r | c4-\mordent^"(\\textsharp)" r r \property Voice . textStyle = "italic" } \context Voice=ii { \stemdown a4 r r | a4 r r } > | \stemboth - a'8\mf( es-3\> d c bes!-3 a | - g fis-3 e!-2 d-1 c'-4 \!a | + a'8( es d c bes a | + g fis e! )d c' a | %15 - )bes8-\mordent\p( d8-5 bes-3 g-1 )g'4 | - r8 d-5( c bes a-\prall g | - )a-2 c-4( a f ) f'4 | - r8 c-5 bes a g-\prall f | - g-2 bes-4 a g f-1 e-2 | + bes8-\mordent d8 bes g g'4 | + r8 d c bes a-\prall g | + a c a f f'4 | + r8 c bes a g-\prall f | + g bes a g f e | %20 - f-3 d-1 f-2 a-3 d-5 g,-2 | + f d f a d g, | < { \stemup % ... textnatural -% cis8-\prall e8-5-"poco cresc." cis-3 a e' cis - cis8-\prall e8-5 cis-3 a e' cis +% cis8-\prall e8-"poco cresc." cis a e' cis + cis8-\prall e8 cis a e' cis } \context Voice=ii { \stemdown a4 } > \stemboth - a8 e'-5 cis a bes!-3 a | - g e'-5 cis-3 g e'-5 cis-3 | - g-1 e'-5 cis g a-3 g | -% f-"dim." d'-5 bes f d' bes | - f d'-5 bes f d' bes | + a8 e' cis a bes! a | + g e' cis g e' cis | + g e' cis g a g | + + f d' bes f d' bes | %25 - f d'-5 bes f d' bes | -% fis-2-"dim." c'-5 a-3 fis-2 c'-5 a-3 | - fis-2 c'-5 a-3 fis-2 c'-5 a-3 | - fis-2 c'-5 a-3 fis-2 c'-5 a-3 | - bes-4 g-1 fis-2 g-3 d-1 g-2 | - bes-4 g-2 d-1 bes'-5 g-3 d-1 | + f d' bes f d' bes | + + fis c' a fis c' a | + fis c' a fis c' a | + bes g fis g d g | + bes g d bes' g d | %30 - e-2\p g-4 fis-3 g-1 bes-4 g-2 | - es-1 bes'-4 g-2 es bes' g | - cis,-1 bes'-4 g-2 cis, bes' g | - cis,-1 bes'-4 g-2 cis,-1 a'-5 g-4 | - f-3 a f d a'-5 f | + e g fis g bes g | + es bes' g es bes' g | + cis, bes' g cis, bes' g | + cis, bes' g cis, a' g | + f a f d a' f | %35 - d-1 a'-5 f-3 d-1 cis-2 d-1 | - e-3\< g-5 e-3 bes-1 g'-5 e-3 | - bes-1 g'-5 e-3 \!cis-2 a-1 g'-5 | - f16-4\mf d-2 c-1 bes-3 \stemup a-2 s16 s8 s4 | + d a' f d cis d | + e g e bes g' e | + bes g' e cis a g' | + f16 d c bes \stemup a s16 s8 s4 | % ugh % s1 | s4 s4 s4 | %40 - s4 s16 [d16-1-"m.d." f-2 a-4] \stemdown [d,-2-"m.g." f a] \stemup d-1 | + s4 s16 [d16 f a] \stemdown [d, f a] \stemup d | \stemboth - f a-4 f d f-4 d b d-5 gis,-2 b a gis | - a8-5 - < - { - \stemup - f4-4\> ~ | [\!f8 e] [e32-4 f e8.] ~ [e8 d-3] + f a f d f d b d gis, b a gis | + + % arpeggio + a8 + < f4 d a > ~ + [f8 e] + < { \stemup + e4.^\prall d8 } - \context Voice=ii { \stemdown r4 cis-2 } - > | + \context Voice=ii { \stemdown cis2 } + > \stemboth - d8-4 c!-3 a-1 d-4 bes-2 g-1 | + d8 c! a d bes g | %45 - c-5 a-3 fis-2 bes-4 g e | -% a-5 fis-"dim. e rall." d g-5 e cis-2 | - a-5 fis d g-5 e cis-2 | - < - { \stemup } - \context Voice=ii { \stemdown [d32( cis d8.] ~ ) d2 } - > | - \bar "|."; + c a fis bes g e | + + a fis d g e cis | + + % the mordent is on the D ! + } lower = \context Staff \notes\relative c{ \context Voice=i -% d32( cis )d8. r4 r | + d4-\mordent r r | d,4 r r | d'-\mordent r r | d,4 r r | d'-\mordent r r | -% d r r | + d,4 r r | - d'8-2 a-5 d-2 f-1 d-4 f-2 | - a-1 f-4 a-2 d-1 a-2 d-1 | - gis,4-3 r r | - e-4( )gis-2 e | - a8-4 e'-1 c-2 a-4 e'-1 c-2 | - g!-5 es'-1 c-1 g-5 es'-1 c-1 | - fis,4-5 r r - d-4( ) fis d-5 | + d'8 a d f d f | + a f a d a d | + gis,4 r r | + e gis e | + a8 e' c a e' c | + g! es' c g es' c | + fis,4 r r + d fis d | \property Voice . textStyle = "roman" g4-\mordent^"(\\textsharp)" r r8 f!8 | \property Voice . textStyle = "italic" e4-\prall r r | f4-\mordent r r8 e | - d4 r8 f-1 e d | - e-2 d-3 cis-4 e-1 d-2 cis-3 | - d4-2( )c! bes-4 | - a( )a' a, | - a( )a' a, | - a( )a' a, | - a( )a' a, | + d4 r8 f e d | + e d cis e d cis | + d4 c! bes | + a a' a, | + a a' a, | + a a' a, | + a a' a, | bes r r | - bes-5( )bes' bes, | + bes bes' bes, | a r r | - a-2( )d-1 d, | + a d d, | g r r | - g( )g' g, | + g g' g, | g r r | - g( )g' g, | + g g' g, | a r r | - a( )a' a, | + a a' a, | a r r | - a( )a' a, | + a a' a, | cis, r r | - cis( )cis' cis, | - d-4 s16 + cis cis' cis, | + d s16 \stemdown - [g'16-1-"m.g." f e] f-2 a d,-3 f | - a, \stemup [d-5-"m.d." c bes] - a \stemdown [ g-2 f-"m.g." e] d f-4 a-2 d-1 | + [g'16 f e] f a d, f | + a, \stemup [d c bes] + a \stemdown [ g f e] d f a d | \stemup -% f-2\ped a - [f-2-"Ped." a] + + [f a] \stemdown -% d-4-"m.g." f-"cresc." a s s8 s4\dep | -% d,-4-"m.g." f-"cresc." a s s8 s4-"*" | - [d,-4-"m.g." f] a s s8 s4-"*" | + [d, f] a s s8 s4-"*" | \stemboth % ugh whole rest has duration of one bar -% r1 | - r4 r r | - cis,8-3( e cis a d16-1 c bes a | - )g8 g' a-2( g-3 a-1 a, | - )d4-3 d'-1 d, | + R2. | +% r4 r r | + cis,8 e cis a d16 c bes a | + g8 g' a g a a, | + d4 d' d, | d r r | - d,( )d' d, | + d, d' d, | d2. | - \bar "|."; } global = \notes{ @@ -191,7 +209,7 @@ global = \notes{ \context PianoStaff < \context Staff = upper < \global - \upper + { \upper \bar "|." } > \context Staff = lower < \global @@ -200,6 +218,8 @@ global = \notes{ > > \paper{ + linewidth = 18.0 \cm; + } \midi{ \tempo 4 = 90; } \header{ diff --git a/mutopia/J.S.Bach/Petites-Preludes/preludes-6.ly b/mutopia/J.S.Bach/Petites-Preludes/preludes-6.ly index d51b769e9d..643c959711 100644 --- a/mutopia/J.S.Bach/Petites-Preludes/preludes-6.ly +++ b/mutopia/J.S.Bach/Petites-Preludes/preludes-6.ly @@ -1,103 +1,125 @@ +%{ + + Six Petits Preludes, + Collection Johann Peter Kellner + ca 1703 - 1707 + + Kellner was a student of Bach's that copied some 90 works of his master. + +%} + \header{ -filename = "preludes-6.ly"; -% -% page 11 -% -% Six Petits Preludes -% Collection Johann Peter Kellner -% ca 1703 - 1707 -composer = "Johann Sebastian Bach (1685-1750)"; -enteredby = "jcn"; -copyright = "public domain"; + copyright = "public domain"; + source = "Ed. Henry Lemoine Urtext"; + title = "Pr\\\"aludum"; + opus = "BWV 940"; + composer = "Johann Sebastian Bach (1685-1750)"; + enteredby = "jcn,hwn"; + + % mutopia headers. + mutopiatitle = "Prelude"; + mutopiacomposer = "J.S.Bach"; + mutopiaopus = "BWV940"; + mutopiainstrument = "Piano"; + style = "baroque"; + copyright = "Public Domain"; + maintainer = "Jan Nieuwenhuizen"; + maintainer_email = "janneke@gnu.org"; + tagline = "\\\\This music is part of the Mutopia project, http://sca.uwaterloo.ca/Mutopia/\\\\It has been typeset and placed in the public domain by " + \maintainer + ".\\\\Unrestricted modification and redistribution is permitted and encouraged - copy this music and share it!"; + maintainer = "janneke@gnu.org"; + lastupdated = "1999/Nov/14"; + } + \version "1.3.4"; + one = \context Staff \notes\relative c{ \context Voice=i \skip 1; | \stemup - r4 d''2-5( cis4-4 | + r4 d''2 cis4 | \stemboth - )d16-5\mf a'-4( g f e f-4 cis-2 d-1 - e8.-\mordent f16 d8.-\prall-1 cis16-3 | + d16 a' g f e f cis d + e8.-\mordent f16 d8.-\prall cis16 | \stemup - )cis4\> ~ cis16 a \!d8 ~ d4 a( | + cis4 ~ cis16 a d8 ~ d4 a | %5 - )b2-4 ~ b4 a-5 ~ | - a16 a-5 \stemup g! f g4-4\< ~ g f-3 ~ | - \!f16 a g f e16 g8.-5 ~ g16 g-5 f-4 e-3 d-1 f8.-4 ~ | - f16 f-3 e d b'4 a-5 g-5 | -% fis4-4 g r8\<-"rall." g16-1( bes-2 \!e4-5 | - fis4-4 g r8\< g16-1( bes-2 \!e4-5 | + b2 ~ b4 a ~ | + a16 a \stemup g! f g4 ~ g f ~ | + f16 a g f e16 g8. ~ g16 g f e d f8. ~ | + f16 f e d b'4 a g | + + fis4 g r8 g16 bes e4 | %10 - )d1-5 + d1 \bar "|."; } two = \context Staff \notes\relative c{ \context Voice=ii - r16\p d''-5( c-4 bes-3 a-2 bes-3 f-1 g-2 - a8.-\mordent bes16-1 g8.-\prall f16-1 | + r16 d'' c bes a bes f g + a8.-\mordent bes16 g8.-\prall f16 | \stemdown - )f2 e2 | + f2 e2 | \translator Staff=lower \stemup - r4 a,-1 bes-2 b-1 | + r4 a, bes b | \translator Staff=upper \stemdown - r16 b'-3 a-1 g-2 f8. f16-2 e2 ~ | + r16 b' a g f8. f16 e2 ~ | %5 - e2 ~ e4 ~ e16 e-2 f! d-1 | + e2 ~ e4 ~ e16 e f! d | s4 e32 d e8.~ e4 d4 ~ | - d4. cis16-2 d-1 cis4 d-1 ~ | - d8 r r16 e-2 f d r16 e-2 f d r d-1 e-3 cis | - r16 e-3 d-1 c!-2 bes! d8. s4 r16\> bes'-2 a-2 \!g-1 | + d4. cis16 d cis4 d ~ | + d8 r r16 e f d r16 e f d r d e cis | + r16 e d c! bes! d8. s4 r16 bes' a g | %10 - fis1-2 + fis1 } three = \context Staff \notes\relative c{ \context Voice=iii \stemup - f2-1( e-2 | + f2 e | \stemboth - )d16 d'( c bes a-4 bes-2 f-5 g-4 - a8.-\mordent bes16-2 - g8.-\prall-4 f16-5 | - )f2-5 g4-4 gis | - a2-2 ~ a16 a-1( g f e-4 f-2 c-5 d | + d16 d' c bes a bes f g + a8.-\mordent bes16 + g8.-\prall f16 | + f2 g4 gis | + a2 ~ a16 a g f e f c d | %5 - e8.-\mordent f16 d8.-\prall-4 c16-5 \stemboth )c4.-5 d8-4 | + e8.-\mordent f16 d8.-\prall c16 \stemboth c4. d8 | \stemdown - e4 ~ e16 f-2( e-3 d-4 cis a b cis-3 d-4 e-3 f-2 d-4 | + e4 ~ e16 f e d cis a b cis d e f d | \property Voice . textStyle = "finger" - )bes!2-"5\\_4" a ~ | + bes!2 a ~ | a a | - d, cis'-5 | + d, cis' | %10 - a'1-2 + a'1 \bar "|."; } four = \context Staff \notes\relative c{ \context Voice=iv \stemdown - d2-3 cis-4 | + d2 cis | \skip 1*2; | \skip 4*3; \translator Staff=upper \stemup \property Voice.horizontalNoteShift = 1 - c''4-5 | + c''4 | %5 - a gis-2 ~ gis16 gis-3 fis e + a gis ~ gis16 gis fis e \skip 4*1; \translator Staff=lower \stemdown \property Voice.horizontalNoteShift = 0 \stemup - b2-1 a-1 | + b2 a | g a4. gis16 a | - gis2 < g8 cis,> e4-2 | - d4. fis16-3 g-2 r16 bes8.-1 ~ bes4 | + gis2 < g8 cis,> e4 | + d4. fis16 g r16 bes8. ~ bes4 | %10 \stemdown - d,1-5 + d,1 } global = \notes{ @@ -121,10 +143,11 @@ global = \notes{ > > \paper{ + linewidth = 18.0 \cm; + } \midi{ \tempo 4 = 40; } \header{ - piece = "6"; opus = "BWV 940"; } } diff --git a/mutopia/J.S.Bach/Petites-Preludes/preludes-score.ly b/mutopia/J.S.Bach/Petites-Preludes/preludes-score.ly index 845f08466a..112b0b81a3 100644 --- a/mutopia/J.S.Bach/Petites-Preludes/preludes-score.ly +++ b/mutopia/J.S.Bach/Petites-Preludes/preludes-score.ly @@ -15,7 +15,7 @@ copyright = "public domain"; mutopiainstrument = "Piano"; style = "baroque"; copyright = "Public Domain"; - tagline = "\\\\This music is part of the Mutopia project, http://sca.uwaterloo.ca/Mutopia/\\\\It has been typeset and placed in the public domain by Jan Nieuwenhuizen.\\\\Unrestricted modification and redistribution is permitted and encouraged - copy this music and share it!"; + tagline = "\\\\This music is part of the Mutopia project, http://sca.uwaterloo.ca/Mutopia/\\\\It has been typeset and placed in the public domain by " + \maintainer + ".\\\\Unrestricted modification and redistribution is permitted and encouraged - copy this music and share it!"; maintainer = "janneke@gnu.org"; lastupdated = "1999/Oct/16"; diff --git a/mutopia/J.S.Bach/wtk1-fugue2.ly b/mutopia/J.S.Bach/wtk1-fugue2.ly index cae280c7b1..9cd22ceb7d 100644 --- a/mutopia/J.S.Bach/wtk1-fugue2.ly +++ b/mutopia/J.S.Bach/wtk1-fugue2.ly @@ -13,8 +13,7 @@ copyright = "\\\\This music is part of the Mutopia project, http://sca.uwaterloo.ca/Mutopia/\\\\It has been typeset and placed in the public domain by Han-Wen Nienhuys.\\\\Unrestricted modification and redistribution is permitted and encouraged - copy this music and share it!"; maintainer = "hanwen@cs.uu.nl"; lastupdated = "1999/Oct/14"; - - } +} % It would be nice to squeeze this onto two pages, but I am not sure diff --git a/scm/generic-property.scm b/scm/generic-property.scm index e12646599d..ef36f07c67 100644 --- a/scm/generic-property.scm +++ b/scm/generic-property.scm @@ -23,6 +23,13 @@ )) ) +(define generic-dot-properties + (cons "Dots" (list + (list 'dotDirection dir? 'direction) + (list 'verticalDirection dir? 'direction) + ) + )) + (define generic-text-properties (cons "Text_item" (list (list 'textStyle string? 'style) @@ -84,6 +91,7 @@ (define generic-voice-properties (list generic-stem-properties + generic-tie-properties generic-rest-properties generic-slur-properties generic-beam-properties @@ -103,5 +111,10 @@ ) (define generic-thread-properties - (list generic-All-properties)) + (list generic-All-properties + generic-dot-properties + + ) + + ) diff --git a/scm/lily.scm b/scm/lily.scm index a2bbdd35bc..7024dfe651 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -11,11 +11,24 @@ ; :use-module (ice-9 regex)) +;; do nothing in .scm output +(define (comment s) + "" + ) + + (define (xnumbers->string l) (string-append (map (lambda (n) (string-append (number->string n ) " ")) l))) +(define (mm-to-pt x) + (* (/ 72.27 25.40) x) + ) + +(define (cons-map f x) + (cons (f (car x)) (f (cdr x)))) + (define (reduce operator list) (if (null? (cdr list)) (car list) (operator (car list) (reduce operator (cdr list))) @@ -152,6 +165,32 @@ ("volta" . "feta-nummer")) ) +(define (string-encode-integer i) + (cond + ((= i 0) "o") + ((< i 0) (string-append "n" (string-encode-integer (- i)))) + (else (string-append + (make-string 1 (integer->char (+ 65 (modulo i 26)))) + (string-encode-integer (quotient i 26)) + ) + ) + ) + ) + +(define (magstep i) + (cdr (assoc i '((-4 . 482) + (-3 . 579) + (-2 . 694) + (-1 . 833) + (0 . 1000) + (1 . 1200) + (2 . 1440) + (3 . 1728) + (4 . 2074)) + ) + ) + ) + (define script-alist '()) (define (articulation-to-scriptdef a) (assoc a script-alist) @@ -163,46 +202,52 @@ (assoc s cmr-alist ) ) +(define (define-font name-mag) + (cons name-mag + (string-append "\\magfont" + (string-encode-integer (hash (car name-mag) 1000000)) + "m" + (string-encode-integer (cdr name-mag))) -(define (tex-scm action-name) + ) + ) + +(define font-name-alist '()) +(define (define-fonts names) + (set! font-name-alist (map define-font names)) + (apply string-append (map (lambda (x) + (string-append "\\font" (cdr x) "=" + (symbol->string (caar x)) + " scaled " + (number->string (magstep (cdar x))) + "\n")) + font-name-alist + ) + ) + ) + + +(define (tex-scm action-name) (define (unknown) "%\n\\unknown%\n") - (define font-alist '()) - (define font-count 0) - (define current-font "") - (define (clear-fontcache) - (begin - (set! font-alist '()) - (set! font-count 0) - (set! current-font ""))) - - (define (cached-fontname i) - (string-append - "\\lilyfont" - (make-string 1 (integer->char (+ 65 i))))) - (define (select-font font-name magnification) - (if (not (equal? font-name current-font)) - (let* ((font-cmd (assoc font-name font-alist))) - (set! current-font font-name) - (if (eq? font-cmd #f) - (begin - (set! font-cmd (cached-fontname font-count)) - (set! font-alist (acons font-name font-cmd font-alist)) - (set! font-count (+ 1 font-count)) - (if (equal? font-name "") - (error "Empty fontname -- SELECT-FONT")) - (if (> magnification 0) - (string-append "\\font" font-cmd "=" font-name - " scaled \\magstep " - (number->string magnification) font-cmd) - (string-append "\\font" font-cmd "=" font-name font-cmd))) - - (cdr font-cmd))) - "" ;no switch needed - )) + (define (select-font font-name-symbol) + (let* + ( + (c (assoc font-name-symbol font-name-alist)) + ) + + (if (eq? c #f) + (begin + (ly-warn (string-append + "Programming error: No such font known " (car font-name-symbol))) + "") ; issue no command + (cdr c)) + + + )) (define (beam width slope thick) (embedded-ps ((ps-scm 'beam) width slope thick))) @@ -228,6 +273,9 @@ (define (embedded-ps s) (string-append "\\embeddedps{" s "}")) + (define (comment s) + (string-append "% " s)) + (define (end-output) "\n\\EndLilyPondOutput") @@ -308,7 +356,6 @@ (define (start-line ht) (begin - (clear-fontcache) (string-append"\\vbox to " (number->dim ht) "{\\hbox{%\n")) ) (define (stop-line) @@ -398,11 +445,7 @@ (define font-alist '()) (define font-count 0) (define current-font "") - (define (clear-fontcache) - (begin - (set! font-alist '()) - (set! font-count 0) - (set! current-font ""))) + (define (cached-fontname i) (string-append @@ -411,13 +454,13 @@ (define (mag-to-size m) (number->string (case m - ('0 12) - ('1 12) - ('2 14) ; really: 14.400 - ('3 17) ; really: 17.280 - ('4 21) ; really: 20.736 - ('5 24) ; really: 24.888 - ('6 30) ; really: 29.856 + (0 12) + (1 12) + (2 14) ; really: 14.400 + (3 17) ; really: 17.280 + (4 21) ; really: 20.736 + (5 24) ; really: 24.888 + (6 30) ; really: 29.856 ))) (define (select-font font-name magnification) @@ -444,6 +487,9 @@ (string-append (numbers->string (list width slope thick)) " draw_beam" )) + (define (comment s) + (string-append "% " s)) + (define (bracket arch_angle arch_width arch_height width height arch_thick thick) (string-append (numbers->string (list arch_angle arch_width arch_height width height arch_thick thick)) " draw_bracket" )) @@ -546,7 +592,6 @@ (define (start-line height) (begin - (clear-fontcache) "\nstart_line {\n")) (define (stem breapth width depth height) diff --git a/tex/lilyponddefs.tex b/tex/lilyponddefs.tex index d983e92830..b25930520d 100644 --- a/tex/lilyponddefs.tex +++ b/tex/lilyponddefs.tex @@ -29,14 +29,6 @@ \def\leftalign#1{\hbox to 0pt{#1\hss}} \input feta20.tex -\font\textmusic=cmmi10 -\def\textsharp{\raise.4ex\hbox{\textmusic\char"5D}} -\def\textnatural{\raise.4ex\hbox{\textmusic\char"5C}} -\def\textflat{\raise.2ex\hbox{\textmusic\char"5B}} - - - - % stacked horizontal lines \def\interscoreline{\vskip 16pt} -- 2.39.5