---- ../lilypond-1.3.99.jcn1/CHANGES Wed Oct 25 21:33:46 2000
-++ b/CHANGES Sat Oct 28 15:44:16 2000
-@@ -1,3 +1,16 @@
-1.3.99.jcn2
-===========
-
-* Font initialisation and markup translation fixes.
-
1.3.99.hwn2
===========
-* tweaks of .scm font-selection.
+* Tweaks of .scm font-selection.
* Rewrote font management of Score_element and Paper_def.
+* Introduced outputscale: internally do computation in terms of
+outputscale. Prepare to deprecate staffspace internally. Rewrote
+.scm side of font selectioning.
- 1.3.99.jcn1
- ===========
- --- ../lilypond-1.3.99/CHANGES Wed Oct 25 07:03:07 2000
-++ b/CHANGES Fri Oct 27 20:28:15 2000
-@@ -1,3 +1,25 @@
-1.3.99.lec1
-===========
-* fixes to abc2ly:
-
- puts text above rather than below the staff.
-
- interprets %%MIDI nobarlines (this is an esoteric change, but
- I need it to use the program at all -- it assumes that
- accidentals are not persistent.
-
- Interprets the -8va tenor g clef.
-
- Fix to previously claimed fix for setting L: before M:
-
- Uses current rather than deprecated syntax for \property
- Staff.TimeSignature
-
- Allows a space between key letter and mode.
-
- Fix to translation table for :|:
-
-
- 1.3.98.jcn2
- ===========
- 1.3.99.jcn1
+1.3.99.jcn1
===========
* Made several font size and initialisation fixes.
- Improved robustness: Lily almost never crashes.
+* Rewritten font selection, Latex-NFSS like
+
* Piano pedal support, Arpeggios
* MIDI: dynamics, tempo changes
PACKAGE_NAME=LilyPond
MAJOR_VERSION=1
MINOR_VERSION=3
-PATCH_LEVEL=99
-MY_PATCH_LEVEL=jcn3
+PATCH_LEVEL=100
+MY_PATCH_LEVEL=
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
+
\score { \notes \relative c{
-c''4 c2 c8 c16 c16 c1 c\breve
-\property Voice.noteHeadStyle = #'diamond
+% anyone wanna pop?
+c''4 c2 c8 c16 c16 c1 c\breve
+\property Voice.NoteHead \push #'style = #'diamond
c4 c2 c8 c16 c16 c1 c\breve
-\property Voice.noteHeadStyle = #'transparent
+\property Voice.NoteHead \push #'style = #'transparent
c4 c2 c8 c16 c16 c1 c\breve
-\property Voice.noteHeadStyle = #'cross
+\property Voice.NoteHead \push #'style = #'cross
c4 c2 c8 c16 c16 c1 c\breve
-\property Voice.noteHeadStyle = #'mensural
+\property Voice.NoteHead \push #'style = #'mensural
c4 c2 c8 c16 c16 c1 c\breve c\longa
-\property Voice.noteHeadStyle = #'harmonic
+\property Voice.NoteHead \push #'style = #'harmonic
c4 c2 c8 c16 c16 c1 c\breve
-\property Voice.noteHeadStyle = #'baroque
+\property Voice.NoteHead \push #'style = #'baroque
c4 c2 c8 c16 c16 c1 c\breve c\longa
+
\context Voice <
\context Thread = TA
- { \property Thread.noteHeadStyle = #'cross
- \property Voice.verticalDirection = \up c16}
+ {
+ \property Thread.NoteHead \push #'style = #'cross
+ \property Voice.Stem \push #'direction = #1
+ c16
+ }
\context Thread = TB
- { \property Thread.noteHeadStyle = #'default a16 }
-
+ { \property Thread.NoteHead \push #'style = #'default a16 }
+
\context Thread = TC
- { \property Thread.noteHeadStyle = #'mensural d16 }
-
+ { \property Thread.NoteHead \push #'style = #'mensural d16 }
+
>
-
+
\context Voice <\context Thread = TA {
- \property Thread.noteHeadStyle = #'default
+ \property Thread.NoteHead \push #'style = #'default
c4 c4 }
\context Thread = TB {
- \property Thread.noteHeadStyle = #'mensural
+ \property Thread.NoteHead \push #'style = #'mensural
c'4 \stemDown c
} >
}
\paper {
-
- }
+
+
+}
}
-\version "1.3.96";
Box
-Adobe_font_metric::get_char (int code, Real mag) const
+Adobe_font_metric::get_char (int code) const
{
AFM_CharMetricInfo const
* c = find_ascii_metric (code,false);
if (c)
b = afm_bbox_to_box (c->charBBox);
- b.scale (mag);
return b;
}
if (ok)
{
- error (_f ("Error parsing AFM file: %s", nm.ch_C ()));
+ error (_("Error parsing AFM file"));
exit (2);
}
fclose (f);
AFM_free (font_inf_);
}
+/*
+ return a molecule, without fontification
+ */
Molecule
-Adobe_font_metric::find_by_name (String s, Real mag) const
+Adobe_font_metric::find_by_name (String s) const
{
AFM_CharMetricInfo const *cm = find_char_metric (s, false);
gh_int2scm (cm->code),
SCM_UNDEFINED));
- at= fontify_atom ((Font_metric*)this, at);
+ // at= fontify_atom ((Font_metric*)this, at);
Box b = afm_bbox_to_box (cm->charBBox);
- b.scale (mag);
+
return Molecule (b, at);
}
{
afm_p_dict_ = new Scheme_hash_table;
tfm_p_dict_ = new Scheme_hash_table;
- scaled_p_dict_ = new Scheme_hash_table;
search_path_.parse_path (path);
}
{
scm_unprotect_object (afm_p_dict_->self_scm ());
scm_unprotect_object (tfm_p_dict_->self_scm ());
- scm_unprotect_object (scaled_p_dict_->self_scm ());
}
Adobe_font_metric *
{
SCM sname = ly_symbol2scm (name.ch_C ());
+ SCM name_str = gh_str02scm (name.ch_C ());
+
SCM val;
if (!afm_p_dict_->try_retrieve (sname, &val))
progress_indication ("[" + path);
val = read_afm_file (path);
- unsmob_metrics (val)->name_ = sname;
+ unsmob_metrics (val)->description_ = gh_cons (name_str, gh_double2scm (1.0));
if (verbose_global_b)
progress_indication ("]");
return dynamic_cast<Adobe_font_metric*> (unsmob_metrics (val));
}
-Scaled_font_metric *
-All_font_metrics::find_scaled (String nm, Real m)
-{
- String index = nm + "@" + to_str (m);
- SCM sname = ly_symbol2scm (index.ch_C ());
-
- SCM val;
-
- if (!scaled_p_dict_->try_retrieve (sname, &val))
- {
- Font_metric *f = find_font (nm);
- val = Scaled_font_metric::make_scaled_font_metric (f, m);
- scaled_p_dict_->set (sname, val);
-
- scm_unprotect_object (val);
- }
-
- return dynamic_cast<Scaled_font_metric*> (unsmob_metrics (val));
-}
Tex_font_metric *
All_font_metrics::find_tfm (String name)
{
SCM sname = ly_symbol2scm (name.ch_C ());
+ SCM name_str = gh_str02scm (name.ch_C ());
SCM val;
if (!tfm_p_dict_->try_retrieve (sname, &val))
if (verbose_global_b)
progress_indication ("]");
- unsmob_metrics (val)->name_ = sname;
+ unsmob_metrics (val)->description_ = gh_cons (name_str, gh_double2scm (1.0));
tfm_p_dict_->set (sname, val);
scm_unprotect_object (val);
Font_metric *
All_font_metrics::find_font (String name)
{
- Font_metric * f=0;
-
- f= find_afm (name);
+ Font_metric * f= find_afm (name);
if (f)
return f;
return 0;
}
-SCM
-All_font_metrics::font_descriptions () const
-{
- SCM l[] = {0,0,0};
- l[0] = afm_p_dict_->to_alist ();
- l[1] = tfm_p_dict_->to_alist ();
- l[2] = scaled_p_dict_->to_alist ();
-
- SCM list = SCM_EOL;
- for (int i=0; i < 3; i++)
- {
- for (SCM s = l[i]; gh_pair_p (s); s = gh_cdr (s))
- {
- Font_metric * fm = unsmob_metrics (gh_cdar (s));
-
- list = gh_cons (fm->description (), list);
- }
- }
- return list;
-}
-
-
-
-Font_metric*
-find_font (String name)
-{
- return all_fonts_global_p->find_font (name);
-}
#include "molecule.hh"
#include "paper-def.hh"
-#include "font-metric.hh"
#include "arpeggio.hh"
#include "score-element.hh"
#include "stem.hh"
#include "staff-symbol-referencer.hh"
#include "staff-symbol.hh"
#include "warn.hh"
+#include "font-interface.hh"
bool
Arpeggio::has_interface (Score_element* me)
}
Molecule mol;
- Molecule arpeggio = me->get_default_font ()->find_by_name ("scripts-arpeggio");
+ Molecule arpeggio = Font_interface::get_default_font (me)->find_by_name ("scripts-arpeggio");
Real y = heads[LEFT];
while (y < heads[RIGHT])
Score_element * me = unsmob_element (smob);
Axis a = (Axis)gh_scm2int (axis);
assert (a == X_AXIS);
- Molecule arpeggio = me->get_default_font ()->find_by_name ("scripts-arpeggio");
+ Molecule arpeggio = Font_interface::get_default_font (me)->find_by_name ("scripts-arpeggio");
return ly_interval2scm (arpeggio.extent (X_AXIS) * 1.5);
}
#include "string.hh"
#include "molecule.hh"
#include "paper-def.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "debug.hh"
#include "all-font-metrics.hh"
#include "item.hh"
Molecule thin = simple_barline (me, hair, h);
Molecule thick = simple_barline (me, fatline, h);
- Molecule colon = me->get_default_font ()->find_by_name ("dots-repeatcolon");
+ Molecule colon = Font_interface::get_default_font (me)->find_by_name ("dots-repeatcolon");
Molecule m;
#include "chord.hh"
#include "musical-request.hh"
#include "paper-def.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "paper-def.hh"
#include "main.hh"
#include "dimensions.hh"
#include "chord-name.hh"
#include "molecule.hh"
#include "paper-def.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "score-element.hh"
#include "paper-column.hh"
#include "line-of-score.hh"
#include "string.hh"
#include "molecule.hh"
#include "item.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
/*
FIXME: should use symbol for #'style.
SCM glyph = sc->get_elt_property ("glyph");
if (gh_string_p (glyph))
{
- return sc->get_default_font ()->find_by_name (String (ly_scm2string (glyph))).create_scheme ();
+ return Font_interface::get_default_font (sc)->find_by_name (String (ly_scm2string (glyph))).create_scheme ();
}
else
{
#include "molecule.hh"
#include "crescendo.hh"
#include "spanner.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "dimensions.hh"
#include "paper-def.hh"
#include "debug.hh"
#include "item.hh"
#include "molecule.hh"
#include "paper-def.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "lookup.hh"
#include "staff-symbol-referencer.hh"
#include "directional-element-interface.hh"
if (gh_number_p (c))
{
- Molecule d = sc->get_default_font ()->find_by_name (String ("dots-dot"));
+ Molecule d = Font_interface::get_default_font (sc)->find_by_name (String ("dots-dot"));
Real dw = d.extent (X_AXIS).length ();
// d.translate_axis (-dw, X_AXIS);
--- /dev/null
+/*
+ font-interface.cc -- implement Font_interface
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#include "all-font-metrics.hh"
+#include "font-metric.hh"
+#include "font-interface.hh"
+#include "score-element.hh"
+#include "paper-def.hh"
+
+/*
+ todO : split up this func, reuse in text_item?
+ */
+Font_metric *
+Font_interface::get_default_font (Score_element*me)
+{
+ Font_metric * fm = unsmob_metrics (me->get_elt_property ("font"));
+ if (fm)
+ return fm;
+
+ SCM ss = me->paper_l ()->style_sheet_;
+
+ SCM proc = gh_cdr (scm_assoc (ly_symbol2scm ("properties-to-font"),
+ ss));
+
+ SCM fonts = gh_cdr (scm_assoc (ly_symbol2scm ("fonts"), ss));
+ SCM defaults = gh_cdr (scm_assoc (ly_symbol2scm ("font-defaults"),
+ ss));
+
+ assert (gh_procedure_p (proc));
+ SCM font_name = gh_call2 (proc, fonts,
+ gh_list (me->mutable_property_alist_,
+ me->immutable_property_alist_,
+ defaults,
+ SCM_UNDEFINED));
+
+ fm = me->paper_l ()->find_font (font_name, 1.0);
+ me->set_elt_property ("font", fm->self_scm ());
+ return fm;
+}
#include "string.hh"
Box
-Font_metric::text_dimension (String text, Real mag) const
+Font_metric::text_dimension (String text) const
{
Interval ydims;
Real w=0.0;
break;
default:
- Box b = get_char ((unsigned char)text[i],mag);
+ Box b = get_char ((unsigned char)text[i]);
// Ugh, use the width of 'x' for unknown characters
if (b[X_AXIS].length () == 0)
- b = get_char ((unsigned char)'x',mag);
+ b = get_char ((unsigned char)'x');
w += b[X_AXIS].length ();
ydims.unite (b[Y_AXIS]);
Box
-Scaled_font_metric::text_dimension (String t,Real mag) const
+Scaled_font_metric::text_dimension (String t) const
{
Box b (orig_l_->text_dimension (t));
- b.scale (magnification_f_ * mag);
+ b.scale (magnification_f_);
return b;
}
Font_metric::Font_metric ()
{
- name_ = SCM_EOL;
+ description_ = SCM_EOL;
smobify_self ();
}
Box
-Font_metric::get_char (int, Real )const
+Font_metric::get_char (int )const
{
return Box (Interval(0,0),Interval (0,0));
}
-SCM
-Font_metric::description () const
-{
- return gh_cons (name_, gh_int2scm (0));
-}
-
SCM
Font_metric::mark_smob (SCM s)
{
Font_metric * m = (Font_metric*) SCM_CELL_WORD_1(s);
- return m->name_;
+ return m->description_;
}
int
{
Font_metric *m = unsmob_metrics (s);
scm_puts ("#<Font_metric ", port);
- scm_display (m->name_, port);
+ scm_write (m->description_, port);
scm_puts (">", port);
return 1;
}
IMPLEMENT_TYPE_P (Font_metric, "font-metric?");
Molecule
-Font_metric::find_by_name (String, Real mag ) const
+Font_metric::find_by_name (String) const
{
assert (false);
}
+
+
+
#include "grace-align-item.hh"
#include "align-interface.hh"
-#include "font-metric.hh"
+
#include "paper-column.hh"
#include "paper-def.hh"
{
AFM_Font_info * font_inf_;
- Box get_char (int, Real mag =1.0) const;
+ virtual Box get_char (int) const;
AFM_CharMetricInfo const *find_char_metric (String name, bool warn=true) const;
AFM_CharMetricInfo const *find_ascii_metric (int, bool warn=true) const;
Array<int> ascii_to_metric_idx_;
Dictionary<int> name_to_metric_dict_;
- virtual Molecule find_by_name (String, Real mag = 1.0) const;
+ virtual Molecule find_by_name (String) const;
Adobe_font_metric (AFM_Font_info*);
};
{
Scheme_hash_table *afm_p_dict_;
Scheme_hash_table *tfm_p_dict_;
- Scheme_hash_table *scaled_p_dict_;
-
File_path search_path_;
public:
~All_font_metrics ();
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 , Real);
+
All_font_metrics (String search_path);
SCM font_descriptions () const;
};
-Font_metric * find_font (String name);
-
#endif /* ALL_FONTS_HH */
--- /dev/null
+/*
+ font-interface.hh -- declare Font_interface
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ */
+
+#ifndef FONT_INTERFACE_HH
+#define FONT_INTERFACE_HH
+
+#include "lily-proto.hh"
+#include "font-metric.hh"
+
+struct Font_interface
+{
+ static Font_metric * get_default_font (Score_element*);
+};
+
+#endif /* FONT_INTERFACE_HH */
struct Font_metric
{
public:
- SCM name_;
- virtual SCM description () const;
- virtual Box get_char (int ascii, Real mag) const;
- virtual Box text_dimension (String, Real mag = 1.0) const;
- virtual Molecule find_by_name (String, Real mag = 1.0) const;
+ SCM description_;
+
+ virtual Box get_char (int ascii) const;
+ virtual Box text_dimension (String) const;
+ virtual Molecule find_by_name (String) const;
DECLARE_SMOBS(Font_metric,);
private:
};
+/*
+ Perhaps junk this, and move iface to paper_def?
+ */
struct Scaled_font_metric : public Font_metric
{
- virtual SCM description () const;
- virtual Box text_dimension (String, Real) const;
- virtual Molecule find_by_name (String, Real) const;
+ virtual Box text_dimension (String) const;
+ virtual Molecule find_by_name (String) const;
static SCM make_scaled_font_metric (Font_metric*, Real);
protected:
Font_metric *orig_l_;
protected:
VIRTUAL_COPY_CONS(Music_output_def);
+ Protected_scm scaled_fonts_;
public:
Protected_scm style_sheet_;
-
+ SCM font_descriptions ()const;
virtual ~Paper_def ();
static int default_count_i_;
/*
Paper_stream* paper_stream_p () const;
String base_output_str () const;
+ Font_metric * find_font (SCM name, Real mag);
+
// urg
friend int yyparse (void*);
};
*/
class Score_element {
public:
- Font_metric * get_default_font ()const;
-
SCM immutable_property_alist_;
SCM mutable_property_alist_;
Score_element *original_l_;
#include "lily-proto.hh"
#include "lily-guile.hh"
#include "stem-info.hh"
+#include "drul-array.hh"
class Stem
{
public:
static SCM make_tfm (String filename);
- Box get_char (int,Real = 1.0) const;
+ Box get_char (int) const;
Tex_font_char_metric const *find_ascii (int ascii, bool warn=true) const;
String str () const;
#include "key-item.hh"
#include "molecule.hh"
#include "paper-def.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "staff-symbol-referencer.hh"
#include "lookup.hh"
for (SCM s = newas; gh_pair_p (s); s = gh_cdr (s))
{
int a = gh_scm2int (gh_cdar (s));
- Molecule m = me->get_default_font ()->find_by_name ("accidentals-" + to_str (a));
+ Molecule m = Font_interface::get_default_font (me)->find_by_name ("accidentals-" + to_str (a));
m.translate_axis (calculate_position(me, gh_car (s)) * inter, Y_AXIS);
mol.add_at_edge (X_AXIS, LEFT, m, 0);
}
if (found == SCM_EOL || gh_cdr (found) != gh_cdar (old))
{
- Molecule m =me->get_default_font ()->find_by_name ("accidentals-0");
+ Molecule m =Font_interface::get_default_font (me)->find_by_name ("accidentals-0");
m.translate_axis (calculate_position (me, gh_car (old)) * inter, Y_AXIS);
mol.add_at_edge (X_AXIS, LEFT, m,0);
/*
font defs;
*/
- SCM font_names = ly_quote_scm (all_fonts_global_p->font_descriptions ());
+ SCM font_names = ly_quote_scm (paper_l()->font_descriptions ());
output_scheme (gh_list (ly_symbol2scm ("define-fonts"),
font_names,
SCM_UNDEFINED));
#include "local-key-item.hh"
#include "molecule.hh"
#include "staff-symbol-referencer.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "paper-def.hh"
#include "musical-request.hh"
#include "rhythmic-head.hh"
Molecule
Local_key_item::parenthesize (Score_element*me, Molecule m)
{
- Molecule open = me->get_default_font ()->find_by_name (String ("accidentals-("));
- Molecule close = me->get_default_font ()->find_by_name (String ("accidentals-)"));
+ Molecule open = Font_interface::get_default_font (me)->find_by_name (String ("accidentals-("));
+ Molecule close = Font_interface::get_default_font (me)->find_by_name (String ("accidentals-)"));
m.add_at_edge(X_AXIS, LEFT, Molecule(open), 0);
m.add_at_edge(X_AXIS, RIGHT, Molecule(close), 0);
Real dy = (gh_number_p (c0) ? gh_scm2int (c0) : 0 + p.notename_i_)
* note_distance;
- Molecule acc (me->get_default_font ()->find_by_name (String ("accidentals-")
+ Molecule acc (Font_interface::get_default_font (me)->find_by_name (String ("accidentals-")
+ to_str (p.accidental_i_)));
if (scm_memq (ly_symbol2scm ("natural"), gh_car (s)) != SCM_BOOL_F)
{
- Molecule prefix = me->get_default_font ()->find_by_name (String ("accidentals-0"));
+ Molecule prefix = Font_interface::get_default_font (me)->find_by_name (String ("accidentals-0"));
acc.add_at_edge(X_AXIS, LEFT, Molecule(prefix), 0);
}
#include <math.h>
#include <libc-extension.hh>
-#include "font-metric.hh"
+#include "font-metric.hh"
#include "dimensions.hh"
#include "interval.hh"
#include "string.hh"
SCM
fontify_atom(Font_metric * met, SCM f)
{
- return gh_list (ly_symbol2scm ("fontify"),
- ly_quote_scm (met->description ()), f, SCM_UNDEFINED);
+ if (f == SCM_EOL)
+ return f;
+ else
+ return gh_list (ly_symbol2scm ("fontify"),
+ ly_quote_scm (met->description_), f, SCM_UNDEFINED);
}
SCM
#include "debug.hh"
#include "paper-def.hh"
#include "paper-column.hh" // urg
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "rest.hh"
#include "molecule.hh"
#include "misc.hh"
Real pad = s.empty_b ()
? 0.0 : gh_scm2double (me->get_elt_property ("padding")) * staff_space;
- Molecule r (me->get_default_font ()->find_by_name ("rests-" + to_str (k)));
+ Molecule r (Font_interface::get_default_font (me)->find_by_name ("rests-" + to_str (k)));
if (k == 0)
r.translate_axis (staff_space, Y_AXIS);
else
{
String idx = ("rests-") + to_str (-4);
- s = me->get_default_font ()->find_by_name (idx);
+ s = Font_interface::get_default_font (me)->find_by_name (idx);
}
mol.add_molecule (s);
#include "dots.hh"
#include "note-head.hh"
#include "debug.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "molecule.hh"
#include "musical-request.hh"
Note_head::ledger_line (Interval xwid, Score_element *me)
{
Drul_array<Molecule> endings;
- endings[LEFT] = me->get_default_font ()->find_by_name ("noteheads-ledgerending");
+ endings[LEFT] = Font_interface::get_default_font (me)->find_by_name ("noteheads-ledgerending");
Molecule *e = &endings[LEFT];
endings[RIGHT] = *e;
}
// ugh: use gh_call ()
- Molecule out = me->get_default_font ()->find_by_name (String ("noteheads-") +
+ Molecule out = Font_interface::get_default_font (me)->find_by_name (String ("noteheads-") +
ly_scm2string (scm_eval2 (gh_list (ly_symbol2scm("find-notehead-symbol"),
me->get_elt_property ("duration-log"),
ly_quote_scm(style),
#include <math.h>
+#include "all-font-metrics.hh"
#include "string.hh"
#include "misc.hh"
#include "paper-def.hh"
Paper_def::Paper_def ()
{
style_sheet_ = SCM_EOL;
+ scaled_fonts_ = SCM_EOL;
}
Paper_def::~Paper_def ()
Paper_def::Paper_def (Paper_def const&src)
: Music_output_def (src)
{
+ scaled_fonts_ = SCM_EOL;
style_sheet_ = src.style_sheet_;
}
return 0.0;
}
+ Real sc = 1.0;
+ SCM ssc;
+ if (scope_p_->try_retrieve (ly_symbol2scm ("outputscale"), &ssc))
+ {
+ sc = gh_scm2double (ssc);
+ }
if (gh_number_p (val))
{
- return gh_scm2double (val);
+ return gh_scm2double (val) / sc;
}
else
{
return str;
}
+/*
+ todo: use symbols and hashtable idx?
+*/
+Font_metric *
+Paper_def::find_font (SCM fn, Real m)
+{
+ SCM key = gh_cons (fn, gh_double2scm (m));
+ SCM met = scm_assoc (key, scaled_fonts_);
+
+ if (gh_pair_p (met))
+ return unsmob_metrics (gh_cdr (met));
+ SCM ssc;
+ if (scope_p_->try_retrieve (ly_symbol2scm ("outputscale"), &ssc))
+ {
+ m /= gh_scm2double (ssc);
+ }
+
+ Font_metric* f = all_fonts_global_p->find_font (ly_scm2string (fn));
+ SCM val = Scaled_font_metric::make_scaled_font_metric (f, m);
+ scaled_fonts_ = scm_acons (key, val, scaled_fonts_ );
+
+ scm_unprotect_object (val);
+
+ return dynamic_cast<Scaled_font_metric*> (unsmob_metrics (val));
+}
+
+
+/*
+ Return alist to translate internally used fonts back to real-world
+ coordinates. */
+SCM
+Paper_def::font_descriptions ()const
+{
+
+
+ SCM l = SCM_EOL;
+ for (SCM s = scaled_fonts_; gh_pair_p (s); s = gh_cdr(s))
+ {
+ SCM desc = gh_caar (s);
+ SCM mdesc = unsmob_metrics (gh_cdar (s))->description_;
+
+ l = gh_cons (gh_cons (mdesc, desc), l);
+ }
+ return l;
+}
-void
-Paper_outputter::output_font_def (int i, String str)
-{
- SCM scm = gh_list (ly_symbol2scm ("font-def"),
- gh_int2scm (i),
- ly_str02scm (str.ch_l ()),
- SCM_UNDEFINED);
-
- output_scheme (scm);
-}
void
Paper_outputter::output_Real_def (String k, Real v)
outputter_l_ = new Paper_outputter (paper_l_->paper_stream_p ());
;
outputter_l_->output_header ();
- outputter_l_->output_version();
+ outputter_l_->output_version ();
if (header_global_p)
outputter_l_->output_scope (header_global_p, "mudela");
outputter_l_->output_scope (paper_l_->scope_p_, "mudelapaper");
SCM scm;
- if(experimental_features_global_b)
+ if (experimental_features_global_b)
{
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);
-
- line_l_->output_lines ();
+ line_l_->output_lines ();
scm = gh_list (ly_symbol2scm ("end-output"), SCM_UNDEFINED);
outputter_l_->output_scheme (scm);
#include "musical-request.hh"
#include "score-element.hh"
#include "item.hh"
-#include "font-metric.hh"
#include "lily-guile.hh"
#include "rhythmic-head.hh"
#include "stem.hh"
#include "molecule.hh"
#include "paper-def.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "rest.hh"
#include "dots.hh"
#include "paper-score.hh"
String idx = ("rests-") + to_str (gh_scm2int (balltype))
+ (ledger_b ? "o" : "") + style;
- return me-> get_default_font ()->find_by_name (idx).create_scheme();
+ return Font_interface::get_default_font (me)->find_by_name (idx).create_scheme();
}
#include "rhythmic-head.hh"
#include "debug.hh"
-#include "molecule.hh"
-#include "paper-def.hh"
-#include "font-metric.hh"
#include "rest.hh"
-#include "dots.hh"
-#include "paper-score.hh"
#include "stem.hh"
#include "staff-symbol-referencer.hh"
#include "item.hh"
Scaled_font_metric::Scaled_font_metric (Font_metric* m, Real magn)
{
magnification_f_ = magn;
+ SCM desc = m->description_;
+
+ Real total_mag = magn * gh_scm2double (gh_cdr (desc));
+ description_ = gh_cons (gh_car (desc), gh_double2scm (total_mag));
orig_l_ = m;
}
Scaled_font_metric::make_scaled_font_metric (Font_metric*m, Real s)
{
Scaled_font_metric *sfm = new Scaled_font_metric (m,s);
- sfm->name_ = m->name_;
-
return sfm->self_scm ();
}
-SCM
-Scaled_font_metric::description () const
-{
- SCM od = orig_l_->description ();
- // todo:
- // gh_set_cdr_x (od, gh_int2scm (magstep_i_));
- return od;
-}
-
-
Molecule
-Scaled_font_metric::find_by_name (String s, Real mag) const
+Scaled_font_metric::find_by_name (String s) const
{
- return orig_l_->find_by_name (s, magnification_f_ * mag); // ugh.
+ Molecule m = orig_l_->find_by_name (s);
+ Box b = m.extent_box ();
+ b.scale (magnification_f_);
+ Molecule q(b,fontify_atom ((Font_metric*) this, m.get_expr ()));
+
+ return q ;
}
#include <string.h>
#include <math.h>
-#include "all-font-metrics.hh"
#include "input-smob.hh"
#include "libc-extension.hh"
#include "group-interface.hh"
#include "misc.hh"
#include "paper-score.hh"
#include "paper-def.hh"
-#include "font-metric.hh"
#include "molecule.hh"
#include "score-element.hh"
#include "debug.hh"
ADD_SCM_INIT_FUNC(scoreelt, init_functions);
IMPLEMENT_TYPE_P(Score_element, "ly-element?");
-
-Font_metric *
-Score_element::get_default_font () const
-{
- Font_metric * fm = unsmob_metrics (get_elt_property ("font"));
- if (fm)
- return fm;
-
- Score_element *me = (Score_element*)this;
- SCM ss = me->paper_l ()->style_sheet_;
-
- SCM proc = gh_cdr (scm_assoc (ly_symbol2scm ("properties-to-font"),
- ss));
-
- SCM fonts = gh_cdr (scm_assoc (ly_symbol2scm ("fonts"), ss));
- SCM defaults = gh_cdr (scm_assoc (ly_symbol2scm ("font-defaults"),
- ss));
-
- assert (gh_procedure_p (proc));
- SCM font_name = gh_call2 (proc, fonts,
- gh_list (me->mutable_property_alist_,
- me->immutable_property_alist_,
- defaults,
- SCM_UNDEFINED));
-
- fm = find_font (ly_scm2string (font_name));
- me->set_elt_property ("font", fm->self_scm ());
- return fm;
-}
#include "debug.hh"
#include "script.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "side-position-interface.hh"
#include "paper-def.hh"
#include "item.hh"
SCM key = gh_car (s);
if (key == ly_symbol2scm ("feta"))
{
- return me->get_default_font ()->find_by_name ("scripts-" +
+ return Font_interface::get_default_font (me)->find_by_name ("scripts-" +
ly_scm2string (index_cell (gh_cdr (s), d)));
}
else if (key == ly_symbol2scm ("accordion"))
{
- return Lookup::accordion (gh_cdr (s), me->paper_l()->get_var("staffspace"), me->get_default_font ());
+ return Lookup::accordion (gh_cdr (s), me->paper_l()->get_var("staffspace"), Font_interface::get_default_font (me));
}
else
assert (false);
void
-Separating_group_spanner::set_interface (Score_element*me)
+Separating_group_spanner::set_interface (Score_element*)
{
}
#include "group-interface.hh"
#include "slur.hh"
#include "lookup.hh"
-#include "font-metric.hh"
#include "paper-def.hh"
#include "note-column.hh"
#include "stem.hh"
*/
#include "span-bar.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "dimensions.hh"
#include "paper-def.hh"
#include "molecule.hh"
#include "debug.hh"
#include "paper-def.hh"
#include "rhythmic-head.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "molecule.hh"
#include "paper-column.hh"
#include "misc.hh"
}
char c = (get_direction (me) == UP) ? 'u' : 'd';
- Molecule m = me->get_default_font ()->find_by_name (String ("flags-") + to_str (c) +
+ Molecule m = Font_interface::get_default_font (me)->find_by_name (String ("flags-") + to_str (c) +
to_str (flag_i (me)));
if (!style.empty_b ())
- m.add_molecule(me->get_default_font ()->find_by_name (String ("flags-") + to_str (c) + style));
+ m.add_molecule(Font_interface::get_default_font (me)->find_by_name (String ("flags-") + to_str (c) + style));
return m;
}
*/
#include "score-element.hh"
#include "molecule.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "string.hh"
// update comment --hwn
}
else
idx += String (&text.byte_C ()[i], 1);
- Molecule m = e->get_default_font ()->find_by_name (idx);
+ Molecule m = Font_interface::get_default_font (e)->find_by_name (idx);
if (!m.empty_b ())
mol.add_at_edge (X_AXIS, RIGHT, m, 0);
}
#include "system-start-delimiter.hh"
#include "paper-def.hh"
#include "molecule.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "all-font-metrics.hh"
#include "score-element.hh"
#include "lookup.hh"
Molecule
System_start_delimiter::staff_brace (Score_element*me,Real y)
{
- Real staffht = me->paper_l ()->get_var ("staffheight");
- int staff_size = int (rint (staffht ));
+ int staff_size = 20; // URG.
// URG
Real step = 1.0;
int idx = int (((maxht - step) <? y - minht) / step);
idx = idx >? 0;
- SCM l = scm_assoc (ly_str02scm ("brace"),
- scm_eval2 (ly_symbol2scm ("cmr-alist"), SCM_EOL));
+ Font_metric *fm = Font_interface::get_default_font (me);
- String nm = "feta-braces";
- if (l != SCM_BOOL_F)
- nm = ly_scm2string (gh_cdr (l));
- nm += to_str (staff_size);
- SCM e =gh_list (ly_symbol2scm ("char"), gh_int2scm (idx), SCM_UNDEFINED);
- SCM at = (e);
-
- at = fontify_atom (find_font (nm), at);
+ SCM at =gh_list (ly_symbol2scm ("char"), gh_int2scm (idx), SCM_UNDEFINED);
+ at = fontify_atom (fm, at);
Box b (Interval (0,0), Interval (-y/2, y/2));
#include "debug.hh"
#include "text-item.hh"
#include "paper-def.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "staff-symbol-referencer.hh"
#include "staff-symbol-referencer.hh"
#include "main.hh"
SCM proc = gh_cdr (scm_assoc (ly_symbol2scm ("properties-to-font"), sheet));
SCM font_name = gh_call2 (proc, fonts, alist_chain);
- SCM lookup = ly_assoc_chain (ly_symbol2scm ("lookup"), alist_chain);
+#if 0
+ SCM lookup = scm_assoc (ly_symbol2scm ("lookup"), properties);
Molecule mol;
if (gh_pair_p (lookup) && ly_symbol2string (gh_cdr (lookup)) == "name")
mol = lookup_character (me, font_name, text);
else
- mol = lookup_text (me, font_name, text);
+#endif
+ Molecule mol = lookup_text (me, font_name, text);
return mol;
}
Molecule
-Text_item::lookup_character (Score_element *me, SCM font_name, SCM char_name)
+Text_item::lookup_character (Score_element *, SCM font_name, SCM char_name)
{
Adobe_font_metric *afm = all_fonts_global_p->find_afm (ly_scm2string (font_name));
Font_metric* metric = 0;
if (gh_number_p (magnification))
{
+#if 0
Real realmag = pow (1.2, gh_scm2int (magnification));
metric = all_fonts_global_p->find_scaled (ly_scm2string (font_name), realmag);
+#endif
+ assert (false);
}
else
- metric = all_fonts_global_p->find_font (ly_scm2string (font_name));
+ metric = me->paper_l ()->find_font (font_name, 1.0);
SCM list = gh_list (ly_symbol2scm ("text"), text, SCM_UNDEFINED);
list = fontify_atom (metric, list);
Text_item::markup_sentence2molecule (Score_element *me, SCM markup_sentence,
SCM alist_chain)
{
+ /*
+ FIXME
+ */
+ return Molecule ();
+
SCM sheet = me->paper_l ()->style_sheet_;
- SCM f = gh_cdr (scm_assoc (ly_symbol2scm ("markup-to-properties"), sheet));
+ SCM f = gh_cdr (scm_assoc (ly_symbol2scm ("markup-abbrev-to-properties-alist"), sheet));
+
SCM markup = gh_car (markup_sentence);
SCM sentence = gh_cdr (markup_sentence);
- SCM p = gh_cons (gh_call2 (f, sheet, markup), alist_chain);
+ SCM p = gh_cons (gh_call1 (f, markup), alist_chain);
Axis align = X_AXIS;
- SCM a = ly_assoc_chain (ly_symbol2scm ("align"), p);
+ SCM a = scm_assoc (ly_symbol2scm ("align"), p);
if (gh_pair_p (a) && gh_number_p (gh_cdr (a)))
align = (Axis)gh_scm2int (gh_cdr (a));
Real staff_space = Staff_symbol_referencer::staff_space (me);
Real kern = 0;
- SCM k = ly_assoc_chain (ly_symbol2scm ("kern"), p);
+ SCM k = scm_assoc (ly_symbol2scm ("kern"), p);
if (gh_pair_p (k) && gh_number_p (gh_cdr (k)))
kern = gh_scm2double (gh_cdr (k)) * staff_space;
Real raise = 0;
- SCM r = ly_assoc_chain (ly_symbol2scm ("raise"), p);
+ SCM r = scm_assoc (ly_symbol2scm ("raise"), p);
if (gh_pair_p (r) && gh_number_p (gh_cdr (r)))
raise = gh_scm2double (gh_cdr (r)) * staff_space;
#include "text-item.hh"
#include "text-spanner.hh"
#include "spanner.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "dimensions.hh"
#include "paper-def.hh"
#include "debug.hh"
}
Box
-Tex_font_metric::get_char (int a, Real mag) const
+Tex_font_metric::get_char (int a) const
{
Box b = find_ascii (a)->dimensions () ;
- b.scale (mag);
return b;
}
SCM
Tex_font_metric::make_tfm (String fn)
{
- Tex_font_metric * tfm_p = new Tex_font_metric;
+ Tex_font_metric * tfm_p = new Tex_font_metric;
Tex_font_metric_reader reader (fn);
tfm_p->info_ = reader.info_;
#include "text-item.hh"
#include "time-signature.hh"
#include "paper-def.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
MAKE_SCHEME_CALLBACK(Time_signature,brew_molecule,1);
// First guess: s contains only the signature style
String symbolname = "timesig-" + s + to_str (n) + "/" + to_str (d);
- Molecule m = me->get_default_font ()->find_by_name (symbolname);
+ Molecule m = Font_interface::get_default_font (me)->find_by_name (symbolname);
if (!m.empty_b())
return m;
// Second guess: s contains the full signature name
- m = me->get_default_font ()->find_by_name ("timesig-"+s);
+ m = Font_interface::get_default_font (me)->find_by_name ("timesig-"+s);
if (!m.empty_b ())
return m;
Time_signature::time_signature (Score_element*me,int num, int den)
{
SCM chain = gh_list (me->mutable_property_alist_, me->immutable_property_alist_, SCM_UNDEFINED);
+
Molecule n = Text_item::text2molecule (me,
ly_str02scm (to_str (num).ch_C ()),
chain);
#include "beam.hh"
#include "box.hh"
#include "debug.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "molecule.hh"
#include "paper-column.hh"
#include "paper-def.hh"
#include "box.hh"
#include "debug.hh"
-#include "font-metric.hh"
+#include "font-interface.hh"
#include "molecule.hh"
#include "paper-column.hh"
#include "paper-def.hh"
void
Volta_spanner::set_interface (Score_element*me)
{
- Side_position::set_axis (me, Y_AXIS);
- Directional_element_interface::set (me, UP);
}
-
/*
this is too complicated. Yet another version of side-positioning,
badly implemented.
* Should look for system_start_delim to find left edge of staff.
-
*/
MAKE_SCHEME_CALLBACK(Volta_spanner,brew_molecule,1);
staffspace = \staffheight / 4.0;
stafflinethickness = \staffspace / 10.0;
+outputscale = \staffheight / 4.0;
\translator { \NoteNamesContext }
\translator { \ScoreContext }
Begin3
Title: LilyPond
-Version: 1.3.99
-Entered-date: 25OCT00
+Version: 1.3.100
+Entered-date: 30OCT00
Description:
Keywords: music notation typesetting midi fonts engraving
Author: hanwen@cs.uu.nl (Han-Wen Nienhuys)
janneke@gnu.org (Jan Nieuwenhuizen)
Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys)
Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert
- 1000k lilypond-1.3.99.tar.gz
+ 1000k lilypond-1.3.100.tar.gz
Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/
- 1000k lilypond-1.3.99.tar.gz
+ 1000k lilypond-1.3.100.tar.gz
Copying-policy: GPL
End
Name: lilypond
-Version: 1.3.99
+Version: 1.3.100
Release: 1
License: GPL
Group: Applications/Publishing
-Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.99.tar.gz
+Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.100.tar.gz
Summary: A program for printing sheet music.
URL: http://www.cs.uu.nl/~hanwen/lilypond
# Icon: lilypond-icon.gif
--- /dev/null
+
+;;;; AsciiScript as
+(define (as-scm action-name)
+
+ (define (beam width slope thick)
+ (string-append
+ (func "set-line-char" "#")
+ (func "rline-to" width (* width slope))
+ ))
+
+ ; simple flat slurs
+ (define (bezier-sandwich l thick)
+ (let (
+ (c0 (cadddr l))
+ (c1 (cadr l))
+ (c3 (caddr l)))
+ (let* ((x (car c0))
+ (dx (- (car c3) x))
+ (dy (- (cdr c3) (cdr c0)))
+ (rc (/ dy dx))
+ (c1-dx (- (car c1) x))
+ (c1-line-y (+ (cdr c0) (* c1-dx rc)))
+ (dir (if (< c1-line-y (cdr c1)) 1 -1))
+ (y (+ -1 (* dir (max (* dir (cdr c0)) (* dir (cdr c3)))))))
+ (string-append
+ (func "rmove-to" x y)
+ (func "put" (if (< 0 dir) "/" "\\\\"))
+ (func "rmove-to" 1 (if (< 0 dir) 1 0))
+ (func "set-line-char" "_")
+ (func "h-line" (- dx 1))
+ (func "rmove-to" (- dx 1) (if (< 0 dir) -1 0))
+ (func "put" (if (< 0 dir) "\\\\" "/"))))))
+
+ (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
+ (string-append
+ (func "rmove-to" (+ width 1) (- (/ height -2) 1))
+ (func "put" "\\\\")
+ (func "set-line-char" "|")
+ (func "rmove-to" 0 1)
+ (func "v-line" (+ height 1))
+ (func "rmove-to" 0 (+ height 1))
+ (func "put" "/")
+ ))
+
+ (define (char i)
+ (func "char" i))
+
+ (define (define-origin a b c ) "")
+
+ (define (end-output)
+ (func "end-output"))
+
+ (define (experimental-on)
+ "")
+
+ (define (filledbox breapth width depth height)
+ (let ((dx (+ width breapth))
+ (dy (+ depth height)))
+ (string-append
+ (func "rmove-to" (* -1 breapth) (* -1 depth))
+ (if (< dx dy)
+ (string-append
+ (func "set-line-char"
+ (if (<= dx 1) "|" "#"))
+ (func "v-line" dy))
+ (string-append
+ (func "set-line-char"
+ (if (<= dy 1) "-" "="))
+ (func "h-line" dx))))))
+
+ (define (font-load-command name-mag command)
+ (func "load-font" (car name-mag) (magstep (cdr name-mag))))
+
+ (define (header creator generate)
+ (func "header" creator generate))
+
+ (define (header-end)
+ (func "header-end"))
+
+ ;; urg: this is good for half of as2text's execution time
+ (define (xlily-def key val)
+ (string-append "(define " key " " (arg->string val) ")\n"))
+
+ (define (lily-def key val)
+ (if
+ (or (equal? key "mudelapaperlinewidth")
+ (equal? key "mudelapaperstaffheight"))
+ (string-append "(define " key " " (arg->string val) ")\n")
+ ""))
+
+ (define (no-origin) "")
+
+ (define (placebox x y s)
+ (let ((ey (inexact->exact y)))
+ (string-append "(move-to " (number->string (inexact->exact x)) " "
+ (if (= 0.5 (- (abs y) (abs ey)))
+ (number->string y)
+ (number->string ey))
+ ")\n" s)))
+
+ (define (select-font name-mag-pair)
+ (let* ((c (assoc name-mag-pair font-name-alist)))
+ (if (eq? c #f)
+ (begin
+ (ly-warn
+ (string-append
+ "Programming error: No such font known "
+ (car name-mag-pair))))
+ "") ; issue no command
+ (func "select-font" (car font-name-symbol)))))
+
+ (define (start-line height)
+ (func "start-line" height))
+
+ (define (stop-line)
+ (func "stop-line"))
+
+ (define (text s)
+ (func "text" s))
+
+ (define (tuplet ht gap dx dy thick dir) "")
+
+ (define (volta h w thick vert-start vert-end)
+ ;; urg
+ (string-append
+ (func "set-line-char" "|")
+ (func "rmove-to" 0 -4)
+ ;; definition strange-way around
+ (if (= 0 vert-start)
+ (func "v-line" h)
+ "")
+ (func "rmove-to" 1 h)
+ (func "set-line-char" "_")
+ (func "h-line" (- w 1))
+ (func "set-line-char" "|")
+ (if (= 0 vert-end)
+ (string-append
+ (func "rmove-to" (- w 1) (* -1 h))
+ (func "v-line" (* -1 h)))
+ "")))
+
+ (cond ((eq? action-name 'all-definitions)
+ `(begin
+ (define beam ,beam)
+ (define bracket ,bracket)
+ (define char ,char)
+ (define define-origin ,define-origin)
+ ;;(define crescendo ,crescendo)
+ (define bezier-sandwich ,bezier-sandwich)
+ ;;(define dashed-slur ,dashed-slur)
+ ;;(define decrescendo ,decrescendo)
+ (define end-output ,end-output)
+ (define experimental-on ,experimental-on)
+ (define filledbox ,filledbox)
+ ;;(define font-def ,font-def)
+ (define font-load-command ,font-load-command)
+ ;;(define font-switch ,font-switch)
+ (define header ,header)
+ (define header-end ,header-end)
+ (define lily-def ,lily-def)
+ ;;(define invoke-char ,invoke-char)
+ ;;(define invoke-dim1 ,invoke-dim1)
+ (define no-origin ,no-origin)
+ (define placebox ,placebox)
+ (define select-font ,select-font)
+ (define start-line ,start-line)
+ ;;(define stem ,stem)
+ (define stop-line ,stop-line)
+ (define stop-last-line ,stop-line)
+ (define text ,text)
+ (define tuplet ,tuplet)
+ (define volta ,volta)
+ ))
+ ((eq? action-name 'tuplet) tuplet)
+ ;;((eq? action-name 'beam) beam)
+ ;;((eq? action-name 'bezier-sandwich) bezier-sandwich)
+ ;;((eq? action-name 'bracket) bracket)
+ ((eq? action-name 'char) char)
+ ;;((eq? action-name 'crescendo) crescendo)
+ ;;((eq? action-name 'dashed-slur) dashed-slur)
+ ;;((eq? action-name 'decrescendo) decrescendo)
+ ;;((eq? action-name 'experimental-on) experimental-on)
+ ((eq? action-name 'filledbox) filledbox)
+ ((eq? action-name 'select-font) select-font)
+ ;;((eq? action-name 'volta) volta)
+ (else (error "unknown tag -- MUSA-SCM " action-name))
+ )
+ )
+
+
(visibility-lambda . ,begin-of-line-visible)
(padding . 1.0)
(direction . 1)
+ (markup-to-properties . ,markup-to-properties)
(font-family . roman)
+
(font-relative-size . -1)
(meta . ,(element-description "BarNumber"
text-interface font-interface break-aligned-interface))
(molecule-callback . ,Chord_name::brew_molecule)
(after-line-breaking-callback . ,Chord_name::after_line_breaking)
(chord-name-function . ,default-chord-name-function)
- (font-family . roman)
- (meta . ,(element-description "ChordNames" font-interface text-interface chord-name-interface))
+ (markup-to-properties . ,markup-to-properties)
+ (meta . ,(element-description "ChordNames" font-interface chord-name-interface))
))
(NoteCollision . (
(Y-offset-callbacks . (,Side_position::aligned_on_self))
(molecule-callback . ,Text_item::brew_molecule)
(script-priority . 100)
- (font-series . bold)
- (font-family . dynamic)
+ (font-style . dynamic)
+ (markup-to-properties . ,markup-to-properties)
(self-alignment-Y . 0)
(meta . ,(element-description "DynamicText" font-interface text-interface ))
))
(X-offset-callbacks . (,Side_position::centered_on_parent ,Side_position::aligned_on_self))
(padding . 3.0)
(self-alignment-X . 0)
- (font-family . number)
- (font-relative-size . -3)
+
+ (font-style . finger)
+ (markup-to-properties . ,markup-to-properties)
(meta . ,(element-description "Fingering" finger-interface font-interface text-script-interface text-interface side-position-interface))
))
(molecule-callback . ,Text_item::brew_molecule)
(break-align-symbol . Instrument_name)
(visibility-lambda . ,begin-of-line-visible)
+ (markup-to-properties . ,markup-to-properties)
(font-family . roman)
(meta . ,(element-description "InstrumentName" font-interface text-interface break-aligned-interface))
))
(self-alignment-X . 0)
(non-rhythmic . #t)
(word-space . 0.6)
+
+ (markup-to-properties . ,markup-to-properties)
(font-family . roman)
(font-shape . upright)
(font-relative-size . 0)
+
(meta . ,(element-description "LyricText" lyric-syllable-interface text-interface font-interface ))
))
(RehearsalMark . (
- (molecule-callback . ,Text_item::brew_molecule)
- (breakable . #t)
- (font-family . number)
- (font-relative-size . 1)
- (visibility-lambda . ,end-of-line-invisible)
- (padding . 4.0)
- (meta . ,(element-description "RehearsalMark" mark-interface side-position-interface))
+ (molecule-callback . ,Text_item::brew_molecule)
+ (breakable . #t)
+ (markup-to-properties . ,markup-to-properties)
+ (font-style . mark)
+ (visibility-lambda . ,end-of-line-invisible)
+ (padding . 4.0)
+ (meta . ,(element-description "RehearsalMark" mark-interface side-position-interface))
))
(MultiMeasureRest . (
(expand-limit . 10)
(padding . 2.0) ; staffspace
(minimum-width . 12.5) ; staffspace
- (font-family . number)
- (font-relative-size . 1)
+ (markup-to-properties . ,markup-to-properties)
+ (font-style . mmrest)
(meta . ,(element-description "MultiMeasureRest" multi-measure-rest-interface font-interface ))
))
(NoteName . (
(style . default)
(molecule-callback . ,Text_item::brew_molecule)
+ (markup-to-properties . ,markup-to-properties)
(meta . ,(element-description "NoteName"
note-name-interface font-interface
general-element-interface))
(Y-offset-callbacks . (,Side_position::aligned_side))
(molecule-callback . ,Text_item::brew_molecule)
(font-shape . italic)
+ (markup-to-properties . ,markup-to-properties)
+
(meta . ,(element-description "OctavateEight" text-interface font-interface ))
))
(molecule-callback . ,Text_item::brew_molecule)
(break-align-symbol . Clef_item)
(visibility-lambda . ,begin-of-line-visible)
+ (markup-to-properties . ,markup-to-properties)
(font-family . roman)
- (meta . ,(element-description "StanzaNumber" break-aligned-interface text-interface font-interface))
+(meta . ,(element-description "StanzaNumber" break-aligned-interface text-interface font-interface))
))
(StaffSymbol . (
,Side_position::centered_on_parent))
(no-spacing-rods . #t)
(font-shape . italic)
+ (markup-to-properties . ,markup-to-properties)
+
(self-alignment-X . 0)
(meta . ,(element-description "SostenutoPedal" text-interface font-interface))
))
(self-alignment-X . 0)
(X-offset-callbacks . (,Side_position::aligned_on_self))
(Y-offset-callbacks .
- (,Side_position::aligned_side
- ,Side_position::centered_on_parent))
+ (,Side_position::aligned_side
+ ,Side_position::centered_on_parent))
(meta . ,(element-description "SustainPedal" sustain-pedal-interface side-position-interface font-interface))
))
(arch-width . 1.5)
(bracket-thick . 0.25)
(bracket-width . 2.0)
+ (font-family . braces)
+ (font-point-size . 20)
(Y-extent-callback . #f)
- (meta . ,(element-description "SystemStartDelimiter" system-start-delimiter ))
+ (meta . ,(element-description "SystemStartDelimiter" system-start-delimiter font-interface))
))
(TextScript . (
(molecule-callback . ,Text_item::brew_molecule)
(no-spacing-rods . #t)
(padding . 0.5)
- (font-family . roman)
- (font-shape . italic)
- (font-relative-size . 0)
+ (markup-to-properties . ,markup-to-properties)
+ (font-family . roman)
+ (font-shape . italic)
+ (font-relative-size . 0)
(meta . ,(element-description "TextScript" text-script-interface text-interface side-position-interface font-interface ))
))
(TextSpanner . (
(molecule-callback . ,Text_spanner::brew_molecule)
(font-shape . italic)
+ (markup-to-properties . ,markup-to-properties)
(type . "line")
(direction . 1)
(meta . ,(element-description "TextSpanner" text-spanner-interface font-interface))
))
(TimeSignature . (
- (molecule-callback . ,Time_signature::brew_molecule)
+ (molecule-callback . ,Time_signature::brew_molecule)
(break-align-symbol . Time_signature)
(visibility-lambda . ,all-visible)
(breakable . #t)
- (font-family . number)
- (font-relative-size . 0)
- (meta . ,(element-description "TimeSignature" time-signature-interface font-interface))
+ (markup-to-properties . ,markup-to-properties)
+ (font-style . timesig)
+ (meta . ,(element-description "TimeSignature" time-signature-interface font-interface))
))
(TupletBracket . (
(thick . 1.0)
(after-line-breaking-callback . ,Tuplet_spanner::after_line_breaking)
(molecule-callback . ,Tuplet_spanner::brew_molecule)
- (font-shape . italic)
- (font-relative-size . -1)
+ (markup-to-properties . ,markup-to-properties)
+ (font-style . tuplet)
(meta . ,(element-description "TupletBracket" text-interface
tuplet-bracket-interface font-interface))
))
(UnaChordaPedal . (
(molecule-callback . ,Text_item::brew_molecule)
(font-shape . italic)
+ (markup-to-properties . ,markup-to-properties)
(no-spacing-rods . #t)
(self-alignment-X . 0)
(X-offset-callbacks . (,Side_position::aligned_on_self))
(VoltaBracket . (
(molecule-callback . ,Volta_spanner::brew_molecule)
+
(direction . 1)
- (padding . 5)
- (font-family . number)
- (font-relative-size . -2)
+ (padding . 1)
+ (markup-to-properties . ,markup-to-properties)
+ (font-style . volta)
+ (Y-offset-callbacks . (,Side_position::aligned_side))
(thickness . 1.6) ; stafflinethickness
(height . 2.0) ; staffspace;
(minimum-space . 25)
((eq? name 'font-shape) 2)
((eq? name 'font-family) 3)
((eq? name 'font-name) 4)
- ((eq? name 'font-point-size-size) 5)
+ ((eq? name 'font-point-size) 5)
+ (else (ly-warning "unknown font field name"))
)
))
(dynamic . ((font-series . bold) (font-family . dynamic) (font-relative-size . 0)))
))
(properties-to-font . ,properties-to-font-name)
- (markup-to-properties . ,markup-to-properties)
- (abbreviation-alist
- .
- ((rows . ((align . 0)))
+
+ ;; FIXME: this is a not-so-cool idea to use ALIGN
+ ;; RAISE, LOOKUP, since they are not proper elt-properties,
+ ;; and might interfere with them.
+ (markup-abbrev-to-properties-alist
+ . ((rows . ((align . 0)))
(lines . ((align . 1)))
(roman . ((font-family . roman)))
- (music . ((font-family . music) (font-shape . upright) (font-series . medium)))
+ (music . ((font-family . music)))
(finger . ((font-style . finger)))
(bold . ((font-series . bold)))
(italic . ((font-shape . italic)))
)
)
+
+
+(define (font-regexp-to-font-name paper regexp)
+ (let ((style-sheet (cdr (assoc paper style-sheet-alist))))
+ (let loop ((fonts style-sheet))
+ (if (string-match regexp (caar fonts))
+ (cdar fonts)
+ (if (pair? (cdr fonts))
+ (loop (cdr fonts))
+ '())))))
+
;; reduce the font list by successively applying a font-qualifier.
(define (qualifiers-to-fontnames qualifiers font-descr-alist)
(if (null? qualifiers)
selected) ; return the topmost.
))
-(define (markup-to-properties sheet markup)
+(define markup-abbrev-to-properties-alist
+ (append
+ (map (lambda (x) (cons (car x) (cons 'font-style (car x))))
+ style-to-font-alist)))
+
+(define (markup-to-properties markup)
;;(display "markup: `")
- ;;(write markup)
+ ;;(display markup)
;;(display "'\n")
(if (pair? markup)
(list markup)
- (let ((entry (assoc markup
- ;; assoc-chain?
- (append (cdr (assoc 'abbreviation-alist sheet))
- (cdr (assoc 'style-alist sheet))))))
- (if entry
- (cdr entry)
+ (let ((entry (assoc markup markup-abbrev-to-properties-alist)))
+ (if entry (cdr entry)
(list (cons markup #t))))))
; fixme, how's this supposed to work?
;
; (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
-
;
; This file contains various routines in Scheme that are easier to
; do here than in C++. At present it is an unorganised mess. Sorry.
;
-
; We should repartition the entire scm side of lily in a
; more sane way, using namesspaces/modules?
(define (number-pair? x)
(and (pair? x) (number? (car x)) (number? (cdr x))))
+(define (object-type obj)
+ (cond
+ ((dir? obj) "direction")
+ ((number-pair? obj) "pair of numbers")
+ ((ly-input-location? obj) "input location")
+ ((ly-element? obj) "graphic element")
+ ((pair? obj) "pair")
+ ((integer? obj) "integer")
+ ((list? obj) "list")
+ ((symbol? obj) "symbol")
+ ((string? obj) "string")
+ ((boolean? obj) "boolean")
+ ((moment? obj) "moment")
+ ((number? obj) "number")
+ ((char? obj) "char")
+ ((input-port? obj) "input port")
+ ((output-port? obj) "output port")
+ ((vector? obj) "vector")
+ ((procedure? obj) "procedure")
+ (else "unknown type")
+ ))
+
+
(define (type-name predicate)
(cond
((eq? predicate dir?) "direction")
(if (< duration 0) "mensural" "")))
((default) (number->string duration))
(else
- (string-append (number->string duration) (symbol->string style)))))
+ (string-append (number->string duration) (symbol->string style))))
+ )
;;;;;;;; TeX
-;; this is silly, can't we use something like
-;; roman-0, roman-1 roman+1 ?
-(define cmr-alist
- '(("bold" . "cmbx")
- ("brace" . "feta-braces")
- ("default" . "cmr10")
- ("dynamic" . "feta-din")
- ("feta" . "feta")
- ("feta-1" . "feta")
- ("feta-2" . "feta")
- ("typewriter" . "cmtt")
- ("italic" . "cmti")
- ("msam" . "msam")
- ("roman" . "cmr")
- ("script" . "cmr")
- ("large" . "cmbx")
- ("Large" . "cmbx")
- ("mark" . "feta-nummer")
- ("finger" . "feta-nummer")
- ("timesig" . "feta-nummer")
- ("number" . "feta-nummer")
- ("volta" . "feta-nummer"))
-)
-
(define (string-encode-integer i)
(cond
((= i 0) "o")
(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 default-script-alist '())
(define font-name-alist '())
-(define (font-command name-mag)
- (cons name-mag
- (string-append "magfont"
- (string-encode-integer (hashq (car name-mag) 1000000))
+(define (tex-encoded-fontswitch name-mag)
+ (let* (
+ (iname-mag (car name-mag))
+ (ename-mag (cdr name-mag))
+ )
+ (cons iname-mag
+ (cons ename-mag
+ (string-append "magfont"
+ (string-encode-integer
+ (hashq (car ename-mag) 1000000))
"m"
- (string-encode-integer (cdr name-mag)))
+ (string-encode-integer
+ (inexact->exact (* 1000 (cdr ename-mag))))
- )
- )
-(define (define-fonts names)
- (set! font-name-alist (map font-command names))
+ )
+ )
+ )))
+
+(define (define-fonts internal-external-name-mag-pairs)
+ (set! font-name-alist (map tex-encoded-fontswitch
+ internal-external-name-mag-pairs))
(apply string-append
(map (lambda (x)
- (font-load-command (car x) (cdr x))) font-name-alist)
- ))
+ (font-load-command (car x) (cdr x)))
+ (map cdr font-name-alist)
-(define (fontify name exp)
- (string-append (select-font name)
+ )))
+
+(define (fontify name-mag-pair exp)
+ (string-append (select-font name-mag-pair)
exp)
)
"%\n\\unknown%\n")
- (define (select-font font-name-symbol)
+ (define (select-font name-mag-pair)
(let*
(
- (c (assoc font-name-symbol font-name-alist))
+ (c (assoc name-mag-pair font-name-alist))
)
(if (eq? c #f)
(begin
+ (display "FAILED\n")
+ (display (object-type (car name-mag-pair)))
+ (display (object-type (caaar font-name-alist)))
+
(ly-warn (string-append
- "Programming error: No such font known " (car font-name-symbol)))
- "") ; issue no command
- (string-append "\\" (cdr c)))
+ "Programming error: No such font known "
+ (car name-mag-pair) " "
+ (number->string (cdr name-mag-pair))
+ ))
+ "") ; issue no command
+ (string-append "\\" (cddr c)))
))
(define (font-load-command name-mag command)
(string-append
"\\font\\" command "="
- (symbol->string (car name-mag))
+ (car name-mag)
" scaled "
- (number->string (magstep (cdr name-mag)))
+ (number->string (inexact->exact (* 1000 (cdr name-mag))))
"\n"))
(define (embedded-ps s)
(ly-gulp-file "lily.ps") 'pre " %\n" 'post)
(ly-gulp-file "lily.ps"))
"}"
- "\\input lilyponddefs \\turnOnPostScript"))
+ "\\input lilyponddefs\\newdimen\\outputscale \\outputscale=\\mudelapaperoutputscale pt\\turnOnPostScript"))
(define (header creator generate)
(string-append
(define (number->dim x)
(string-append
- (ly-number->string x) " pt "))
+ (ly-number->string x) " \\outputscale "))
(define (placebox x y s)
(string-append
"lilyfont"
(make-string 1 (integer->char (+ 65 i)))))
- (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
- )))
-
-
- (define (select-font font-name-symbol)
+
+ (define (select-font name-mag-pair)
(let*
(
- (c (assoc font-name-symbol font-name-alist))
+ (c (assoc name-mag-pair font-name-alist))
)
(if (eq? c #f)
(begin
+ (display name-mag-pair)
+ (display font-name-alist)
(ly-warn (string-append
- "Programming error: No such font known " (car font-name-symbol)))
- "") ; issue no command
+ "Programming error: No such font known " (car name-mag-pair))
+ (number->string (cdr name-mag-pair))
+ )
+
+ "") ; issue no command
(string-append " " (cdr c) " "))
-
-
))
(define (font-load-command name-mag command)
" { /"
(symbol->string (car name-mag))
" findfont "
- (number->string (magstep (cdr name-mag)))
+ (number->string (cdr name-mag))
" 1000 div 12 mul scalefont setfont } bind def "
"\n"))
((string? arg) (string-append "\"" arg "\""))
((symbol? arg) (string-append "\"" (symbol->string arg) "\""))))
+; ugh: naming.
(define (func name . args)
(string-append
"(" name
1
(if (< x 0) -1 1)))
-;;;; AsciiScript as
-(define (as-scm action-name)
-
- (define (beam width slope thick)
- (string-append
- (func "set-line-char" "#")
- (func "rline-to" width (* width slope))
- ))
-
- ; simple flat slurs
- (define (bezier-sandwich l thick)
- (let (
- (c0 (cadddr l))
- (c1 (cadr l))
- (c3 (caddr l)))
- (let* ((x (car c0))
- (dx (- (car c3) x))
- (dy (- (cdr c3) (cdr c0)))
- (rc (/ dy dx))
- (c1-dx (- (car c1) x))
- (c1-line-y (+ (cdr c0) (* c1-dx rc)))
- (dir (if (< c1-line-y (cdr c1)) 1 -1))
- (y (+ -1 (* dir (max (* dir (cdr c0)) (* dir (cdr c3)))))))
- (string-append
- (func "rmove-to" x y)
- (func "put" (if (< 0 dir) "/" "\\\\"))
- (func "rmove-to" 1 (if (< 0 dir) 1 0))
- (func "set-line-char" "_")
- (func "h-line" (- dx 1))
- (func "rmove-to" (- dx 1) (if (< 0 dir) -1 0))
- (func "put" (if (< 0 dir) "\\\\" "/"))))))
-
- (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
- (string-append
- (func "rmove-to" (+ width 1) (- (/ height -2) 1))
- (func "put" "\\\\")
- (func "set-line-char" "|")
- (func "rmove-to" 0 1)
- (func "v-line" (+ height 1))
- (func "rmove-to" 0 (+ height 1))
- (func "put" "/")
- ))
-
- (define (char i)
- (func "char" i))
-
- (define (define-origin a b c ) "")
-
- (define (end-output)
- (func "end-output"))
-
- (define (experimental-on)
- "")
-
- (define (filledbox breapth width depth height)
- (let ((dx (+ width breapth))
- (dy (+ depth height)))
- (string-append
- (func "rmove-to" (* -1 breapth) (* -1 depth))
- (if (< dx dy)
- (string-append
- (func "set-line-char"
- (if (<= dx 1) "|" "#"))
- (func "v-line" dy))
- (string-append
- (func "set-line-char"
- (if (<= dy 1) "-" "="))
- (func "h-line" dx))))))
-
- (define (font-load-command name-mag command)
- (func "load-font" (car name-mag) (magstep (cdr name-mag))))
-
- (define (header creator generate)
- (func "header" creator generate))
-
- (define (header-end)
- (func "header-end"))
-
- ;; urg: this is good for half of as2text's execution time
- (define (xlily-def key val)
- (string-append "(define " key " " (arg->string val) ")\n"))
-
- (define (lily-def key val)
- (if
- (or (equal? key "mudelapaperlinewidth")
- (equal? key "mudelapaperstaffheight"))
- (string-append "(define " key " " (arg->string val) ")\n")
- ""))
-
- (define (no-origin) "")
-
- (define (placebox x y s)
- (let ((ey (inexact->exact y)))
- (string-append "(move-to " (number->string (inexact->exact x)) " "
- (if (= 0.5 (- (abs y) (abs ey)))
- (number->string y)
- (number->string ey))
- ")\n" s)))
-
- (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
- (func "select-font" (car font-name-symbol)))))
-
- (define (start-line height)
- (func "start-line" height))
-
- (define (stop-line)
- (func "stop-line"))
-
- (define (text s)
- (func "text" s))
-
- (define (tuplet ht gap dx dy thick dir) "")
-
- (define (volta h w thick vert-start vert-end)
- ;; urg
- (string-append
- (func "set-line-char" "|")
- (func "rmove-to" 0 -4)
- ;; definition strange-way around
- (if (= 0 vert-start)
- (func "v-line" h)
- "")
- (func "rmove-to" 1 h)
- (func "set-line-char" "_")
- (func "h-line" (- w 1))
- (func "set-line-char" "|")
- (if (= 0 vert-end)
- (string-append
- (func "rmove-to" (- w 1) (* -1 h))
- (func "v-line" (* -1 h)))
- "")))
-
- (cond ((eq? action-name 'all-definitions)
- `(begin
- (define beam ,beam)
- (define bracket ,bracket)
- (define char ,char)
- (define define-origin ,define-origin)
- ;;(define crescendo ,crescendo)
- (define bezier-sandwich ,bezier-sandwich)
- ;;(define dashed-slur ,dashed-slur)
- ;;(define decrescendo ,decrescendo)
- (define end-output ,end-output)
- (define experimental-on ,experimental-on)
- (define filledbox ,filledbox)
- ;;(define font-def ,font-def)
- (define font-load-command ,font-load-command)
- ;;(define font-switch ,font-switch)
- (define header ,header)
- (define header-end ,header-end)
- (define lily-def ,lily-def)
- ;;(define invoke-char ,invoke-char)
- ;;(define invoke-dim1 ,invoke-dim1)
- (define no-origin ,no-origin)
- (define placebox ,placebox)
- (define select-font ,select-font)
- (define start-line ,start-line)
- ;;(define stem ,stem)
- (define stop-line ,stop-line)
- (define stop-last-line ,stop-line)
- (define text ,text)
- (define tuplet ,tuplet)
- (define volta ,volta)
- ))
- ((eq? action-name 'tuplet) tuplet)
- ;;((eq? action-name 'beam) beam)
- ;;((eq? action-name 'bezier-sandwich) bezier-sandwich)
- ;;((eq? action-name 'bracket) bracket)
- ((eq? action-name 'char) char)
- ;;((eq? action-name 'crescendo) crescendo)
- ;;((eq? action-name 'dashed-slur) dashed-slur)
- ;;((eq? action-name 'decrescendo) decrescendo)
- ;;((eq? action-name 'experimental-on) experimental-on)
- ((eq? action-name 'filledbox) filledbox)
- ((eq? action-name 'select-font) select-font)
- ;;((eq? action-name 'volta) volta)
- (else (error "unknown tag -- MUSA-SCM " action-name))
- )
- )
-
-
(define (gulp-file name)
(let* ((port (open-file name "r"))
(content (let loop ((text ""))
# Enhancements (Laura Conrad)
#
-# Barring now preserved between ABC and lilypond
-# the default placement for text in abc is above the staff.
-
+# Beaming now preserved between ABC and lilypond
+#
# Limitations
#
# Multiple tunes in single file not supported
part_names = 0
default_len = 8
length_specified = 0
-nobarlines = 0
global_key = [0] * 7 # UGH
names = ["One", "Two", "Three"]
DIGITS='0123456789'
else:
state.base_octave = 0
voices_append("\\clef treble;\n")
- elif re.match('^-8va', s):
- s = s[4:]
- state.base_octave = -1
- voices_append("\\clef \"G_8\";\n")
elif re.match('^alto', s):
s = s[4:]
state.base_octave = -1
def set_default_length (s):
- global length_specified
m = re.search ('1/([0-9]+)', s)
if m:
__main__.default_len = string.atoi ( m.group (1))
def try_parse_header_line (ln, state):
- global length_specified
m = re.match ('^([A-Za-z]): *(.*)$', ln)
if m:
if a == 'C':
if not state.common_time:
state.common_time = 1
-# voices_append ("\\property Staff.timeSignatureStyle=\"C\"\n")
- voices_append ("\\property Staff.TimeSignature \push #\'style = #\"C\"\n")
+ voices_append ("\\property Staff.timeSignatureStyle=\"C\"\n")
a = '4/4'
if a == 'C|':
if not state.common_time:
state.common_time = 1
- voices_append ("\\property Staff.TimeSignature \push #\'style = #\"C\"\n")
+ voices_append ("\\property Staff.timeSignatureStyle=\"C\"\n")
a = '2/2'
if not length_specified:
set_default_len_from_time_sig (a)
- else:
- length_specified = 0
voices_append ('\\time %s;' % a)
state.next_bar = ''
if g == 'K': # KEY
if a:
m = re.match ('^([^ \t]*) *(.*)$', a) # seperate clef info
if m:
- # there may or may not be a space
- # between the key letter and the mode
- if key_lookup.has_key(m.group(2)[0:3]):
- key_info = m.group(1) + m.group(2)[0:3]
- clef_info = m.group(2)[4:]
- else:
- key_info = m.group(1)
- clef_info = m.group(2)
- __main__.global_key = compute_key (key_info)# ugh.
- voices_append ('\\key %s;' % lily_key(key_info))
- check_clef(clef_info)
+ __main__.global_key =compute_key (m.group(1))# ugh.
+ voices_append ('\\key %s;' % lily_key(m.group(1)))
+ check_clef(m.group(2))
else:
- __main__.global_key = compute_key (a)# ugh.
+ __main__.global_key =compute_key (a)# ugh.
voices_append ('\\key %s \\major;' % lily_key(a))
if g == 'O': # Origin
header ['origin'] = a
def pitch_to_mudela_name (name, acc, bar_acc, key):
s = ''
if acc == UNDEF:
- if not nobarlines:
- acc = bar_acc
+ acc = bar_acc
if acc == UNDEF:
acc = key
if acc == -1:
if str:
str = str[1:]
gc = re.sub('#', '\\#', gc) # escape '#'s
- state.next_articulation = ("^\"%s\"" % gc) + state.next_articulation
+ state.next_articulation = ("-\"%s\"" % gc) + state.next_articulation
return str
def try_parse_escape (str):
'[|' : '||',
':|' : ':|',
'|:' : '|:',
-'::' : ':|:',
+'::' : '::',
'|1' : '|',
'|2' : '|',
':|2' : ':|',
return str
-def try_parse_comment (str):
- global nobarlines
- #debugging
-# sys.stderr.write("str: %s \n" % str)
-
- # for now, just do %%MIDI nobarlines
- if (str[0] == '%'):
- #debugging
-# sys.stderr.write("we have %%\n")
- if str[0:5] == '%MIDI':
- #debugging
-# sys.stderr.write ("we have %%MIDI\n")
- if (string.find(str,'nobarlines') > 0):
- #debugging
-# sys.stderr.write ("we have nobarlines\n")
- nobarlines = 1
- return str
happy_count = 100
def parse_file (fn):
m = re.match ('^([^%]*)%(.*)$',ln) # add comments to current voice
if m:
if m.group(2):
- try_parse_comment(m.group(2))
voices_append ('%% %s\n' % m.group(2))
ln = m.group (1)
% header info (macros/defs, etc) should go into a \special{! ... },
% note the ! sign. See dvips.info for details.
%
-
+\def\lilySpace{ }
\def\turnOnPostScript{%
% This sets CTM so that you get to the currentpoint
% by executing a 0 0 moveto
\def\embeddedps##1{%
- \special{ps: @beginspecial @setspecial ##1 @endspecial}
+ \special{ps: @beginspecial @setspecial
+ \mudelapaperoutputscale\lilySpace\mudelapaperoutputscale\lilySpace scale ##1 @endspecial}%
}
}