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;
{
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 ();
{
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;
}
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 ())
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");
{
notes_.clear ();
dots_.clear ();
- note_reqs_.clear ();
+ note_evs_.clear ();
}
{
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."));
}
--- /dev/null
+/*
+ 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 */ "");
{
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];
%% 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)))
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))))
(for-each
(lambda (f)
(catch 'ly-file-failed (lambda () (ly:parse-file f)) handler)
- (dump-gc-protects)
+; (dump-gc-protects)
)
files)
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 "
(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
(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."