From: Han-Wen Nienhuys Date: Sun, 21 Nov 2004 22:43:43 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: release/2.5.14~505 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=14f577bacbfa4eb1f349de40e8f53b866634a0ec;p=lilypond.git *** empty log message *** --- diff --git a/lily/afm.cc b/lily/afm.cc index 456f4893c2..e0961d7f45 100644 --- a/lily/afm.cc +++ b/lily/afm.cc @@ -165,7 +165,7 @@ Offset Adobe_font_metric::get_indexed_wxwy (int k) const { AFM_CharMetricInfo const *mi = font_info_->cmi + k; -#if 1 /* Fine for feta; ec-fonts-mftraced do not have AFM :-( +#if 1 /* Fine for feta; ec-fonts-mftraced do not have AFM :-( */ return Offset (mi->wx, mi->wy) * 0.001 PT; #else /* FIXME: about right for lmodern. */ return Offset (mi->wx, mi->wy) * 1.14 * 0.001 PT; diff --git a/lily/note-heads-engraver.cc b/lily/note-heads-engraver.cc index 01f3c0ed31..8ec38e34d4 100644 --- a/lily/note-heads-engraver.cc +++ b/lily/note-heads-engraver.cc @@ -19,13 +19,13 @@ class Note_heads_engraver : public Engraver { Link_array notes_; Link_array dots_; - Link_array note_reqs_; + Link_array note_evs_; public: TRANSLATOR_DECLARATIONS (Note_heads_engraver); protected: - virtual bool try_music (Music *req) ; + virtual bool try_music (Music *ev) ; virtual void process_music (); virtual void stop_translation_timestep (); @@ -40,11 +40,11 @@ Note_heads_engraver::try_music (Music *m) { if (m->is_mus_type ("note-event")) { - note_reqs_.push (m); + note_evs_.push (m); return true; } else if (m->is_mus_type ("busy-playing-event")) - return note_reqs_.size (); + return note_evs_.size (); return false; } @@ -53,13 +53,13 @@ Note_heads_engraver::try_music (Music *m) void Note_heads_engraver::process_music () { - for (int i=0; i < note_reqs_.size (); i++) + for (int i=0; i < note_evs_.size (); i++) { - Music * req = note_reqs_[i]; - Item *note = make_item ("NoteHead", req->self_scm ()); + Music * ev = note_evs_[i]; + Item *note = make_item ("NoteHead", ev->self_scm ()); - Duration dur = *unsmob_duration (req->get_property ("duration")); + Duration dur = *unsmob_duration (ev->get_property ("duration")); note->set_property ("duration-log", scm_int2num (dur.duration_log ())); if (dur.dot_count ()) @@ -76,7 +76,7 @@ Note_heads_engraver::process_music () dots_.push (d); } - Pitch *pit =unsmob_pitch (req->get_property ("pitch")); + Pitch *pit =unsmob_pitch (ev->get_property ("pitch")); int pos = pit ? pit->steps () : 0; SCM c0 = get_property ("middleCPosition"); @@ -93,7 +93,7 @@ Note_heads_engraver::stop_translation_timestep () { notes_.clear (); dots_.clear (); - note_reqs_.clear (); + note_evs_.clear (); } diff --git a/lily/parser.yy b/lily/parser.yy index 9439c6f3bc..f42cd76f05 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1740,7 +1740,7 @@ command_req: { key->set_property ("pitch-alist", $3); key->set_property ("tonic", Pitch (0,0,0).smobbed_copy ()); - ((Music*)key)->transpose (* unsmob_pitch ($2)); + key->transpose (* unsmob_pitch ($2)); } else { THIS->parser_error (_ ("Second argument must be pitch list.")); } diff --git a/lily/shape-note-heads-engraver.cc b/lily/shape-note-heads-engraver.cc new file mode 100644 index 0000000000..694e9ea99d --- /dev/null +++ b/lily/shape-note-heads-engraver.cc @@ -0,0 +1,134 @@ +/* + shape-note-heads-engraver.cc -- part of GNU LilyPond + + (c) 1997--2004 Han-Wen Nienhuys +*/ + +#include + +#include "rhythmic-head.hh" +#include "output-def.hh" +#include "dots.hh" +#include "dot-column.hh" +#include "staff-symbol-referencer.hh" +#include "item.hh" +#include "engraver.hh" +#include "warn.hh" + +class Shape_note_heads_engraver : public Engraver +{ + Link_array notes_; + Link_array dots_; + Link_array note_evs_; + +public: + TRANSLATOR_DECLARATIONS (Shape_note_heads_engraver); + +protected: + virtual bool try_music (Music *ev) ; + virtual void process_music (); + virtual void stop_translation_timestep (); +}; + +Shape_note_heads_engraver::Shape_note_heads_engraver () +{ +} + +bool +Shape_note_heads_engraver::try_music (Music *m) +{ + if (m->is_mus_type ("note-event")) + { + note_evs_.push (m); + return true; + } + else if (m->is_mus_type ("busy-playing-event")) + return note_evs_.size (); + + return false; +} + + +void +Shape_note_heads_engraver::process_music () +{ + if (!note_evs_.size()) + return ; + + for (int i=0; i < note_evs_.size (); i++) + { + + Music * ev = note_evs_[i]; + Item *note = make_item ("NoteHead", ev->self_scm ()); + + Duration dur = *unsmob_duration (ev->get_property ("duration")); + + note->set_property ("duration-log", scm_int2num (dur.duration_log ())); + if (dur.dot_count ()) + { + Item * d = make_item ("Dots", note->self_scm ()); + Rhythmic_head::set_dots (note, d); + + if (dur.dot_count () + != robust_scm2int (d->get_property ("dot-count"), 0)) + d->set_property ("dot-count", scm_int2num (dur.dot_count ())); + + d->set_parent (note, Y_AXIS); + + dots_.push (d); + } + + Pitch *pit = unsmob_pitch (ev->get_property ("pitch")); + + SCM scm_tonic = get_property ("tonic"); + Pitch tonic (0,0,0); + if (unsmob_pitch (scm_tonic)) + tonic = *unsmob_pitch (scm_tonic); + + unsigned int delta = (pit->get_notename() - tonic.get_notename() + 7) % 7; + SCM shape_vector = get_property ("shapeNoteStyles"); + + SCM style = SCM_EOL; + if (ly_c_vector_p (shape_vector) + && SCM_VECTOR_LENGTH (shape_vector) > delta + && scm_is_symbol (scm_vector_ref (shape_vector, scm_from_int (delta)))) + { + style = scm_vector_ref (shape_vector, scm_from_int (delta)); + } + if (scm_is_symbol (style)) + { + note->set_property ("style", style); + } + + int pos = pit ? pit->steps () : 0; + SCM c0 = get_property ("middleCPosition"); + if (scm_is_number (c0)) + pos += scm_to_int (c0); + + note->set_property ("staff-position", scm_int2num (pos)); + notes_.push (note); + + + + + + } +} + +void +Shape_note_heads_engraver::stop_translation_timestep () +{ + notes_.clear (); + dots_.clear (); + note_evs_.clear (); +} + + + +ENTER_DESCRIPTION (Shape_note_heads_engraver, +/* descr */ "Generate noteheads.", +/* creats*/ "NoteHead Dots", +/* accepts */ "note-event busy-playing-event", +/* acks */ "", +/* reads */ "middleCPosition shapeNoteStyles", +/* write */ ""); diff --git a/lily/stencil.cc b/lily/stencil.cc index 00c72ae1a3..35338f0b6c 100644 --- a/lily/stencil.cc +++ b/lily/stencil.cc @@ -163,6 +163,7 @@ Stencil::moved_to_edge (Axis a, Direction d, Stencil const &s, { programming_error ("Stencil::moved_to_edge: adding empty stencil."); his_extent = 0.0; + SCM_ASSERT_TYPE(0, SCM_EOL, SCM_ARG1, __FUNCTION__, ""); } else his_extent = i[-d]; diff --git a/ly/paper-defaults.ly b/ly/paper-defaults.ly index 612216d9ca..95d6b039fd 100644 --- a/ly/paper-defaults.ly +++ b/ly/paper-defaults.ly @@ -66,10 +66,12 @@ %% use lmodern in latin1 (cork) flavour if EC is not available. #(define text-font-defaults - `((font-encoding - . cork-lm) -; . ,(if (and ; (not (ly:kpathsea-find-file "ecrm10.pfa")) -; (ly:kpathsea-find-file "cork-lm.enc")) 'cork-lm 'Extended-TeX-Font-Encoding---Latin)) + `((font-encoding . +; cork-lm + Extended-TeX-Font-Encoding---Latin +; ,(if (and (not (ly:kpathsea-find-file "ecrm10.pfa")) +; (ly:kpathsea-find-file "cork-lm.enc")) 'cork-lm 'Extended-TeX-Font-Encoding---Latin) + ) (baseline-skip . 2) (word-space . 0.6))) diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index 36886996d6..ddd3b762ea 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -127,7 +127,7 @@ gsave /ecrm10 findfont point-stencil) stencils))) - (if (null? (remove ly:stencil-empty? orig-stencils)) +o (if (null? (remove ly:stencil-empty? orig-stencils)) empty-stencil (stack-stencils X RIGHT fill-space line-stencils)))) diff --git a/scm/lily.scm b/scm/lily.scm index c1a0bdd125..074fa58e4c 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -333,7 +333,7 @@ predicates. Print a message at LOCATION if any predicate failed." (for-each (lambda (f) (catch 'ly-file-failed (lambda () (ly:parse-file f)) handler) - (dump-gc-protects) +; (dump-gc-protects) ) files) diff --git a/scm/output-ps.scm b/scm/output-ps.scm index 8f937d79d8..60ba674721 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -265,7 +265,8 @@ out-vec))) ))) -(define text old-text) +;(define text old-text) +(define text new-text) (define (white-text scale s) (let ((mystring (string-append "(" s ") " (number->string scale) " /Helvetica-bold " diff --git a/scm/page-layout.scm b/scm/page-layout.scm index 98eede9aba..365bf6d49c 100644 --- a/scm/page-layout.scm +++ b/scm/page-layout.scm @@ -43,7 +43,9 @@ (header-proc layout scopes number last?) #f))) - (if (and (number? sep) (ly:stencil? head-stencil)) + (if (and (number? sep) + (ly:stencil? head-stencil) + (not (ly:stencil-empty? head-stencil))) (set! head-stencil (ly:stencil-combine-at-edge stencil Y dir head-stencil diff --git a/scm/stencil.scm b/scm/stencil.scm index 3957d40f04..97e6470727 100644 --- a/scm/stencil.scm +++ b/scm/stencil.scm @@ -6,12 +6,12 @@ (define-public (stack-stencils axis dir padding stils) "Stack stencils STILS in direction AXIS, DIR, using PADDING." - (if (null? stils) - empty-stencil - (if (pair? stils) - (ly:stencil-combine-at-edge - (car stils) axis dir (stack-stencils axis dir padding (cdr stils)) - padding)))) + (cond + ((null? stils) empty-stencil) + ((null? (cdr stils)) (car stils)) + (else (ly:stencil-combine-at-edge + (car stils) axis dir (stack-stencils axis dir padding (cdr stils)) + padding)))) (define-public (stack-lines dir padding baseline stils) "Stack vertically with a baseline-skip."