The staff switches often do not end up in optimal places. For high
quality output, staff switches should be specified manually.
-
@node Manual staff switches
@subsection Manual staff switches
@code{"down"}.
+
@node Pedals
@subsection Pedals
@cindex Pedals
@end example
@end itemize
- The object description is an Scheme association
-list. Since a Scheme list is a singly linked list, we can treat it as
-a stack, and @code{\override} and @code{\revert} are push and pop
-operations. The association list is stored in a normal context
-property, hence
+The object description is an Scheme association list. Since a Scheme
+list is a singly linked list, we can treat it as a stack, and
+@code{\override} and @code{\revert} are push and pop operations. The
+association list is stored in a normal context property, hence
@example
\property Voice.NoteHead = #'()
@end example
crashes. Reverting properties that are system defaults may also lead
to crashes.
+A property tweak of modifies a local copy of the object definition.
+After such a tweak, the definition is independent of the objects in
+enclosing contexts. For example
+
+@lilypond
+ \property Voice.Stem \set #'neutral-direction = #1
+ b'8
+ \property Staff.Stem \set #'thickness = #4.0
+ b'16
+ \new Voice { b'32 }
+@end lilypond
+
+In this fragment, @code{neutral-direction} is tweaked. As a result,
+the current @internalsref{Voice} gets a private version of the
+@internalsref{Stem} object. The following tweak modifies the
+definition at @internalsref{Staff} level. Since it a different
+definition, the thickness of the @code{b'16} is unaffected. For the
+third note, a new Voice is created, which inherits the new definition,
+including the changed thickness, but excluding the new neutral
+direction.
+
+
@node Constructing a tweak
@subsection Constructing a tweak
The most common thing to change about the appearance of fonts is their
size. The font size of any context can be easily changed by setting
-the @code{fontSize} property for that context. Its value is an
-integer: negative numbers make the font smaller, positive numbers
-larger. An example is given below:
+the @code{fontSize} property for that context. Its value is a number:
+negative numbers make the font smaller, positive numbers larger. An
+example is given below:
@c
@lilypond[fragment,relative=1,verbatim,quote]
c4 c4 \property Voice.fontSize = #-1
f4 g4
@end lilypond
-This command will set @code{font-relative-size} (see below), and does
+This command will set @code{font-size} (see below), and does
not change the size of variable symbols, such as beams or slurs.
-
One of the uses of @code{fontSize} is to get smaller symbol for cue
notes. An elaborate example of those is in
@inputfileref{input/test,cue-notes.ly}.
@cindex magnification
-The size of the font may be scaled with the object property
-@code{font-magnification}. For example, @code{2.0} blows up all
-letters by a factor 2 in both directions.
@cindex cue notes
-@cindex font size
-@cindex size
-@cindex symbol size
-@cindex glyph size
The font used for printing a object can be selected by setting
@code{font-name}, e.g.
@noindent
Any font can be used, as long as it is available to @TeX{}. Possible
fonts include foreign fonts or fonts that do not belong to the
-Computer Modern font family.
+Computer Modern font family. The size of fonts selected in this way
+can be changed with the @code{font-magnification} property. For
+example, @code{2.0} blows up all letters by a factor 2 in both
+directions.
+
+@cindex font size
+@cindex font magnification
Font selection for the standard fonts, @TeX{}'s Computer Modern fonts,
can also be adjusted with a more fine-grained mechanism. By setting
all three mechanisms work for every object that supports
@code{font-interface}:
+
@table @code
@item font-family
is a symbol indicating the general class of the typeface. Supported are
font series for each font family and shape. Choices are @code{medium}
and @code{bold}.
-@item font-relative-size
- is a number indicating the size relative the standard size. For example,
- with 20pt staff height, relative size -1 corresponds to 16pt staff
- height, and relative size +1 corresponds to 23 pt staff height.
-
- There are small differences in design between fonts designed for
-different sizes, hence @code{font-relative-size} is preferred over
-@code{font-magnification} for changing font sizes.
-
-
-@item font-design-size
-is a number indicating the design size of the font.
-
-This is a feature of the Computer Modern Font: each point size has a
-slightly different design. Smaller design sizes are relatively wider,
-which enhances readability.
@end table
For any of these properties, the value @code{*} (i.e. the symbol
@cindex @code{font-style}
+The font size is set by modifying the @code{font-size} property. Its
+value is a number indicating the size relative to the standard size.
+Each step up is an increase of approximately 12% of the font size. Six
+steps is exactly a factor two.
+
+LilyPond has fonts in different design sizes: the music fonts for
+smaller sizes are chubbier, while the text fonts are relatively wider.
+Font size changes are achieved by scaling the design size that is
+closest to the desired size.
+
+The @code{font-size} mechanism does not work for fonts selected
+through @code{font-name}. These may be scaled with
+@code{font-magnification}.
+
@refcommands
The following commands set @code{fontSize} for the current voice.
footer = "Mutopia-2001/04/27-xx"
}
-\version "1.9.8"
+\version "2.1.1"
dynamicUp = \property Voice.DynamicLineSpanner \override #'direction = #1
dynamicRevert = \property Voice.DynamicLineSpanner \revert #'direction
allLyrics = \lyrics {
% maybe should be bigger by default, in grob-description.scm ?
- \property Lyrics . LyricText \override #'font-relative-size = #1
+ \property Lyrics . LyricText \override #'font-size = #2
\property Lyrics . LyricHyphen \override #'maximum-length = #1.5
\context LyricsVoice = "leise-1" { \lyricVerseOne
\lyricVerseTwo
%% 19 is broken --hwn.
%\include "paper19.ly"
\include "paper16.ly"
-\version "1.9.8"
+\version "2.1.1"
\header {
title = "Romanzen"
\property PianoStaff.connectArpeggios = ##t
\property PianoStaff.Arpeggio \override #'molecule-callback = \arpeggioBracket
- \property PianoStaff.InstrumentName \set #'font-relative-size = #3
+ \property PianoStaff.InstrumentName \set #'font-size = #6
\property PianoStaff.InstrumentName \set #'font-shape = #'italic
\property PianoStaff.InstrumentName \set #'font-magnification = #3
\clef G <<\global \context Voice=upv \righta >>
}
\context Staff = mid {
- \property Staff.InstrumentName \set #'font-relative-size = #0
+ \property Staff.InstrumentName \set #'font-size = #0
\property Staff.InstrumentName \set #'font-shape = #'upright
\property Staff.InstrumentName \set #'font-magnification = #1
\property Staff.InstrumentName \set #'extra-offset = #'(0 . 6)
endlonggrace = \property Voice.Stem \revert #'stroke-style
ritenuto = \markup { \italic "rit." }
-\version "1.9.8"
+\version "2.1.1"
cresc = \notes {
#(ly:export (make-event-chord (list (make-span-event 'CrescendoEvent START))))
restNumberThreshold = #1
RehearsalMark \override #'font-series = #'bold
- RehearsalMark \override #'font-relative-size = #3
+ RehearsalMark \override #'font-size = #6
Beam \override #'thickness = #0.6
Beam \override #'space-function = #(lambda (beam mult) 0.8)
\thenotes
}
>>
+\paper { raggedright = ##t }
}
>>
\new NoteNames \apply #no-octaves \voiceb
>>
+\paper { raggedright = ##t }
}
<< \foo
\context NoteNames \foo
>>
+\paper { raggedright = ##t }
}
-\version "1.9.8"
+\version "2.1.1"
\header {
texidoc ="
Template that puts dynamics on a separate line, so it is neatly
\consists "Dynamic_engraver"
\consists "Text_engraver"
- TextScript \override #'font-relative-size = #1
+ TextScript \override #'font-size = #2
TextScript \override #'font-shape = #'italic
DynamicText \override #'extra-offset = #'(0 . 2.5)
Hairpin \override #'extra-offset = #'(0 . 2.5)
-\version "1.9.8"
+\version "2.1.1"
\header {
texidoc = "@cindex Bagpipe Music
" }
-\version "1.9.8"
+\version "2.1.1"
\score {
\context Staff \notes \transpose c c' {
\property Score.barNumberVisibility = #(every-nth-bar-number-visible 4)
\property Score.BarNumber \override #'molecule-callback =
#(make-molecule-boxer 0.1 0.25 0.25 Text_item::brew_molecule)
- \property Score.BarNumber \override #'font-relative-size = #1
+ \property Score.BarNumber \override #'font-size = #2
\repeat unfold 9 { c1 } \bar "|."
}
-\version "1.9.8"
+\version "2.1.1"
\header{
texidoc="@cindex Cautionary Accidentals
LilyPond can display cautionary accidentals in different ways.
\score { \notes \context Staff \transpose c c'' {
\key d \major
% \property Staff.autoReminders = #'cautionary
- \property Staff.Accidental \override #'font-relative-size = #0
+ \property Staff.Accidental \override #'font-size = #0
<dis c>1 cis?2 d?
\property Staff.Accidental \override #'cautionary-style = #'smaller
<dis c>1 cis?2 d?
texidoc = "An alternate method to make bass figures is to use
markup texts."
}
-\version "1.9.8"
+\version "2.1.1"
nat = \markup { \musicglyph #"accidentals-0" }
sh = \markup { \smaller \raise #0.6 \musicglyph #"accidentals-1" }
\context Voice \notes {
\clef bass
\property Voice.TextScript \set #'font-family = #'number
- \property Voice.TextScript \set #'font-relative-size = #-3
+ \property Voice.TextScript \set #'font-size = #-6
\property Voice.TextScript \set #'baseline-skip = #1.4
dis4_\markup { 6 }
/*
- engravergroup.cc -- implement Engraver_group_engraver
-
+ engraver-group-engraver.cc -- implement Engraver_group_engraver
+
source file of the GNU LilyPond music typesetter
(c) 1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
}
}
-/*
-
- Done: eliminating useless broadcast/acknowledge
-
-
-One cause for translation slowness: grob broadcasted/acknowledges
- (b/a): every grob is b/a-ed to all peer-engravers and all
-parent-engravers. This means that lots of (often) useless b/a is done
-for large scores (the top-level engravers gets to know every detail of
-every voice, thread, etc. Measurements indicate this is 10% of the
- interpretation time:
-
- standchen
-
-old: (pre 1.5.13) 10.28
-new: 8.73
-speedup: 15 %
-
-Coriolan:
-
-new: 197.59
-old: 219.12 seconds
-speedup: 10%
-
-
-The cost of this B/A is # of useless engravers * cost of one ack,
-which is rather low, since cost of one ack is only an interface check.
-The cost of precomputing engraver lists has two elts: computing the
-list itself, GC for the structure, looking up the list during the
-acks.
-
-*/
SCM find_acknowledge_engravers (SCM gravlist, SCM meta);
SCM find_accept_engravers (SCM gravlist, SCM music_descr);
/*****************/
-bool engraver_valid (Translator*tr, SCM ifaces)
+bool
+engraver_valid (Translator*tr, SCM ifaces)
{
SCM ack_ifs = scm_assoc (ly_symbol2scm ("interfaces-acked"), tr->translator_description());
ack_ifs = gh_cdr (ack_ifs);
ADD_INTERFACE (Font_interface, "font-interface",
"Any symbol that is typeset through fixed sets of glyphs (ie. fonts)",
"font-magnification font font-series font-shape "
- "font-family font-name font-design-size font-relative-size");
+ "font-family font-name font-size");
return gh_cons (ly_interval2scm (b[X_AXIS]), ly_interval2scm(b[Y_AXIS]));
}
-
+
Molecule
Font_metric::get_char_molecule (int code) const
{
-#include "paper-def.hh"
-#include "font-interface.hh"
-#include "warn.hh"
-
-
-/*
- TODO revise font handling.
-
+/*
+ font-select.cc -- implement property -> font_metric routines.
-* relative sizes should relate to staff-space, eg. font-staff-space
-= 1.2 ^ relative-size
+ source file of the GNU LilyPond music typesetter
-* If a relative size is given, lily should magnify the closest
-design size font to match that. (ie. fonts should have variable
-scaling)
+ (c) 2003 Han-Wen Nienhuys <hanwen@xs4all.nl>
-(this requires that fonts are stored as (filename , designsize))
-
-
-
*/
+#include <math.h>
-
+#include "paper-def.hh"
+#include "font-interface.hh"
+#include "warn.hh"
LY_DEFINE(ly_paper_get_font,"ly:paper-get-font", 2, 0, 0,
(SCM paper, SCM chain),
{
return (val == SCM_BOOL_F || field_val == ly_symbol2scm ("*") || field_val == val);
}
+Font_metric*
+get_font_by_design_size (Paper_def* paper, Real requested,
+ SCM font_vector)
+{
+ int n = SCM_VECTOR_LENGTH (font_vector);
+ Real size = 1e6;
+ Real last_size = -1e6;
+ int i = 0;
+
+ for (; i < n; i++)
+ {
+ size = gh_scm2double (gh_car (SCM_VECTOR_REF (font_vector, i)));
+ if (size > requested)
+ break ;
+ last_size = size;
+ }
+
+ if (i == n)
+ {
+ i = n-1;
+ }
+ else if (i > 0)
+ {
+ if ((requested / last_size) < (size / requested))
+ {
+ i -- ;
+ size = last_size;
+ }
+ }
+
+ return paper->find_font (gh_cdr (SCM_VECTOR_REF (font_vector, i)),
+ requested / size);
+}
+
+
+Font_metric*
+get_font_by_mag_step (Paper_def* paper, Real requested_step,
+ SCM font_vector, Real default_size)
+{
+ return get_font_by_design_size (paper,
+ default_size * pow (2.0, requested_step / 6.0),
+ font_vector);
+}
+
+
/*
We can probably get more efficiency points if we preprocess FONTS
to make lookup easier.
*/
SCM
-properties_to_font_name (SCM fonts, SCM alist_chain)
+properties_to_font_size_family (SCM fonts, SCM alist_chain)
{
SCM shape = SCM_BOOL_F;
SCM family = SCM_BOOL_F;
SCM series = SCM_BOOL_F;
-
- SCM point_sz = ly_assoc_chain (ly_symbol2scm ("font-design-size"), alist_chain);
- SCM rel_sz = SCM_BOOL_F;
-
shape = ly_assoc_chain (ly_symbol2scm ("font-shape"), alist_chain);
family = ly_assoc_chain (ly_symbol2scm ("font-family"), alist_chain);
series = ly_assoc_chain (ly_symbol2scm ("font-series"), alist_chain);
series = ly_cdr (series);
- if (gh_pair_p (point_sz))
- point_sz = ly_cdr (point_sz);
- else
- {
- rel_sz = ly_assoc_chain (ly_symbol2scm ("font-relative-size"), alist_chain);
- if (gh_pair_p (rel_sz))
- rel_sz = ly_cdr (rel_sz);
- }
-
for (SCM s = fonts ; gh_pair_p (s); s = ly_cdr (s))
{
SCM qlist = ly_caar (s);
- if (!wild_compare (scm_list_ref (qlist, gh_int2scm (1)), series))
+ if (!wild_compare (SCM_VECTOR_REF (qlist, 0), series))
continue;
- if (!wild_compare (scm_list_ref (qlist, gh_int2scm (2)), shape))
+ if (!wild_compare (SCM_VECTOR_REF (qlist, 1), shape))
continue;
- if (!wild_compare (scm_list_ref (qlist, gh_int2scm (3)), family))
+ if (!wild_compare (SCM_VECTOR_REF (qlist, 2), family))
continue;
- if (point_sz == SCM_BOOL_F && !wild_compare (ly_car (qlist), rel_sz))
- continue;
-
SCM qname = ly_cdar (s);
return qname;
}
- warning (_ ("couldn't find any font satisfying "));
- scm_write (scm_list_n (point_sz, shape, series , family, rel_sz,
+ warning (_ ("couldn't find any font size family satisfying "));
+
+ scm_write (scm_list_n (shape, series , family,
SCM_UNDEFINED), scm_current_error_port ());
scm_flush (scm_current_error_port ());
return scm_makfrom0str ("cmr10");
-
}
if (!gh_pair_p (name) || !gh_string_p (gh_cdr (name)))
{
SCM fonts = paper->lookup_variable (ly_symbol2scm ("fonts"));
- name = properties_to_font_name (fonts, chain);
+ name = properties_to_font_size_family (fonts, chain);
}
else
name = gh_cdr (name);
+
+
+ if (gh_string_p (name))
+ {
+ SCM mag = ly_assoc_chain (ly_symbol2scm ("font-magnification"), chain);
- SCM mag = ly_assoc_chain (ly_symbol2scm ("font-magnification"), chain);
-
- Real rmag = gh_pair_p (mag) && gh_number_p (gh_cdr (mag))
- ? gh_scm2double (gh_cdr (mag)) : 1.0;
+ Real rmag = gh_pair_p (mag) && gh_number_p (gh_cdr (mag))
+ ? gh_scm2double (gh_cdr (mag)) : 1.0;
- Font_metric *fm = paper->find_font (name, rmag);
- return fm;
+ return paper->find_font (name, rmag);
+ }
+ else if (gh_pair_p (name)) // (DEFAULT . FONT-VEC) pair
+ {
+ SCM vec = gh_cdr (name);
+ SCM base_size = gh_car (name);
+
+ SCM font_size = ly_assoc_chain (ly_symbol2scm ("font-size"), chain);
+ Real req = 0.0;
+ if (gh_pair_p (font_size))
+ req = gh_scm2double (ly_cdr (font_size));
+
+ return get_font_by_mag_step (paper, req,
+ vec, gh_scm2double (base_size));
+ }
+
+ assert (0);
+
+ return 0;
}
+
+
/*
- font-size-engraver.cc -- implement
+ font-size-engraver.cc -- implement Font_size_engraver
source file of the GNU LilyPond music typesetter
if (gh_number_p (sz)
&& gh_scm2double (sz)
- && !gh_number_p (gi.grob_->get_grob_property ("font-relative-size")))
+ && !gh_number_p (gi.grob_->get_grob_property ("font-size")))
{
- gi.grob_->set_grob_property ("font-relative-size", sz);
+ gi.grob_->set_grob_property ("font-size", sz);
}
}
Sources sources_;
Array<String> inclusion_names_;
Array<String> target_strings_;
- Link_array<Score> scores_;
Protected_scm header_;
- void do_deps ();
- void do_scores ();
+ int score_count_;
+
+ void do_deps (String);
- Input_file_results (String file, String init);
+ Input_file_results (String init, String in, String out);
~Input_file_results ();
private:
extern Input_file_results* global_input_file;
-void do_one_file (String init_string, String file_string);
+void do_one_file (String init_string, String in_file, String out_file);
#endif /* FILE_RESULTS_HH */
#include "drul-array.hh"
+
/* Guile 1.4.x compatibility */
#if GUILE_MINOR_VERSION < 5
#if GUILE_MINOR_VERSION < 7
#define scm_gc_unregister_collectable_memory(a,b,c) scm_done_free(b)
#define scm_gc_register_collectable_memory(a,b,c) scm_done_malloc(b)
+#define SCM_VECTOR_REF(v,i) (SCM_VELTS((v))[(i)])
+
+
#endif
#include "direction.hh"
SCM index_get_cell (SCM cell, Direction d);
SCM index_set_cell (SCM cell, Direction d, SCM val);
-
-
SCM ly_snoc (SCM s, SCM list);
SCM ly_split_list (SCM s, SCM list);
SCM ly_unique (SCM list);
*/
void add_scm_init_func (void (*) ());
-
+extern "C" {
typedef SCM (*Scheme_function_unknown) ();
+}
#if __GNUC__ > 2 || __GNUC_MINOR__ >= 96
typedef SCM (*Scheme_function_0) ();
int get_tempo (Moment moment);
void set_tempo (Moment moment, int count_per_minute_i);
- virtual int get_next_score_count () const;
- static void reset_score_count ();
};
#endif // MIDI_DEF_HH
VIRTUAL_COPY_CONS (Music_output_def);
Music_output_def (Music_output_def const&);
Music_output_def ();
- virtual int get_next_score_count () const;
Global_translator *get_global_translator ();
Translator_group *get_group_translator (String type) const;
{
public:
Protected_scm header_;
- String default_out_string_;
- String origin_string_;
- int errorlevel_;
- virtual void process () {}
+ virtual void process (String) {}
virtual ~Music_output (){}
Music_output ()
{
- errorlevel_ = 0;
}
};
{
Protected_scm scopes_;
public:
- String main_input_string_;
+ String main_input_name_;
void * lexval;
bool main_input_b_;
~My_lily_parser ();
void do_init_file ();
- void parse_file ( String init_string, String file_string);
+ void parse_file (String init, String file, String out_name);
public:
Duration default_duration_;
-
+ String output_basename_;
+
Scheme_hash_table *default_header_;
int fatal_error_;
VIRTUAL_COPY_CONS (Music_output_def);
public:
- Paper_outputter* get_paper_outputter () ;
+ Paper_outputter* get_paper_outputter (String) const;
SCM font_descriptions ()const;
virtual ~Paper_def ();
Interval line_dimensions_int (int) const;
- virtual int get_next_score_count () const;
- static void reset_score_count ();
void output_settings (Paper_outputter*) const;
Font_metric * find_font (SCM name, Real mag);
class Paper_outputter
{
bool verbatim_scheme_b_;
-
-
public:
SCM output_func_ ;
protected:
/* MAIN ROUTINES */
- virtual void process ();
+ virtual void process (String);
private:
/// before calc_breaking
void output_header_track (Midi_stream& midi_stream_r);
void print () const;
- void process ();
+ void process (String);
Link_array<Audio_staff> audio_staffs_;
Cons<Audio_element> *audio_elem_p_list_;
#include "parray.hh"
#include "smobs.hh"
-/// the total music def of one movement
-class Score: public Input {
+class Score : public Input
+{
public:
- /// paper_, staves_ and commands_ form the problem definition.
Link_array<Music_output_def> defs_;
SCM music_;
SCM header_;
- Input_file_results* input_file_;
-
- int errorlevel_;
- /// construction
Score ();
Score (Score const&);
-
-
- void process ();
- void add_output (Music_output_def *def);
DECLARE_SMOBS (Score,foo);
private:
- void run_translator (Music_output_def*);
};
DECLARE_UNSMOB(Score,score);
+
+
+SCM ly_run_translator (SCM, SCM);
+SCM ly_render_output (SCM, SCM, SCM);
+void default_rendering (SCM,SCM,SCM,SCM);
#endif
#include "scm-hash.hh"
#include "ly-modules.hh"
+bool store_locations_global_b;
+
/*
no ! suffix since it doesn't modify 1st argument.
void
-Input_file_results::do_deps ()
+Input_file_results::do_deps (String output)
{
if (dependency_global_b)
{
- Path p = split_path (output_name_global);
+ Path p = split_path (output);
p.ext = "dep";
write_dependency_file (p.to_string (),
target_strings_,
}
}
-
-void
-Input_file_results::do_scores ()
-{
- if (header_ == SCM_EOL)
- header_ = ly_make_anonymous_module ();
-
- for (int i=0; i < scores_.size (); i++)
- {
- Score* is = scores_[i];
- is->input_file_ = this;
-
- if (is->errorlevel_)
- {
- is->warning (_ ("Score contains errors; will not process it"));
- exit_status_global |= 1;
- }
- else
- {
- is->process ();
- }
- }
- do_deps ();
-}
-
Input_file_results::~Input_file_results ()
{
- for (int i=0; i < scores_.size (); i++)
- scm_gc_unprotect_object (scores_[i]->self_scm ());
- scores_.clear ();
-
inclusion_names_.clear ();
if (header_)
header_ = SCM_EOL;
Input_file_results* global_input_file;
-Input_file_results::Input_file_results (String init_string, String file_string)
+Input_file_results::Input_file_results (String init, String in_file, String out_file)
{
- header_ = SCM_EOL;
+ header_ = ly_make_anonymous_module ();
global_input_file = this;
-
+ score_count_ = 0;
sources_.set_path (&global_path);
- My_lily_parser parser (this);
- progress_indication (_f ("Now processing: `%s'", file_string.to_str0 ()));
+ progress_indication (_f ("Now processing: `%s'", in_file.to_str0 ()));
progress_indication ("\n");
- parser.parse_file (init_string, file_string);
+
+ My_lily_parser parser (this);
+ parser.parse_file (init, in_file, out_file);
if (parser.error_level_)
{
exit_status_global = 1;
}
- else
- do_scores ();
+
+ do_deps (out_file);
}
void
-do_one_file (String init_string, String file_string)
+do_one_file (String init, String in_file, String out_file)
{
- if (init_string.length () && global_path.find (init_string).empty_b ())
+ if (init.length () && global_path.find (init).empty_b ())
{
- warning (_f ("can't find file: `%s'", init_string));
+ warning (_f ("can't find file: `%s'", init));
warning (_f ("(search path: `%s')", global_path.to_string ().to_str0 ()));
return;
}
- if ((file_string != "-") && global_path.find (file_string).empty_b ())
+
+ if ((in_file != "-") && global_path.find (in_file).empty_b ())
{
- warning (_f ("can't find file: `%s'", file_string));
+ warning (_f ("can't find file: `%s'", in_file));
return;
}
- Input_file_results inp_file(init_string, file_string);
+ Input_file_results inp_file (init, in_file, out_file);
}
#include <stdlib.h>
#include <math.h> /* isinf */
#include <string.h> /* strdup, strchr */
-
+#include <ctype.h>
#include "lily-proto.hh"
return p;
}
-String
-format_to_ext (String format)
-{
- if (format == "tex")
- /* .lytex change put off */
- return "tex"; // "lytex";
- return format;
-}
-
void
prepend_load_path (String dir)
{
do
{
String infile (arg);
- Midi_def::reset_score_count ();
- Paper_def::reset_score_count ();
-
Path inpath = distill_inname (infile);
/* By default, use base name of input file for output file name */
Path outpath = inpath;
if (inpath.to_string () != "-")
- outpath.ext = format_to_ext (output_format_global);
+ outpath.ext = output_format_global;
/* By default, write output to cwd; do not copy directory part
of input file name */
else
init = "init.ly";
- /* Burp: output name communication goes through _global */
- String save_output_name_global = output_name_global;
- output_name_global = outpath.to_string ();
- do_one_file (init, inpath.to_string ());
- output_name_global = save_output_name_global;
+ do_one_file (init, inpath.to_string (), outpath.to_string ());
p++;
} while ((arg = oparser_p_static->get_next_arg ()));
String s = oparser_p_static->optional_argument_str0_;
Path p = split_path (s);
if (s != "-" && p.ext.empty_b ())
- p.ext = format_to_ext (output_format_global);
+ p.ext = output_format_global;
+
output_name_global = p.to_string ();
}
break;
case 'f':
if (oparser_p_static->optional_argument_str0_ == "help")
{
- printf("See http://lilypond.org/wiki?OutputFormats for more information.\n"\
- "This option is for developers only.\n");
+ printf("This option is for developers only; Read the source code for more information\n");
+
+ // actually it's not here,
+ // but we award you special points for looking here.
+
exit (0);
}
output_format_global = oparser_p_static->optional_argument_str0_;
if (text_ && Bar_line::has_interface (s))
{
/*
- Ugh. Figure out how to do this right at beginning of line, (without
- creating class Bar_script : public Item).
+ TODO: make this configurable. RehearsalMark cannot be
+ break-aligned, since the width of the object should not be taken
+ into alignment considerations.
*/
text_->set_parent (s, X_AXIS);
}
set_variable (ly_symbol2scm ("whole-in-seconds"), m.smobbed_copy ());
}
-
-int Midi_def::score_count_=0;
-
-int
-Midi_def::get_next_score_count () const
-{
- return score_count_++;
-}
-
-void
-Midi_def::reset_score_count ()
-{
- score_count_ = 0;
-}
#include "ly-smobs.icc"
-int
-Music_output_def::get_next_score_count () const
-{
- return 0;
-}
-
Music_output_def::Music_output_def ()
{
scaled_fonts_ = SCM_EOL;
scope_ = ly_make_anonymous_module();
}
+
+
Music_output_def::~Music_output_def ()
{
}
return 1;
}
-/*
- ugh: should move into Music_output_def (complication: .midi and .tex
- need separate counts.) */
-String
-Music_output_def::outname_string ()
-{
- String out = output_name_global;
- int def = get_next_score_count ();
- if (def && out != "-")
- {
- Path p = split_path (out);
- p.base += "-" + to_string (def);
- out = p.to_string ();
- }
- return out;
-}
-
-
SCM
Music_output_def::get_scmvar (String s) const
return scm_variable_ref (var);
}
-
LY_DEFINE(ly_paper_lookup,
"ly:paper-lookup",
2, 0,0,
mutable_property_alist_ = scm_assq_set_x (mutable_property_alist_, s, v);
}
-
-
#include "main.hh"
void
}
-LY_DEFINE(ly_get_music_length,
- "ly:get-music-length", 1, 0, 0, (SCM mus),
+LY_DEFINE(ly_music_length,
+ "ly:music-length", 1, 0, 0, (SCM mus),
"Get the length (in musical time) of music expression @var{mus}.")
{
Music * sc = unsmob_music (mus);
LY_DEFINE(ly_get_mus_property,
"ly:get-mus-property", 2, 0, 0, (SCM mus, SCM sym),
"Get the property @var{sym} of music expression @var{mus}.\n"
- "If @var{sym} is undefined, return @code{'()}.\n"
- )
+ "If @var{sym} is undefined, return @code{'()}.\n" )
{
Music * sc = unsmob_music (mus);
SCM_ASSERT_TYPE(sc, mus, SCM_ARG1, __FUNCTION__, "music");
scm_gc_protect_object (rv);
return unsmob_music (rv);
}
+
void
My_lily_lexer::start_main_input ()
{
- new_input (main_input_string_, &global_input_file->sources_);
+ new_input (main_input_name_, &global_input_file->sources_);
allow_includes_b_ = allow_includes_b_ && ! (safe_global_b);
scm_module_define (gh_car (scopes_),
ly_symbol2scm ("input-file-name"),
- scm_makfrom0str (main_input_string_.to_str0()));
+ scm_makfrom0str (main_input_name_.to_str0()));
}
void
void
-My_lily_parser::parse_file (String init, String s)
+My_lily_parser::parse_file (String init, String in_file, String out_file)
{
lexer_ = new My_lily_lexer;
-
- lexer_->main_input_string_ = s;
+ output_basename_ = out_file;
+
+ lexer_->main_input_name_ = in_file;
progress_indication (_ ("Parsing..."));
}
-int Paper_def::score_count_ = 0;
-
-int
-Paper_def::get_next_score_count () const
-{
- return score_count_ ++;
-}
-
-void
-Paper_def::reset_score_count ()
-{
- score_count_ = 0;
-}
Paper_outputter*
-Paper_def::get_paper_outputter ()
+Paper_def::get_paper_outputter (String outname) const
{
- String outname = outname_string ();
progress_indication (_f ("paper output to `%s'...",
outname == "-" ? String ("<stdout>") : outname));
urg. clean me
*/
void
-Paper_score::process ()
+Paper_score::process (String outname)
{
if (verbose_global_b)
progress_indication (_f ("Element count %d (spanners %d) ",
Array<Column_x_positions> breaking = calc_breaking ();
system_->break_into_pieces (breaking);
- outputter_ = paper_->get_paper_outputter ();
+ outputter_ = paper_->get_paper_outputter (outname);
outputter_->output_header ();
outputter_->output_version ();
outputter_->output_scope (header_, "lilypond");
outputter_->write_header_fields_to_file (header_);
}
-
+
+#if 0
+ // todo: transport origin_string_ in header.
outputter_->output_comment (_ ("Outputting Score, defined at: "));
outputter_->output_comment (origin_string_);
-
+#endif
+
outputter_->output_scope (paper_->scope_, "lilypondpaper");
SCM scm = scm_list_n (ly_symbol2scm ("header-end"), SCM_UNDEFINED);
*/
#include <ctype.h>
-#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include "text-item.hh"
#include "music-list.hh"
-
#define MY_MAKE_MUSIC(x) make_music_by_name (ly_symbol2scm (x))
THIS->input_file_->header_ = $1;
}
| score_block {
- THIS->input_file_->scores_.push ($1);
+ Score * sc = $1;
+
+ SCM head = ly_module_p (sc->header_) ? sc->header_ : THIS->input_file_->header_.to_SCM ();
+
+ Path p = split_path (THIS->output_basename_);
+ int *c = &THIS->input_file_->score_count_;
+ if (*c)
+ {
+ p.base += "-" + to_string (*c);
+ }
+
+ (*c)++;
+ SCM outname = scm_makfrom0str (p.to_string ().to_str0());
+
+ for (int i=0; i < sc->defs_.size (); i++)
+ default_rendering (sc->music_, sc->defs_[i]->self_scm(),head, outname);
+
+ if (sc->defs_.empty ())
+ {
+ Music_output_def *id =
+ unsmob_music_output_def (THIS->lexer_->lookup_identifier
+ ("$defaultpaper"));
+
+ id = id ? id->clone () : new Paper_def;
+
+ default_rendering (sc->music_, id->self_scm(), head, outname);
+
+ scm_gc_unprotect_object (id->self_scm ());
+ }
+ scm_gc_unprotect_object (sc->self_scm());
}
| output_def {
if (dynamic_cast<Paper_def*> ($1))
;
translator_spec_body:
- TRANSLATOR_IDENTIFIER {
+ /**/ {
+ $$ = Translator_def::make_scm ();
+ unsmob_translator_def ($$)->set_spot (THIS->here_input ());
+ }
+ | TRANSLATOR_IDENTIFIER {
$$ = $1;
unsmob_translator_def ($$)-> set_spot (THIS->here_input ());
}
- | TYPE STRING {
- $$ = Translator_def::make_scm ();
- Translator_def*td = unsmob_translator_def ($$);
- td->translator_group_type_ = $2;
- td->set_spot (THIS->here_input ());
+ | translator_spec_body TYPE STRING {
+ unsmob_translator_def ($$)->translator_group_type_ = $3;
}
| translator_spec_body DESCRIPTION string {
unsmob_translator_def ($$)->description_ = $3;
/*cont*/ '{' score_body '}' {
THIS->pop_spot ();
$$ = $4;
- if (!$$->defs_.size ())
- {
- Music_output_def *id =
- unsmob_music_output_def (THIS->lexer_->lookup_identifier ("$defaultpaper"));
- $$->add_output (id ? id->clone () : new Paper_def );
- }
+
}
;
$$->header_ = $2;
}
| score_body output_def {
- $$->add_output ($2);
+ $$->defs_.push ($2);
}
| score_body error {
Midi_text at (&at_a);
midi_track.add (Moment (0), &at);
-
- str = _f ("from musical definition: %s", origin_string_);
+
+ // TODO:
+ // str = _f ("from musical definition: %s", origin_string_);
Audio_text from_a (Audio_text::TEXT, str);
Midi_text from (&from_a);
void
-Performance::process ()
+Performance::process (String out)
{
- String out = output_name_global;
if (out == "-")
out = "lelie.midi";
- int def = midi_->get_next_score_count ();
- if (def)
- {
- Path p = split_path (out);
- p.base += "-" + to_string (def);
- out = p.to_string ();
- }
-
+
/* Maybe a bit crude, but we had this before */
Path p = split_path (out);
p.ext = "midi";
if (p->line_spanner_)
{
Side_position_interface::add_support (p->line_spanner_, info.grob_);
-
add_bound_item (p->line_spanner_,info.grob_);
}
if (p->bracket_)
p->bracket_->set_grob_property ("pedal-text", p->item_->self_scm ());
}
- p->bracket_->set_bound (LEFT, unsmob_grob (get_property ("currentMusicalColumn")));
- Axis_group_interface::add_element (p->line_spanner_, p->bracket_);
- add_bound_item (p->line_spanner_, p->bracket_->get_bound (LEFT));
+ /*
+ We do not use currentMusicalColumn for the left span-point.
+ If the column as accidentals (eg on a different stave), the
+ currentMusicalColumn is too wide, making the bracket too big.
+
+ TODO:
+
+ Hmm. What do we do when there are no notes when the spanner starts?
+
+ TODO:
+
+ what about the right span point?
+
+ */
+ Axis_group_interface::add_element (p->line_spanner_, p->bracket_);
announce_grob (p->bracket_, p->event_drul_[START]->self_scm ());
if (!p->event_drul_[STOP])
--- /dev/null
+/*
+ recording-group-engraver.cc -- implement Recording_group_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2003 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ */
+
+#include "engraver-group-engraver.hh"
+#include "protected-scm.hh"
+
+class Recording_group_engraver : public Engraver_group_engraver
+{
+public:
+ TRANSLATOR_DECLARATIONS(Recording_group_engraver);
+ virtual bool try_music (Music *m);
+ virtual void start_translation_timestep ();
+ virtual void stop_translation_timestep ();
+ virtual void finalize ();
+ virtual void initialize ();
+ Protected_scm accumulator_;
+};
+
+void
+Recording_group_engraver::initialize ()
+{
+ Engraver_group_engraver::initialize ();
+ accumulator_ = gh_cons (SCM_EOL, SCM_EOL);
+}
+
+Recording_group_engraver::Recording_group_engraver()
+{
+}
+
+void
+Recording_group_engraver::start_translation_timestep ()
+{
+ Engraver_group_engraver::start_translation_timestep();
+
+ scm_set_car_x (accumulator_, gh_cons (now_mom ().smobbed_copy (), SCM_EOL));
+}
+
+void
+Recording_group_engraver::stop_translation_timestep ()
+{
+ Engraver_group_engraver::stop_translation_timestep();
+ scm_set_cdr_x (accumulator_, gh_cons (gh_car (accumulator_), gh_cdr (accumulator_)));
+
+ scm_set_car_x (accumulator_, SCM_EOL);
+}
+
+void
+Recording_group_engraver::finalize ()
+{
+ Engraver_group_engraver::finalize ();
+ SCM proc = get_property ("recordEventSequence");
+
+ if (gh_procedure_p (proc))
+ scm_call_2 (proc, daddy_trans_->self_scm(), gh_cdr (accumulator_));
+
+ accumulator_ = SCM_EOL;
+}
+
+bool
+Recording_group_engraver::try_music (Music *m)
+{
+ bool here_success = Translator_group::try_music_on_nongroup_children (m);
+ bool retval = here_success;
+ if (!here_success && daddy_trans_)
+ retval = daddy_trans_->try_music (m);
+
+ SCM seq = gh_cdar (accumulator_);
+ seq = gh_cons (gh_cons (m->self_scm(), gh_bool2scm (here_success)),
+ seq);
+
+ scm_set_cdr_x (gh_car (accumulator_), seq);
+
+ return retval;
+}
+
+
+ENTER_DESCRIPTION(Recording_group_engraver,
+ "Engraver_group_engraver that records all music events "
+ "for this context. Calls the procedure "
+ "in @code{recordEventSequence} when finished.",
+ "",
+ "",
+ "",
+ "recordEventSequence",
+ "");
"@end table\n"
"\n"
"This function is useful to call from the command line: @code{lilypond -e\n"
-"\"(ly-set-option 'midi-debug #t_)\"}.\n")
+"\"(ly-set-option 'midi-debug #t)\"}.\n")
{
if (val == SCM_UNDEFINED)
val = SCM_BOOL_T;
progress_indication ("[" + to_string (breaks_) + "]");
check_removal ();
- removal_processing ();
+ finalize ();
}
Score_performer::finish ()
{
check_removal ();
- removal_processing ();
+ finalize ();
}
Music_output *
Score::Score ()
: Input ()
{
- input_file_ = 0;
header_ = SCM_EOL;
music_ = SCM_EOL;
- errorlevel_ = 0;
smobify_self ();
}
+Score::~Score ()
+{
+
+}
+
+
+
+
+IMPLEMENT_SMOBS (Score);
+IMPLEMENT_DEFAULT_EQUAL_P (Score);
+
+
+SCM
+Score::mark_smob (SCM s)
+{
+ Score * sc = (Score*) SCM_CELL_WORD_1 (s);
+
+ if (sc->header_)
+ scm_gc_mark (sc->header_);
+ for (int i = sc->defs_.size (); i--;)
+ scm_gc_mark (sc->defs_[i]->self_scm ());
+
+ return sc->music_;
+}
+
+int
+Score::print_smob (SCM , SCM p, scm_print_state*)
+{
+ scm_puts ("#<Score>", p);
+
+ return 1;
+}
+
+
+
/*
store point & click locations.
Global to save some time. (Sue us!)
*/
-bool store_locations_global_b;
Score::Score (Score const &s)
: Input (s)
for (int i=0; i < s.defs_.size (); i++)
defs_.push (s.defs_[i]->clone ());
- errorlevel_ = s.errorlevel_;
header_ = ly_make_anonymous_module ();
if (ly_module_p (s.header_))
ly_copy_module_variables (header_, s.header_);
}
-Score::~Score ()
-{
-
-}
-
-void
-Score::run_translator (Music_output_def *odef)
+LY_DEFINE(ly_run_translator, "ly:run-translator",
+ 2, 0, 0,
+ (SCM mus, SCM output_def),
+ "Process @var{mus} according to @var{output_def}. A interpretation "
+"context is set up, and @var{mus} is interpreted with it. The "
+"context is returned in its final state." )
{
+ Music_output_def *odef = unsmob_music_output_def (output_def);
+ Music * music = unsmob_music (mus);
+
+ SCM_ASSERT_TYPE (music, mus, SCM_ARG1, __FUNCTION__, "Music");
+ SCM_ASSERT_TYPE (odef, output_def, SCM_ARG2, __FUNCTION__, "Output definition");
+
Cpu_timer timer;
Global_translator * trans = odef->get_global_translator ();
if (!trans)
{
programming_error ("no toplevel translator");
- return ;
+ return SCM_BOOL_F;
}
progress_indication (_ ("Interpreting music..."));
- Music * music = unsmob_music (music_);
trans->final_mom_ = music->get_length ();
SCM protected_iter = Music_iterator::get_static_get_iterator (music);
if (! iter->ok ())
{
warning (_ ("Need music in a score"));
- errorlevel_ =1;
- return ;
+ return SCM_BOOL_F; // todo: shoudl throw exception.
}
trans->start ();
scm_remember_upto_here_1 (protected_iter);
trans->finish ();
- if (errorlevel_)
- {
- // should we? hampers debugging.
- warning (_ ("errors found."));
- }
-
- Music_output * output = trans->get_output ();
- scm_gc_unprotect_object (trans->self_scm ());
-
if (verbose_global_b)
progress_indication (_f ("elapsed time: %.2f seconds", timer.read ()));
- if (!header_)
- header_ = ly_make_anonymous_module(); // ug.h
-
- output->header_ = header_;
- output->origin_string_ = location_string ();
-
- progress_indication ("\n");
- output->process ();
- delete output ;
+ return scm_gc_unprotect_object (trans->self_scm ());
}
-void
-Score::process ()
-{
- if (!unsmob_music (music_))
- return;
- for (int i=0; i < defs_.size (); i++)
- {
- if (no_paper_global_b
- && dynamic_cast<Paper_def*> (defs_[i]))
- continue;
- run_translator (defs_[i]);
- }
-}
-
-
-void
-Score::add_output (Music_output_def *pap)
+LY_DEFINE(ly_render_output, "ly:render-output",
+ 3,0,0,
+ (SCM context, SCM header, SCM out_filename),
+ "Given a Score context in its final state, calculate the output, "
+ "and dump the result to @var{out-filename}, using "
+ "@var{header} for the bibliographic information.")
{
- defs_.push (pap);
-}
-
-IMPLEMENT_SMOBS (Score);
-IMPLEMENT_DEFAULT_EQUAL_P (Score);
-
+ Translator *tr = unsmob_translator (context);
+ Global_translator * gt = dynamic_cast<Global_translator*> (tr);
+
+ SCM_ASSERT_TYPE(gt, context, SCM_ARG1, __FUNCTION__,
+ "Score context");
+ SCM_ASSERT_TYPE(ly_module_p(header), header, SCM_ARG2, __FUNCTION__,
+ "module");
+ SCM_ASSERT_TYPE(gh_string_p (out_filename), out_filename, SCM_ARG3, __FUNCTION__,
+ "output filename");
-SCM
-Score::mark_smob (SCM s)
-{
- Score * sc = (Score*) SCM_CELL_WORD_1 (s);
+ Music_output * output = gt->get_output ();
- if (sc->header_)
- scm_gc_mark (sc->header_);
- for (int i = sc->defs_.size (); i--;)
- scm_gc_mark (sc->defs_[i]->self_scm ());
+ output->header_ = header;
- return sc->music_;
+ progress_indication ("\n");
+ output->process (ly_scm2string (out_filename));
+
+ delete output ;
+
+ return SCM_UNDEFINED ;
}
-int
-Score::print_smob (SCM , SCM p, scm_print_state*)
+void
+default_rendering (SCM mus, SCM outdef, SCM head, SCM outname)
{
- scm_puts ("#<Score>", p);
-
- return 1;
+ SCM context = ly_run_translator (mus, outdef);
+
+ if (unsmob_translator (context))
+ ly_render_output (context, head, outname);
}
{
Grob *me = unsmob_grob (smob);
- Link_array<Grob> all (me->pscore_->system_->columns ()) ;
+ Link_array<Grob> all (me->pscore_->system_->columns ());
set_explicit_neighbor_columns (all);
Real l = Note_head::head_extent (heads[i], X_AXIS).length ();
Direction d = get_direction (me);
- /* reversed head should be shifted l-thickness, but this looks
- too crowded, so we only shift l-0.5*thickness.
- Notice that this leads to assymetry: Normal heads overlap
- the stem 100% whereas reversed heads only overlaps the stem
- 50% */
- #define magic 0.5
- heads[i]->translate_axis ((l-thick*magic) * d, X_AXIS);
+ /*
+ Reversed head should be shifted l-thickness, but this
+ looks too crowded, so we only shift l-0.5*thickness.
+
+ This leads to assymetry: Normal heads overlap the
+ stem 100% whereas reversed heads only overlaps the
+ stem 50%
+
+ */
+
+ Real reverse_overlap =0.5;
+ heads[i]->translate_axis ((l-thick*reverse_overlap) * d, X_AXIS);
if (invisible_b(me))
- heads[i]->translate_axis (-thick*(2-magic) * d , X_AXIS);
+ heads[i]->translate_axis (-thick*(2 - reverse_overlap) * d , X_AXIS);
/* TODO:
bool
-String_number_engraver::try_music (Music * m)
+String_number_engraver::try_music (Music * )
{
return true;
}
while (flip (&d) != LEFT);
-
SCM properties = Font_interface::font_alist_chain (me);
SCM edge_text = me->get_grob_property ("edge-text");
Drul_array<Molecule> edge;
#include "grob-pitch-tuple.hh"
#include "warn.hh"
#include "note-head.hh"
+#include "staff-symbol-referencer.hh"
/**
Manufacture ties. Acknowledge noteheads, and put them into a
for (int i = heads_to_tie_.size (); i--;)
{
Grob *th = heads_to_tie_[i];
- int staff_pos = gh_scm2int (h->get_grob_property ("staff-position"));
- int left_staff_pos = gh_scm2int (th->get_grob_property ("staff-position"));
+ int staff_pos = int (Staff_symbol_referencer::get_position (h));
+ int left_staff_pos = int (Staff_symbol_referencer::get_position (th));
+
if (staff_pos == left_staff_pos)
{
Grob * p = new Spanner (get_property ("Tie"));
if (!hebbes_b && daddy_trans_)
hebbes_b = daddy_trans_->try_music (m);
+
return hebbes_b ;
}
void
Translator_group::terminate_translator (Translator*r)
{
- r->removal_processing ();
+ r->finalize ();
/*
Return value ignored. GC does the rest.
*/
void
Translator_group::finalize ()
{
- each (&Translator::removal_processing);
+ each (&Translator::finalize);
}
return daddy_trans_->now_mom ();
}
-void
-Translator::removal_processing ()
-{
- finalize ();
-}
-
void
Translator::do_announces ()
{
(Voice Stem lengths ,(map (lambda (x) (* 0.8 x)) '(3.5 3.5 3.5 4.5 5.0)))
(Voice Stem stem-shorten (0.4 0))
- (Voice Stem font-relative-size -1)
- (Voice NoteHead font-relative-size -1)
- (Voice Dots font-relative-size -1)
+ (Voice Stem font-size -3)
+ (Voice NoteHead font-size -3)
+ (Voice Dots font-size -3)
(Voice Stem beamed-lengths
,(map (lambda (x) (* 0.8 x)) '(3.26)))
(Voice Stem beamed-minimum-free-lengths
(Voice Beam position-callbacks (,Beam::least_squares
,Beam::check_concave
,Beam::slope_damping))
- (Staff Accidental font-relative-size -2)
+ (Staff Accidental font-size -4)
(Voice Slur direction -1)
)
-\version "1.9.8"
+\version "2.1.1"
%%%%%%%%
%%%%%%%% shortcuts common for all styles of gregorian chant notation
%
virgula = {
\once \property Voice.BreathingSign \override #'text = #(make-musicglyph-markup "scripts-rcomma")
- \once \property Voice.BreathingSign \override #'font-relative-size = #-1
+ \once \property Voice.BreathingSign \override #'font-size = #-2
% Workaround: add padding. Correct fix would be spacing engine handle this.
\once \property Voice.BreathingSign \override #'extra-X-extent = #'(-1.0 . 0)
}
caesura = {
\once \property Voice.BreathingSign \override #'text = #(make-musicglyph-markup "scripts-rvarcomma")
- \once \property Voice.BreathingSign \override #'font-relative-size = #-1
+ \once \property Voice.BreathingSign \override #'font-size = #-2
% Workaround: add padding. Correct fix would be spacing engine handle this.
\once \property Voice.BreathingSign \override #'extra-X-extent = #'(-1.0 . 0)
paperEleven = \paper {
staffheight = 11.0\pt
- #(define fonts (make-font-list 'paper11))
+ #(define fonts (scale-font-list (/ 11. 20.)))
\include "params-init.ly"
}
paperThirteen = \paper {
staffheight = 13.0\pt
- #(define fonts (make-font-list 'paper13))
+ #(define fonts (scale-font-list (/ 13. 20.)))
\include "params-init.ly"
}
paperSixteen = \paper {
staffheight = 16.0\pt
- #(define fonts (make-font-list 'paper16))
+ #(define fonts (scale-font-list (/ 16. 20.)))
\include "params-init.ly"
}
paperTwenty = \paper {
staffheight = 20.0\pt
- #(define fonts (make-font-list 'paper20))
+ #(define fonts (scale-font-list 1.0))
\include "params-init.ly"
}
\paper { \paperTwenty }
+
+
+%{
+
+; note:
+; you can add fonts manually in the paper block by issuing
+
+#(set! fonts (append ...myfonts... fonts))
+
+for the format of myfonts, see font.scm
+
+%}
paperTwentythree = \paper {
staffheight = 23.0\pt
- #(define fonts (make-font-list 'paper23))
+ #(define fonts (scale-font-list (/ 23. 20.)))
\include "params-init.ly"
}
paperTwentysix = \paper {
staffheight = 26.0\pt
- #(define fonts (make-font-list 'paper26))
+ #(define fonts (scale-font-list (/ 26. 20.)))
\include "params-init.ly"
}
-\version "1.9.8"
+\version "2.1.1"
% JUNKME.
%% deprecated
%%
#(define font-defaults
'((font-family . music)
- (font-relative-size . 0)
(font-shape . upright)
(baseline-skip . 2)
(word-space . 0.6)
INSTALLATION_OUT_FILES3=$(TFM_FILES)
-SAUTER_FONTS = cmbxti5 cmbxti6 cmbxti7 cmbxti8 cmbxti12 \
- cmcsc7 cmcsc8 cmcsc12 cmtt5 cmtt6 cmtt7 cmtt17 \
- cmbx14 cmbx17 cmti5 cmti6 cmss5 cmss6 cmss7 cmss14
+SAUTER_FONTS = cmbxti7
ALL_FONTS = $(FETA_FONTS) $(SAUTER_FONTS)
enddef;
+% a: x diameter
+% b: y diameter
+% err_x: drift of y axis at top
+% err_y: drift of x axis at right
+def distorted_ellipse(expr a,b,err_y,err_x,super) =
+ superellipse((a,err_x),(-err_y,b),(-a,-err_x),(err_y,-b),super);
+ enddef;
+
+
+
% draw the outer and inner ellipse.
def notehead_draw =
path black,white;
black=distorted_ellipse(a,beta,a*err_y_a,0,superness);
white=distorted_ellipse(ai,bi,ai*err_y_ai,bi*err_x_bi,inner_superness);
-if test>1: %fixme
+if test > 1: %fixme
save x;
x1=-x3=a; x2=x4=0; y1=y3=0; y2=-y4=b;
penlabels(1,2,3,4);
fet_beginchar("Half notehead", "1",
"halfhead")
setup_notehead_vars;
- % a_b:=1.49; % after text
+ % a_b:=1.49; % after text
a_b:=1.50; % after drawing
err_y_a:=0.157;
tilt:=34;
+
% superness:=0.66;
superness:=0.67; % jcn
+
% ai_a:=0.863;
% was 0.85
% set to 0.83 to avoid stem entering white part.
+%%
+%
+% TODO: blot diameter should be fixed, not scalable.
+%
+%
+
+
save serif_thick;
serif_thick# = 1.1 stafflinethickness#;
define_blacker_pixels (serif_thick);
input feta-solfa;
else:
- input feta-bolletjes;
- input feta-banier;
-% input feta-eindelijk;
-% input feta-klef;
-% input feta-toevallig;
-% input feta-schrift;
-% input feta-haak;
-% input feta-timesig;
-% input feta-pendaal;
-% input feta-accordion;
-% input feta-solfa;
+ input feta-test-generic.mf;
+
fi
enddef;
%
-% a: x diameter
-% b: y diameter
-% err_x: drift of y axis at top
-% err_y: drift of x axis at right
-def distorted_ellipse(expr a,b,err_y,err_x,super) =
- superellipse((a,err_x),(-err_y,b),(-a,-err_x),(err_y,-b),super);
- enddef;
-
-
-
%
% draw an axis aligned block making sure that edges are on pixels.
%
staff_space#:=staffsize#/(stafflines-1);
+
% URG!
%font_x_height staff_space# ;
z5 = z1 reflectedabout((0,0), (1,1));
labels(1,2,3,4,5);
- pickup pencircle scaled 1/20 staff_space;
+ pickup pencircle scaled blot_diameter;
filldraw
z1{dir 45} .. {right}z2 -- z3 --
z4{down} .. {dir 225}z5 .. cycle;
input feta-autometric;
fet_beginfont("feta", 11);
-staffsize#:=11pt#;
+staffsize#:=11.22pt#;
test:=0;
% feta16.mf
% part of LilyPond's pretty-but-neat music font
-
input feta-autometric;
fet_beginfont("feta", 13);
-staffsize#:=13pt#;
+staffsize#:=12.60pt#;
test:=0;
input feta-autometric;
fet_beginfont("feta", 16);
-staffsize#:=16pt#;
+staffsize#:=15.87pt#;
test:=0;
% part of LilyPond's pretty-but-neat music font
input feta-autometric;
-% why is this 22.5?
+
+% todo change file name
fet_beginfont("feta", 22.5);
-staffsize#:=22.5pt#;
+staffsize#:=22.45pt#;
test:=0;
input feta-autometric;
fet_beginfont("feta", 26);
-staffsize#:=26pt#;
+staffsize#:=25.20pt#;
test:=0;
% parmesan11.mf
% part of LilyPond's pretty-but-neat music font
-staffsize#:=11pt#;
+staffsize#:=11.22pt#;
input feta-autometric;
fet_beginfont("parmesan", 11);
% parmesan13.mf
% part of LilyPond's pretty-but-neat music font
-staffsize#:=13pt#;
+staffsize#:=12.60pt#;
input feta-autometric;
fet_beginfont("parmesan", 13);
% parmesan16.mf
% part of LilyPond's pretty-but-neat music font
-staffsize#:=16pt#;
+staffsize#:=15.87pt#;
input feta-autometric;
fet_beginfont("parmesan", 16);
% parmesan23.mf
% part of LilyPond's pretty-but-neat music font
-staffsize#:=23pt#;
+staffsize#:=22.45pt#;
input feta-autometric;
fet_beginfont("parmesan", 23);
% parmesan26.mf
% part of LilyPond's pretty-but-neat music font
-staffsize#:=26pt#;
+staffsize#:=25.20pt#;
input feta-autometric;
fet_beginfont("parmesan", 26);
(define (is-req-chord? m)
(and
(memq 'event-chord (ly:get-mus-property m 'types))
- (not (equal? (ly:make-moment 0 1) (ly:get-music-length m)))))
+ (not (equal? ZERO-MOMENT (ly:music-length m)))))
(let* ((elts (filter is-req-chord? (ly:get-mus-property seq 'elements)))
(alist (map chord-to-exception-entry elts)))
definition: music roman braces dynamic math ...")
(grob-property-description 'font-name string? "file name for the font to load.
Overrides all other font-X qualifiers.")
-(grob-property-description 'font-design-size number? "partial font definition: exact font size in points FIXME: should override font-relative-size.")
(grob-property-description 'font-magnification number? "Magnification
of the font. If undefined, the default is @code{1.0}.")
-(grob-property-description 'font-relative-size number? "partial font
-definition: the relative size compared the `normal' size. 0 is
-style-sheet's normal size, -1 is smaller, +1 is bigger.")
+(grob-property-description 'font-size number? "font definition: the
+relative size compared the `normal' size. 0 is style-sheet's normal
+size, -1 is smaller, +1 is bigger. Each step of 1 is approximately
+12% larger, 6 steps are exactly a factor 2 larger. Fractional values are allowed.")
(grob-property-description 'font-series symbol? "partial font definition: medium, bold.")
(grob-property-description 'font-shape symbol? "partial font definition: upright or italic.")
not less than minimumFret")
(translator-property-description 'minimumVerticalExtent number-pair?
"minimum vertical extent, same format as VerticalExtent")
+(translator-property-description 'recordEventSequence procedure?
+ "Upon termination of this context,
+this function is called with current context and a list of music
+objects. The list of contains entries with start times, music objects
+and whether they're processed in this context.")
+
(translator-property-description 'noDirection boolean? "Don't set directions by a2-engraver when part-combining.")
(translator-property-description
'originalCentralCPosition integer?
(ice-9 regex)
)
+(define (dashify-underscores str)
+ (regexp-substitute/global #f "_" str 'pre "-" 'post))
+
(define (format-c-header c-h)
(regexp-substitute/global
#f ","
- (regexp-substitute/global #f "(SCM|\\)|\\() *" c-h 'pre "" 'post)
- 'pre " " 'post)
- )
+ (regexp-substitute/global #f "(SCM|\\)|\\() *" (dashify-underscores c-h)
+ 'pre "" 'post)
+ 'pre " " 'post))
(define (document-scheme-function name c-header doc-string)
(string-append
(lambda (key val prior)
(cons (cons key val) prior)
)
- '() (ly:get-all-function-documentation))
- )
+ '() (ly:get-all-function-documentation)))
(define (all-scheme-functions-doc)
(let*
;;; (c) 2000--2003 Jan Nieuwenhuizen <janneke@gnu.org>
;;;
-(define (font-field name font-descr)
- (list-ref
- font-descr
- (cond
- ((eq? name 'font-relative-size) 0)
- ((eq? name 'font-series) 1)
- ((eq? name 'font-shape) 2)
- ((eq? name 'font-family) 3)
- ((eq? name 'font-design-size) 4)
- (else (ly:warning "unknown font field name"))
- )
- ))
-
+;; Should separate default sizes
+;; into separate list/alist ?
+
+
+"
+Each entry in this vector has the following format
+
+
+ (cons
+ #(QUALIFIERS)
+ (cons DEFAULT-SIZE
+ #(SIZE-FONT-ENTRIES... ) ))
+
+where each SIZE-FONT-ENTRY is
+
+ (cons DESIGN-SIZE FONT-NAME)
+
+or
+
+ (cons DESIGN-SIZE (list FONT-NAME1 FONT-NAME2 .. ))
+
+"
+
+
+(define-public paper20-font-vector
+ '((#(medium upright number) .
+ (10 . #((10.0 . "feta-nummer10"))))
+ (#(medium upright roman) .
+ (10.0 . #((6.0 . "cmr6")
+ (8.0 . "cmr8")
+ (10.0 . "cmr10")
+ (17.0 . "cmr17")
+ )))
+ (#(* * music).
+ (20.0 . #((11.22 . ("feta11" "parmesan11"))
+ (12.60 . ("feta13" "parmesan13"))
+ (14.14 . ("feta14" "parmesan14"))
+ (15.87 . ("feta16" "parmesan16"))
+ (17.82 . ("feta18" "parmesan18"))
+ (20.0 . ("feta20" "parmesan20"))
+ (22.45 . ("feta23" "parmesan23"))
+ (25.20 . ("feta26" "parmesan26"))
+ )))
+ (#(medium upright sans) .
+ (10.0 . #((8.0 . "cmss8")
+ (10.0 . "cmss10")
+ (12.0 . "cmss12")
+ (17.0 . "cmss17")
+ )))
+ (#(medium upright typewriter) .
+ (10.0 . #((8.0 . "cmtt8")
+ (10.0 . "cmtt10")
+ (12.0 . "cmtt12")
+ )))
+ (#(bold italic roman) .
+ (10.0 . #((8.0 . "cmbxti7")
+ (10.0 . "cmbxti10")
+ (14.0 . "cmbxti14")
+ )))
+ (#(medium italic roman) .
+ (10.0 . #((7.0 . "cmti7")
+ (10.0 . "cmti10")
+ (12.0 . "cmti12")
+ )))
+ (#(bold upright roman) .
+ (10.0 . #((6.0 . "cmbx6")
+ (8.0 . "cmbx8")
+ (10.0 . "cmbx10")
+ (12.0 . "cmbx12")
+ )))
+ (#(medium caps roman) .
+ (10.0 . #((10.0 . "cmcsc10"))))
+
+ ;; this is a little pointless, since feta-din scales linearly
+ (#(* * dynamic) .
+ (14.0 . #((8.0 . "feta-din10")
+ (10.0 . "feta-din10")
+ (14.0 . "feta-din14")
+ (17.0 . "feta-din17")
+ )))
+ (#(* * math) .
+ (10.0 . #((10.0 . "msam10"))))
+ ))
+
+(define (scale-font-entry entry factor)
+ (cons
+ (car entry)
+ (cons (* (cadr entry) factor)
+ (cddr entry))))
(define size-independent-fonts
- `(
- ((* * * braces *) . ("feta-braces00"
- "feta-braces10"
- "feta-braces20"
- "feta-braces30"
- "feta-braces40"
- "feta-braces50"
- "feta-braces60"
- "feta-braces70"
- "feta-braces80") )))
-
-;; FIXME: what about this comment?:
-
-;; font-lookup seems a little inefficient -- walking this entire list
-;; for a single font.
-;;
-;; should really have name/pt size at the front of the list.
-;; (also tried to vary the order of this list, with little effect)
-;;
-;; (font-relative-size font-series font-shape font-family
-;; font-design-size)
-
-(define paper20-style-sheet-alist
- '(
- ;; why are font file names strings, not symbols?
- ((3 medium upright number 13) . "feta-nummer13")
- ((2 medium upright number 13) . "feta-nummer13")
- ((1 medium upright number 11) . "feta-nummer11")
- ((0 medium upright number 10) . "feta-nummer10")
- ((-1 medium upright number 8) . "feta-nummer8")
- ((-2 medium upright number 7) . "feta-nummer7")
- ((-3 medium upright number 6) . "feta-nummer6")
- ((-4 medium upright number 5) . "feta-nummer5")
- ((-5 medium upright number 4) . "feta-nummer4")
-
- ((4 medium upright roman 17) . "cmr17")
- ((3 medium upright roman 17) . "cmr17")
- ((2 medium upright roman 12) . "cmr12")
- ((1 medium upright roman 12) . "cmr12")
- ((0 medium upright roman 10) . "cmr10")
- ((-1 medium upright roman 8) . "cmr8" )
- ((-2 medium upright roman 7) . "cmr7" )
- ((-3 medium upright roman 6) . "cmr6" )
- ((-4 medium upright roman 5) . "cmr5" )
- ((-5 medium upright roman 5) . "cmr5" )
-
- ((4 medium upright sans 17) . "cmss17")
- ((3 medium upright sans 17) . "cmss17")
- ((2 medium upright sans 14) . "cmss14")
- ((1 medium upright sans 12) . "cmss12")
- ((0 medium upright sans 10) . "cmss10")
- ((-1 medium upright sans 9) . "cmss9" )
- ((-2 medium upright sans 8) . "cmss8" )
- ((-3 medium upright sans 7) . "cmss7" )
- ((-4 medium upright sans 6) . "cmss6" )
- ((-5 medium upright sans 5) . "cmss5" )
-
- ((3 medium italic roman 12) . "cmti12")
- ((2 medium italic roman 12) . "cmti12")
- ((1 medium italic roman 12) . "cmti12") ;;; ugh. Should add magnification here!
- ((0 medium italic roman 10) . "cmti10")
- ((-1 medium italic roman 8) . "cmti8")
- ((-2 medium italic roman 7) . "cmti7")
- ((-3 medium italic roman 6) . "cmti6")
- ((-4 medium italic roman 5) . "cmti5")
- ((-5 medium italic roman 5) . "cmti5")
-
- ;;; cmbx17 is sauter, not commonly available as Type1.
- ((4 bold upright roman 17) . "cmbx17")
- ((3 bold upright roman 17) . "cmbx17")
-
- ((2 bold upright roman 14) . "cmbx14")
- ((1 bold upright roman 12) . "cmbx12")
- ((0 bold upright roman 10) . "cmbx10")
- ((-1 bold upright roman 8) . "cmbx8")
- ((-2 bold upright roman 7) . "cmbx7")
- ((-3 bold upright roman 6) . "cmbx6")
- ((-4 bold upright roman 5) . "cmbx5")
- ((-5 bold upright roman 5) . "cmbx5")
-
-
- ((2 bold italic roman 12) . "cmbxti12")
- ((1 bold italic roman 12) . "cmbxti12")
- ((0 bold italic roman 10) . "cmbxti10")
-
- ((-1 bold italic roman 8) . "cmbxti8")
- ((-2 bold italic roman 7) . "cmbxti7")
- ((-3 bold italic roman 6) . "cmbxti6")
- ((-4 bold italic roman 5) . "cmbxti5")
- ((-5 bold italic roman 5) . "cmbxti5")
-
- ((4 medium upright typewriter 17) . "cmtt17")
- ((3 medium upright typewriter 17) . "cmtt17")
- ((2 medium upright typewriter 12) . "cmtt12")
- ((1 medium upright typewriter 12) . "cmtt12")
- ((0 medium upright typewriter 10) . "cmtt10")
- ((-1 medium upright typewriter 8) . "cmtt8" )
- ((-2 medium upright typewriter 7) . "cmtt7" )
- ((-3 medium upright typewriter 6) . "cmtt6" )
- ((-4 medium upright typewriter 5) . "cmtt5" )
- ((-5 medium upright typewriter 5) . "cmtt5" )
-
- ((3 medium caps roman 12) . "cmcsc12")
- ((2 medium caps roman 12) . "cmcsc12")
- ((1 medium caps roman 12) . "cmcsc12")
- ((0 medium caps roman 10) . "cmcsc10")
- ((-1 medium caps roman 8) . "cmcsc8")
- ((-2 medium caps roman 7) . "cmcsc7")
- ((-3 medium caps roman 7) . "cmcsc7")
-
- ((3 * * dynamic 19) . "feta-din19")
- ((2 * * dynamic 19) . "feta-din19")
- ((1 * * dynamic 17) . "feta-din17")
- ((0 * * dynamic 14) . "feta-din14")
- ((-1 * * dynamic 12) . "feta-din12")
- ((-2 * * dynamic 9) . "feta-din9")
- ((-3 * * dynamic 8) . "feta-din8")
- ((-4 * * dynamic 7) . "feta-din7")
- ((-5 * * dynamic 6) . "feta-din6")
-
- ((2 * * music 26) . ("feta26" "parmesan26"))
- ((1 * * music 23) . ("feta23" "parmesan23"))
- ((0 * * music 20) . ("feta20" "parmesan20"))
- ((-1 * * music 16) . ("feta16" "parmesan16"))
- ((-2 * * music 13) . ("feta13" "parmesan13"))
- ((-3 * * music 11) . ("feta11" "parmesan11"))
- ((-4 * * music 11) . ("feta11" "parmesan11"))
-
- ((2 * * ancient 26) . ("feta26" "parmesan26"))
- ((1 * * ancient 23) . ("feta23" "parmesan23"))
- ((0 * * ancient 20) . ("feta20" "parmesan20"))
- ((-1 * * ancient 16) . ("feta16" "parmesan16"))
- ((-2 * * ancient 13) . ("feta13" "parmesan13"))
- ((-3 * * ancient 11) . ("feta11" "parmesan11"))
- ((-4 * * ancient 11) . ("feta11" "parmesan11"))
-
- ((0 * * math 10) . "msam10")
- ((-1 * * math 10) . "msam10")
- ((-2 * * math 10) . "msam10")
- ((-3 * * math 10) . "msam10")
- ))
-
-;;
-(define (change-relative-size font-desc decrement)
- "return a FONT-DESCR with relative size decremented by DECREMENT"
-
- (if (number? (car font-desc))
- (cons (- (car font-desc) decrement) (cdr font-desc))
- font-desc)
- )
-
-(define (change-rhs-size font-desc from to )
- (cons (car font-desc)
- (regexp-substitute/global #f from (cdr font-desc) 'pre to 'post)))
-
-
-(define (change-style-sheet-relative-size sheet x)
- (map-alist-keys (lambda (descr) (change-relative-size descr x)) sheet))
-
-
-;; make style sheet for each paper version.
-(define font-list-alist
- (map-alist-vals (lambda (x) (change-style-sheet-relative-size
- paper20-style-sheet-alist x))
- '((paper11 . -3)
- (paper13 . -2)
- (paper16 . -1)
- (paper20 . 0)
- (paper23 . 1)
- (paper26 . 2)
- )))
-
-;;
-;; make a kludged up paper-19 style sheet. Broken by virtual fonts.
-;;
-(if #f
- (set! font-list-alist
- (cons
- (cons
- 'paper19
- (map (lambda (x) (change-rhs-size x "20" "19"))
- paper20-style-sheet-alist))
- font-list-alist)))
-
-(define-public (make-font-list sym)
+ '((#(* * braces) .
+ (10 . #((10.0 . ("feta-braces00"
+ "feta-braces10"
+ "feta-braces20"
+ "feta-braces30"
+ "feta-braces40"
+ "feta-braces50"
+ "feta-braces60"
+ "feta-braces70"
+ "feta-braces80")))))))
+
+(define-public (scale-font-list factor)
(append size-independent-fonts
- (cdr (assoc sym font-list-alist))))
-
-
-;;; ascii-script font init
-(define as-font-sheet-alist
- '((as5 . (((* * * braces *) . ("as-braces9"))
- ((* * * number *) . "as-number1")
- ((0 * * music *) . ("as5"))
- ((0 * * roman *) . "as-dummy")))
- (as9 . (((* * * braces *) . ("as-braces9"))
- ((0 medium upright number 10) . "as-number4")
- ((* * * number 5) . "as-number1")
- ((0 * * music *) . ("as9"))
- ((0 * * roman *) . "as-dummy")))))
-
-(define-public (as-make-font-list sym)
- (set! font-list-alist
- (append font-list-alist as-font-sheet-alist))
- (make-font-list sym))
-
-
-
+ (map (lambda (y) (scale-font-entry y factor)) paper20-font-vector)
+ ))
+
+;
(define-public DOUBLE-SHARP 4)
(define-public SEMI-TONE 2)
+(define-public ZERO-MOMENT (ly:make-moment 0 1))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; lily specific variables.
(define-public default-script-alist '())
handle
(chain-assoc x (cdr alist-list))))))
+(define (chain-assoc-get x alist-list default)
+ (if (null? alist-list)
+ default
+ (let* ((handle (assoc x (car alist-list))))
+ (if (pair? handle)
+ (cdr handle)
+ (chain-assoc-get x (cdr alist-list) default)))))
+
(define (map-alist-vals func list)
"map FUNC over the vals of LIST, leaving the keys."
m)
(define-public toplevel-music-functions
- (list check-start-chords
+ (list
+;; check-start-chords ; ; no longer needed with chord syntax.
voicify-music
(lambda (x) (music-map glue-mm-rest-texts x))
; switch-on-debugging
))
+
+
+;;;;;;;;;;;;;;;;;
+;; lyrics
+
+(define (apply-durations lyric-music durations)
+ (define (apply-duration music)
+ (if (and (not (equal? (ly:music-length music) ZERO-MOMENT))
+ (ly:duration? (ly:get-mus-property music 'duration)))
+ (begin
+ (ly:set-mus-property! music 'duration (car durations))
+ (set! durations (cdr durations))
+ )))
+
+ (music-map apply-duration lyric-music))
+
+
(define-public (finger-markup paper props . rest)
(interpret-markup paper
- (cons (list '(font-relative-size . -3)
+ (cons (list '(font-size . -4)
'(font-family . number))
props)
(car rest)))
-(define-public fontsize-markup (set-property-markup 'font-relative-size))
+(define-public fontsize-markup (set-property-markup 'font-size))
(define-public magnify-markup (set-property-markup 'font-magnification))
(define-public bold-markup
"Syntax: \\super MARKUP. "
(ly:molecule-translate-axis (interpret-markup
paper
- (cons '((font-relative-size . -2)) props) (car rest))
+ (cons '((font-size . -3)) props) (car rest))
(* 0.5 (cdr (chain-assoc 'baseline-skip props)))
Y)
)
"Syntax: \\sub MARKUP."
(ly:molecule-translate-axis (interpret-markup
paper
- (cons '((font-relative-size . -2)) props)
+ (cons '((font-size . -3)) props)
(car rest))
(* -0.5 (cdr (chain-assoc 'baseline-skip props)))
Y)
"Horizontal brackets around its single argument. Syntax \\hbracket MARKUP."
(let*
- (
- (th 0.1) ;; todo: take from GROB.
- (m (interpret-markup paper props (car rest)))
- )
+ ((th 0.1) ;; todo: take from GROB.
+ (m (interpret-markup paper props (car rest))) )
(bracketify-molecule m X th (* 2.5 th) th)
))
(define-public (bracket-markup paper props . rest)
"Vertical brackets around its single argument. Syntax \\bracket MARKUP."
(let*
- (
- (th 0.1) ;; todo: take from GROB.
- (m (interpret-markup paper props (car rest)))
- )
+ ((th 0.1) ;; todo: take from GROB.
+ (m (interpret-markup paper props (car rest))) )
(bracketify-molecule m Y th (* 2.5 th) th)
))
(define-public (smaller-markup paper props . rest)
"Syntax: \\smaller MARKUP"
(let*
- (
- (fs (cdr (chain-assoc 'font-relative-size props)))
- (entry (cons 'font-relative-size (- fs 1)))
+ ((fs (chain-assoc-get 'font-size props 0))
+ (entry (cons 'font-size (- fs 1)))
)
(interpret-markup
paper (cons (list entry) props)
(define-public (bigger-markup paper props . rest)
"Syntax: \\bigger MARKUP"
(let*
- (
- (fs (cdr (chain-assoc 'font-relative-size props)))
- (entry (cons 'font-relative-size (+ fs 1)))
+ ((fs (chain-assoc-get 'font-size props 0))
+ (entry (cons 'font-size (+ fs 1)))
)
(interpret-markup
paper (cons (list entry) props)
(define-public (box-markup paper props . rest)
"Syntax: \\box MARKUP"
(let*
- (
- (th 0.1)
+ ((th 0.1)
(pad 0.2)
(m (interpret-markup paper props (car rest)))
)
; The TabNoteHead stem attachment function.
(define (tablature-stem-attachment-function style duration)
- (cons 0.0 0.5) ;; UGH!
-)
+ (cons 0.0 0.5))
; The TabNoteHead molecule callback.
; Create a text molecule
(list-ref tuning
(- string 1) ; remove 1 because list index starts at 0 and guitar string at 1.
)
- )
- )
- )
+ ) ) )
(define-public (hammer-molecule-callback grob)
(let* ((note-collums (ly:get-grob-property grob 'note-columns))
)
(ly:molecule-combine-at-edge slur 1 1 text -0.6)
- )
- )
- )
+ ) ) )
(if (equal? result #f)
(ly:warn (string-append "Unknown bar glyph: `" glyph "'"))
(index-cell (cdr result) dir))
- )
- )
+ ) )
(string-append
"%!PS-Adobe-3.0\n"
"%%Creator: " creator generate "\n"))
-
(define (header-end)
(string-append
;; URG: now we can't use scm output without Lily
"{ exch pop //systemdict /run get exec } "
;; ps-testing wreaks havoc when used with lilypond-book.
;; -- is this still true with new modules system?
- ;; (if (defined? 'ps-testing) "\n /testing true def" "")
- ;; "\n /testing true def"
+;; (if (defined? 'ps-testing) "\n /testing true def" "")
+ ; "\n /testing true def"
))
(define (lily-def key val)
-(use-modules (ice-9 regex)
- (srfi srfi-1))
-
-;; should make module?
+(use-modules (ice-9 regex)
+ (srfi srfi-1)
+ (oop goops))
"
-
-
Todo: this is a quick hack; it makes more sense to define a GOOPS
class of a documentnode (similar to how
; the documentation is generated.)
<paperoutput>
</paperoutput>
</score>
-
-
-
"
+(define-class <xml-node> ()
+ (name #:init-value "" #:accessor node-name #:init-keyword #:name)
+ (value #:init-value "" #:accessor node-value #:init-keyword #:value)
+ (attributes #:init-value '()
+ #:accessor node-attributes
+ #:init-keyword #:attributes)
+ (children #:init-value '()
+ #:accessor node-children
+ #:init-keyword #:children))
+
+(define node-names
+ '((NoteEvent . note)
+ (SequentialMusic . measure)
+
+ ;;ugh
+ (pitch . pitch)
+ (duration . duration)
+ (octave . octave)
+ (step . step)
+ ))
+
+(define (assoc-get-default key alist default)
+ "Return value if KEY in ALIST, else DEFAULT."
+ (let ((entry (assoc key alist)))
+ (if entry (cdr entry) default)))
+
+(define (musicxml-node->string node)
+ (let ((xml-name (assoc-get-default (node-name node) node-names #f)))
+ (string-append
+ (if xml-name (open-tag xml-name '() '()) "")
+ (if (equal? (node-value node) "")
+ (string-append
+ (if xml-name "\n" "")
+ (apply string-append (map musicxml-node->string (node-children node))))
+ (node-value node))
+ (if xml-name (close-tag xml-name) "")
+ (if xml-name "\n" ""))))
+
+(define (xml-node->string node)
+ (string-append
+ "\n"
+ (open-tag (node-name node) (node-attributes node) '())
+ (if (equal? (node-value node) "")
+ (string-append
+ (apply string-append (map xml-node->string (node-children node))))
+ (node-value node))
+ "\n"
+ (close-tag (node-name node))))
+
+(define (musicxml-duration->xml-node d)
+ (make <xml-node>
+ #:name 'duration
+ #:value (number->string (ash 1 (ly:duration-log d)))))
+
+(define (duration->xml-node d)
+ (make <xml-node>
+ #:name 'duration
+ ;; #:value (number->string (ash 1 (ly:duration-log d)))))
+ #:attributes `((log . ,(ly:duration-log d))
+ (dots . ,(ly:duration-dot-count d))
+ (numer . ,(car (ly:duration-factor d)))
+ (denom . ,(cdr (ly:duration-factor d))))))
+
+(define (musicxml-pitch->xml-node p)
+ (make <xml-node>
+ #:name 'pitch
+ #:children
+ (list
+ (make <xml-node>
+ #:name 'step
+ #:value (list-ref '("C" "D" "E" "F" "G" "A" "B")
+ (ly:pitch-notename p)))
+ (make <xml-node>
+ #:name 'octave
+ #:value (number->string (ly:pitch-octave p))))))
+
+(define (pitch->xml-node p)
+ (make <xml-node>
+ #:name 'pitch
+ #:attributes `((octave . ,(ly:pitch-octave p))
+ (notename . ,(ly:pitch-notename p))
+ (alteration . ,(ly:pitch-alteration p)))))
+
+(define (music->xml-node music)
+ (let* ((name (ly:get-mus-property music 'name))
+ (e (ly:get-mus-property music 'element))
+ (es (ly:get-mus-property music 'elements))
+ (mprops (ly:get-mutable-properties music))
+ (d (ly:get-mus-property music 'duration))
+ (p (ly:get-mus-property music 'pitch))
+ (ignore-props '(origin elements duration pitch element)))
+
+ (make <xml-node>
+ #:name name
+ #:children
+ (apply
+ append
+ (if (ly:pitch? p) (list (pitch->xml-node p)) '())
+ (if (ly:duration? d) (list (duration->xml-node d)) '())
+ (if (pair? es) (map music->xml-node es) '())
+ (if (ly:music? e) (list (music->xml-node e)) '())
+ '()))))
(define (dtd-header)
(string-append
<!ATTLIST pitch octave ( -1 | -2 | 0 | 1 ) #REQUIRED >")
-
-
-(define (dump-duration d port)
- (display (open-tag 'duration
- `((log . ,(ly:duration-log d))
- (dots . ,(ly:duration-dot-count d))
- (numer . ,(car (ly:duration-factor d)))
- (denom . ,(cdr (ly:duration-factor d)))
- )
- '() ) port)
- (display (close-tag 'duration) port))
-
-(define (dump-pitch p port)
- (display (open-tag 'pitch
- `((octave . ,(ly:pitch-octave p))
- (notename . ,(ly:pitch-notename p))
- (alteration . ,(ly:pitch-alteration p))
- )
- '() ) port)
- (display (close-tag 'pitch) port))
-
;; should use macro
(define (assert x)
(if x
(string-append
"<" (symbol->string tag)
- (apply string-append
- (map dump-attr (filter candidate? attrs)))
- ">\n")
-
- )
-(define (close-tag name)
- (string-append "</" (symbol->string name) ">\n")
- )
-
-(define (music-to-xml-helper music port)
- (let*
- (
- (name (ly:get-mus-property music 'name))
- (e (ly:get-mus-property music 'element))
- (es (ly:get-mus-property music 'elements))
- (mprops (ly:get-mutable-properties music))
- (p (ly:get-mus-property music 'pitch))
- (d (ly:get-mus-property music 'duration))
- (ignore-props '(origin elements duration pitch element))
- )
+ (apply string-append (map dump-attr (filter candidate? attrs)))
+ ">"))
- ;; As almost everything is music; <SequentialMusic> is
- ;; probably better than <music type="SequentialMusic">?
-
- (display (open-tag 'music (cons `(type . ,name) mprops) ignore-props)
- port)
- (if (ly:duration? d)
- (dump-duration d port))
- (if (ly:pitch? p)
- (dump-pitch p port))
- (if (pair? es)
- (map (lambda (x) (music-to-xml-helper x port)) es)
- )
-
- (if (ly:music? e)
- (begin
- (music-to-xml-helper e port)))
- (display (close-tag 'music) port)
- ))
+(define (close-tag name)
+ (string-append "</" (symbol->string name) ">"))
(define-public (music-to-xml music port)
"Dump XML-ish stuff to PORT."
;; (display (dtd-header) port)
(display (open-tag 'music '((type . score)) '()) port)
- (music-to-xml-helper music port)
+ (display (xml-node->string (music->xml-node music)) port)
(display (close-tag 'music) port))
+
+(define-public (music-to-musicxml music port)
+ "Dump MusicXML-ish stuff to PORT."
+
+ ;; dtd contains # -- This confuses tex during make web.
+ ;;
+ ;; (display (dtd-header) port)
+
+ (define pitch->xml-node musicxml-pitch->xml-node)
+ (define duration->xml-node musicxml-duration->xml-node)
+
+ (display (open-tag 'music '((type . score)) '()) port)
+ (display (musicxml-node->string (music->xml-node music)) port)
+ (display (close-tag 'music) port))
+
def conv (str):
- if re.search ("up-to-staff", str) :
- sys.stderr.write ("up-to-staff was removed. Use stem-end-position instead. ")
- raise FatalConversionError ()
-
+ def func(match):
+ return "#'font-size = #%d" % (2*string.atoi (match.group (1)))
+
+ str =re.sub (r"#'font-relative-size\s*=\s*#([0-9-]+)", func, str)
+ return str
+
+conversions.append (((2,1,1), conv, """font-relative-size -> font-size"""))
+
+def conv (str):
+ str =re.sub (r"ly:get-music-length", "ly:music-length", str)
return str
-conversions.append (((2,0,1), conv, """dash-length -> dash-fraction"""))
+conversions.append (((2,1,2), conv, """ly:get-music-length -> ly:music-length"""))
################################
# END OF CONVERSIONS
include $(depth)/make/stepmake.make
$(outdir)/music-drawing-routines.ps: $(depth)/ps/music-drawing-routines.ps
- -cp $< $@
+ rm -f $@
+ -ln $< $@
all: $(INSTALLATION_FILES)