iso. booleans.
* python/lilylib.py (make_ps_images): add margin to PS images.
* scripts/lilypond-book.py (is_derived_class): new function. Take
class arg iso. object.
(to_eps): make a non EPS file if EPS contains %%Pages. Workaround
for bug in GS/dvips.
* scm/define-markup-commands.scm: remove split around-space hack.
2004-03-22 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * scripts/lilypond-book.py (is_derived_class): use numbers
+ iso. booleans.
+
+ * python/lilylib.py (make_ps_images): add margin to PS images.
+
* scripts/lilypond-book.py (is_derived_class): new function. Take
class arg iso. object.
+ (to_eps): make a non EPS file if EPS contains %%Pages. Workaround
+ for bug in GS/dvips.
* lily/text-item.cc (interpret_markup): idem.
@node Defining context defaults
@subsection Defining context defaults
+The adjustments of the previous chapters can also be entered separate
+from the music, in the @code{\paper} block,
+
+@example
+ \paper {
+ @dots{}
+ \context @{
+ \StaffContext
+
+ \set fontSize = #-2
+ \override Stem #'thickness
+ \remove "Time_signature_engraver"
+ @}
+ @}
+@end example
+
+This
+@example
+ \StaffContext
+@end example
+
+@noindent
+takes the existing definition @context{Staff}, and adds
+changes some settings,
+
+@example
+ \set fontSize = #-2
+ \override Stem #'thickness
+ \remove "Time_signature_engraver"
+@end example
+
+
+
Context properties can be set as defaults, within the
@code{\paper} block. For example,
file.write (r"""
%% LilyPond file to list all font symbols and the corresponding names
%% Automatically generated by mf-to-table.py
-\score{\notes{\fatText\time %d/4
-""" % per_line)
+\score{ \lyrics \new Lyrics { \time %d/8
+""" % (2*per_line+1))
count = 0
for m in charmetrics:
## prevent TeX from interpreting "--" as long dash:
tex_string=re.sub('--','-{}-', tex_string)
- file.write (' s^\\markup { \\musicglyph #"%s" "%s" }\n' % (scm_string, tex_string))
+ file.write (' \\markup { \\raise #0.75 \\vcenter \\musicglyph #"%s" " %s" } 4 \n' % (scm_string, tex_string))
if (count % 3) ==0:
- file.write (' \\break\n')
+ file.write ('\skip 8 \\break\n')
file.write (r"""
}
\paper{
- interscoreline=1
+ interscoreline = 1.0
+ indent = 0.0 \cm
\context {
- \ScoreContext
- \remove "Bar_number_engraver"
- \override TextScript #'extra-X-extent = #'(-1 . 1)
- }
- \context {
- \StaffContext
- \remove "Clef_engraver"
- \remove "Key_engraver"
- \remove "Time_signature_engraver"
- \remove "Staff_symbol_engraver"
+ \LyricsContext
+ \override SeparationItem #'padding = #2
minimumVerticalExtent = ##f
}
- }
-}
+ \context {
+ \ScoreContext
+ \remove "Bar_number_engraver"
+ }
+ }
+ }
""")
def write_deps (file, deps, targets):
ADD_INTERFACE (Axis_group_interface, "axis-group-interface",
"An object that groups other layout objects.",
- "axes");
+ "axes elements");
class Key_engraver : public Engraver
{
void create_key (bool);
- void read_ev (Key_change_ev const * r);
- Key_change_ev * key_ev_;
+ void read_ev (Music const * r);
+ Music * key_ev_;
Item * item_;
public:
item_->set_property ("c0-position",
get_property ("middleCPosition"));
- // todo: put this in basic props.
- item_->set_property ("old-accidentals", get_property ("lastKeySignature"));
+ if (to_boolean (get_property ("printKeyCancellation")))
+ item_->set_property ("old-accidentals", get_property ("lastKeySignature"));
item_->set_property ("new-accidentals", get_property ("keySignature"));
announce_grob (item_, key_ev_ ? key_ev_->self_scm () : SCM_EOL);
bool
Key_engraver::try_music (Music * ev)
{
- // if (Key_change_ev *kc = dynamic_cast <Key_change_ev *> (ev))
if (ev->is_mus_type ("key-change-event"))
{
if (!key_ev_)
/*
do this only once, just to be on the safe side.
*/
- key_ev_ = dynamic_cast<Key_change_ev*> (ev); // UGH.
+ key_ev_ = ev;
read_ev (key_ev_);
}
void
-Key_engraver::read_ev (Key_change_ev const * r)
+Key_engraver::read_ev (Music const * r)
{
SCM p = r->get_property ("pitch-alist");
if (!gh_pair_p (p))
/* creats*/ "KeySignature",
/* accepts */ "key-change-event",
/* acks */ "bar-line-interface clef-interface",
-/* reads */ "keySignature lastKeySignature explicitKeySignatureVisibility createKeyOnClefChange keyAccidentalOrder keySignature",
+/* reads */ "keySignature printKeyCancellation lastKeySignature explicitKeySignatureVisibility createKeyOnClefChange keyAccidentalOrder keySignature",
/* write */ "lastKeySignature tonic keySignature");
% with empty ones.
\consists "Font_size_engraver"
-
+
\consists "Volta_engraver"
\consists "Separating_line_group_engraver"
\consists "Dot_column_engraver"
extraVerticalExtent = ##f
verticalExtent = ##f
localKeySignature = #'()
-
+
% explicitly set instrument, so we don't get
% weird effects when doing instrument names for
% piano staves
autoAccidentals = #'(Staff (same-octave . 0))
autoCautionaries = #'()
+ printKeyCancellation = ##t
keyAccidentalOrder = #`(
(6 . ,FLAT) (2 . ,FLAT) (5 . ,FLAT ) (1 . ,FLAT) (4 . ,FLAT) (0 . ,FLAT) (3 . ,FLAT)
(3 . ,SHARP) (0 . ,SHARP) (4 . ,SHARP) (1 . ,SHARP) (5 . ,SHARP) (2 . ,SHARP) (6 . ,SHARP)
output_file = re.sub (r'\.e?ps', '.png', ps_name)
- margin = 0
+
+ # need to have margin, otherwise edges of letters will
+ # be cropped off.
+
+ margin = 3
fo = open (trans_ps, 'w')
fo.write ('%d %d translate\n' % (-bbox[0] + margin,
-bbox[1] + margin))
selects the highest string with a fret at least @var{minimumFret}")
(minimumVerticalExtent ,number-pair? "minimum vertical extent, same
format as @var{verticalExtent}")
- (recordEventSequence ,procedure? "When
-@internalsref{Recording_group_engraver} is in this context, then upon
-termination of the 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 are processed in this
-context.")
(ottavation ,string? "If set, the text for an ottava spanner. Changing
this creates a new text spanner. ")
(pedalSustainStrings ,list? "List of string to print for
sustain pedals: @code{text}, @code{bracket} or @code{mixed} (both).")
(pedalUnaCordaStyle ,symbol? "see @code{pedalSustainStyle}.")
(pedalSostenutoStyle ,symbol? "see @code{pedalSustainStyle}.")
+ (printKeyCancellation ,boolean? "Print restoration alterations before a key signature change. ")
(printOctaveNames ,boolean? "Print octave marks for the NoteNames context.")
+ (recordEventSequence ,procedure? "When
+@internalsref{Recording_group_engraver} is in this context, then upon
+termination of the 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 are processed in this
+context.")
+
+
(rehearsalMark ,integer? "The last rehearsal mark printed.")
(repeatCommands ,list? "This property is read to find any command of the form @code{(volta . @var{x})}, where @var{x} is a string or @code{#f}")
-
(restNumberThreshold ,number?
"If a multimeasure rest takes less
than this number of measures, no number is printed. ")
(cmols (map (lambda (x) (ly:stencil-align-to! x X CENTER)) mols)))
(stack-lines -1 0.0 (chain-assoc-get 'baseline-skip props) mols)))
+(def-markup-command (vcenter paper props arg) (markup?)
+ "Align @code{arg} to its center. "
+ (let* ((mol (interpret-markup paper props arg)))
+ (ly:stencil-align-to! mol Y CENTER)
+ mol))
+
(def-markup-command (right-align paper props arg) (markup?)
(let* ((m (interpret-markup paper props arg)))
(ly:stencil-align-to! m X RIGHT)
ly.system ('dvips -Ppdf -u+lilypond.map -E -o %s.eps %s' \
% (file, file))
+
+ # check if it really is EPS.
+ # Otherwise music glyphs disappear from 2nd and following pages.
+
+ # TODO: should run dvips -pp -E per page, then we get proper
+ # cropping as well.
+
+ f = open ('%s.eps' % file)
+ for x in range(0,10) :
+ if re.search ("^%%Pages: ", f.readline ()):
+
+ # make non EPS.
+ ly.system ('dvips -Ppdf -u+lilypond.map -o %s.eps %s' \
+ % (file, file))
+ break
+
+
def find_file (name):
for i in include_path:
full = os.path.join (i, name)
def is_derived_class (cl, baseclass):
if cl == baseclass:
- return True
+ return 0
for b in cl.__bases__:
if is_derived_class (b, baseclass):
- return True
- return False
+ return 1
+ return 0
def process_snippets (cmd, snippets):