]> git.donarmstrong.com Git - lilypond.git/commitdiff
*** empty log message ***
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 21 Nov 2004 22:43:43 +0000 (22:43 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 21 Nov 2004 22:43:43 +0000 (22:43 +0000)
lily/afm.cc
lily/note-heads-engraver.cc
lily/parser.yy
lily/shape-note-heads-engraver.cc [new file with mode: 0644]
lily/stencil.cc
ly/paper-defaults.ly
scm/define-markup-commands.scm
scm/lily.scm
scm/output-ps.scm
scm/page-layout.scm
scm/stencil.scm

index 456f4893c2cc96a9ab8d2efd56baf9816ac29e97..e0961d7f456e5b74ab55b94995fe3c1ef9d4ec0d 100644 (file)
@@ -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;
index 01f3c0ed312948ae3b97844bdb7d47af0041a426..8ec38e34d4d4e7c7a4078a482314dbd955b0511c 100644 (file)
@@ -19,13 +19,13 @@ class Note_heads_engraver : public Engraver
 {
   Link_array<Item> notes_;
   Link_array<Item> dots_;
-  Link_array<Music> note_reqs_;
+  Link_array<Music> 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 ();
 }
 
 
index 9439c6f3bc8dd664078175817f1f746e353f4747..f42cd76f05c371e13a3ab22491c2cfc1f62734bc 100644 (file)
@@ -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 (file)
index 0000000..694e9ea
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+  shape-note-heads-engraver.cc -- part of GNU LilyPond
+
+  (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+#include <cctype>
+
+#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<Item> notes_;
+  Link_array<Item> dots_;
+  Link_array<Music> 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 */       "");
index 00c72ae1a39e367ae1cc491fb3014ed7dc3e2517..35338f0b6c25bf00b05773af7202cf470ff9875f 100644 (file)
@@ -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];
index 612216d9cae7fd36946558400fdf982ccf94e063..95d6b039fdc866b4facea2915c222b13b7e9639b 100644 (file)
 
     %% 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)))
 
index 36886996d68057d12cff771f615ac4bf208386bf..ddd3b762eaec55835736de28cab127d9f734638f 100644 (file)
@@ -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))))
 
index c1a0bdd125cd543969825260768f431be385b635..074fa58e4c9bbca5251013bf85b532f2aed1e7a3 100644 (file)
@@ -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)
 
index 8f937d79d8ff3a9395caee065564e03121219b54..60ba6747213eca596267a66574eeadff8a2cbe0d 100644 (file)
        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 "
index 98eede9abaffa9bf5dd6b281747d7b8e90e46f9e..365bf6d49c8298f45beb6cd2008dd2ad4847aa2a 100644 (file)
@@ -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
index 3957d40f046d2fd8cd59d1825be2297b9b26f14a..97e6470727c4ea8e4b9487a89b9983529da86441 100644 (file)
@@ -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."