]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scripts/lilypond-book.py (is_derived_class): use numbers
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 22 Mar 2004 14:03:12 +0000 (14:03 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 22 Mar 2004 14:03:12 +0000 (14:03 +0000)
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.

ChangeLog
Documentation/user/changing-defaults.itely
buildscripts/mf-to-table.py
lily/axis-group-interface.cc
lily/key-engraver.cc
ly/engraver-init.ly
python/lilylib.py
scm/define-context-properties.scm
scm/define-markup-commands.scm
scripts/lilypond-book.py

index dae37a15dc26b20a8eb64f186e3084ce2ed152b1..d9ebd8cfaaaa949f19defc4f9a99733b67890b65 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,14 @@
 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.
 
index 7940601ef3dde9788a6a0abcc9dada9e3e3f589c..16f32d9afdc99819561ff9c0b1531f84fc3d84e1 100644 (file)
@@ -665,6 +665,39 @@ and/or crashes.
 @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, 
 
index 18180629720f18af76131f5ecfd653758b695d87..b78ed88b6b5da617f08d18b5ccfb7b278f066326 100644 (file)
@@ -160,8 +160,8 @@ def write_fontlist (file, global_info, charmetrics):
        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:
@@ -177,29 +177,26 @@ def write_fontlist (file, global_info, 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):
index eab8127652c51b89340dc17ec0e83088cb59ed4b..40ea7ca721184950bd5f298a98b2ef09cceed876 100644 (file)
@@ -122,4 +122,4 @@ Axis_group_interface::get_children (Grob*me)
 
 ADD_INTERFACE (Axis_group_interface, "axis-group-interface",
   "An object that groups other layout objects.",
-  "axes");
+  "axes elements");
index f0b63cab21911436ad7969afed06632f3e0b7218..a4e2dbe22022c396d25e36448dead2ccc5b61a68 100644 (file)
@@ -28,8 +28,8 @@
 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:
@@ -69,8 +69,8 @@ Key_engraver::create_key (bool def)
       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);
@@ -88,7 +88,6 @@ Key_engraver::create_key (bool def)
 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_)
@@ -96,7 +95,7 @@ Key_engraver::try_music (Music * 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_);
        }
       
@@ -146,7 +145,7 @@ Key_engraver::stop_translation_timestep ()
 
 
 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))
@@ -199,5 +198,5 @@ ENTER_DESCRIPTION (Key_engraver,
 /* 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");
index faee7c5eb08c38137cbd2a35d7901815f8bfaf91..05fe54c1869198d85157d718eb322ed814b068c4 100644 (file)
@@ -24,7 +24,7 @@
 % with empty ones.
        
        \consists "Font_size_engraver"
-
+       
        \consists "Volta_engraver"
        \consists "Separating_line_group_engraver"      
        \consists "Dot_column_engraver"
@@ -47,7 +47,7 @@
        extraVerticalExtent = ##f
        verticalExtent = ##f 
        localKeySignature = #'()
-
+       
        % explicitly set instrument, so we don't get 
        % weird effects when doing instrument names for
        % piano staves
@@ -485,6 +485,7 @@ AncientRemoveEmptyStaffContext = \context {
     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)
index ba339854bccbdd17244d1a22bc91a7bda353db77..7bac5a445f256ee8e3746aa68b542ff3abd00e93 100644 (file)
@@ -462,7 +462,11 @@ def make_ps_images (ps_name, resolution = 90):
                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))
index 3509616f82eca6d929d1713a5ecfae94e755712a..85d6b926bc48df836324ae9544c3b95812135567 100644 (file)
@@ -260,12 +260,6 @@ markup.  Called with 2 arguments, event and context.")
 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
@@ -278,10 +272,18 @@ pedal.")
 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. ")
index e504cef998ed9d14e6edc06d570781937086f966..95f4aaa26b6cc94008413940298fe556dea2b328 100644 (file)
@@ -240,6 +240,12 @@ of the @code{#'direction} layout property."
          (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)
index 216f7c4cb413b22be1559f4cb51069b15d083bf4..622396b8b0b0f317b44e7da7e2f4871b16a8a351 100644 (file)
@@ -391,6 +391,23 @@ def to_eps (file):
        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)
@@ -720,11 +737,11 @@ def run_filter (s):
 
 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):