]> git.donarmstrong.com Git - lilypond.git/commitdiff
Merge branch 'master' of ssh+git://hanwen@git.sv.gnu.org/srv/git/lilypond
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 8 Jun 2007 01:39:59 +0000 (22:39 -0300)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 8 Jun 2007 01:39:59 +0000 (22:39 -0300)
24 files changed:
.gitignore
GNUmakefile.in
VERSION
buildscripts/mf-to-table.py
buildscripts/output-distance.py
flower/file-name.cc
flower/include/file-name.hh
flower/include/std-vector.hh
flower/std-string.cc
flower/test-file-name.cc
input/regression/dot-column-rest-collision.ly [new file with mode: 0644]
input/regression/laissez-vibrer-tie-beam.ly [new file with mode: 0644]
lily/include/note-column.hh
lily/include/tie-formatting-problem.hh
lily/lily-guile.cc
lily/program-option-scheme.cc
lily/relocate.cc
lily/rest-collision.cc
lily/tie-formatting-problem.cc
mf/GNUmakefile
scm/define-markup-commands.scm
scm/framework-ps.scm
scm/lily.scm
scm/ps-to-png.scm

index 0c7c899e609494a67f7d2c0813be58c6f0b0780a..20420023d0abe0573950e78d120bba713b0d8c0c 100644 (file)
@@ -55,6 +55,7 @@ gcstat*.scm
 lily-[0-9a-f][0-9a-f][0-9a-f]*
 out-scons
 out-cov
+out-test
 tags
 test-output-distance
 config-*.hh
index f70b2d44dc4bf253669d43c289fc2b2224826412..f821cc57d73a4fc8b5264ceacb03a4a16f3eb8c9 100644 (file)
@@ -161,8 +161,7 @@ $(tree-share-prefix)/lilypond-force link-tree: GNUmakefile $(outdir)/VERSION
        cd $(tree-share-prefix)/tex && \
                ln -s $(top-src-dir)/tex source && \
                ln -s ../../../../../tex/$(outconfbase) tex-out && \
-               ln -s ../../../../../mf/$(outconfbase) mf-out
-
+               true
        cd $(tree-share-prefix)/fonts && \
                ln -s $(top-src-dir)/mf source && \
                true
@@ -229,7 +228,7 @@ test:
        fi > input/regression/out-test/tree.gittxt
        $(MAKE) -C input/regression/ out=$(OUT_TEST) LILYPOND_BOOK_LILYPOND_FLAGS="-dbackend=eps --formats=ps $(LILYPOND_JOBS) -dseparate-log-files -dinclude-eps-fonts -dgs-load-fonts --header=texidoc -I $(top-src-dir)/input/manual -ddump-profile -dcheck-internal-types -ddump-signatures -danti-alias-factor=1" LILYPOND_BOOK_VERBOSE= out-$(OUT_TEST)/collated-files.html
        @find input ly -name '*.ly' -print |grep -v 'out.*/' | xargs grep '\\version' -L | grep -v "standard input" |sed 's/^/**** Missing version: /g' 
-
+       rsync -L -a --exclude 'out-*' --exclude 'out' --exclude mf --exclude source --exclude mf $(outdir)/share input/regression/out-test/
 
 test-baseline: 
        @if  test -d .git ; then \
diff --git a/VERSION b/VERSION
index 83517146261a6fba070e42d5054fa4ad0c1f97d7..552b2a6eeda5237447a81051d8eb2b2ce207144f 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,6 +1,6 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=2
 MINOR_VERSION=11
-PATCH_LEVEL=25
+PATCH_LEVEL=26
 MY_PATCH_LEVEL=
 
index c9cc27acdec6920f5ed6fa2c1530dcfc73898ad6..24b0971d7a94987f46959379883dbe6dbdb17c3b 100644 (file)
@@ -1,6 +1,6 @@
 #!@PYTHON@
 
-# mf-to-table.py -- convert spacing info in MF logs . and .tex
+# mf-to-table.py -- convert spacing info in MF logs . 
 #
 # source file of the GNU LilyPond music typesetter
 #
@@ -107,17 +107,6 @@ def parse_logfile (fn):
 
 
 
-def write_tex_defs (file, global_info, charmetrics):
-    nm = font_family
-    for m in charmetrics:
-        
-        texname = re.sub ('[_.]', 'X',  m['name'])
-        def digit_to_letter (match):
-            return chr (ord (match.group(1)) - ord ('0') + ord ('A'))
-        texname = re.sub ('([0-9])', digit_to_letter, texname)
-        file.write (r'''\gdef\%s%s{\char%d}%%%s''' % \
-              (nm, texname, m['code'],'\n'))
-    file.write ('\\endinput\n')
 
 
 def write_character_lisp_table (file, global_info, charmetrics):
@@ -192,7 +181,6 @@ Options:
  -l, --ly=FILE          name output table
  -o, --outdir=DIR       prefix for dependency info
  -p, --package=DIR      specify package
- -t, --tex=FILE         name output tex chardefs
 
  """)
     sys.exit (0)
@@ -203,12 +191,11 @@ Options:
         'a:d:ho:p:t:',
         ['enc=',  'outdir=', 'dep=', 'lisp=',
          'global-lisp=',
-         'tex=', 'debug', 'help', 'package='])
+         'debug', 'help', 'package='])
 
 global_lisp_nm = ''
 char_lisp_nm = ''
 enc_nm = ''
-texfile_nm = ''
 depfile_nm = ''
 lyfile_nm = ''
 outdir_prefix = '.'
@@ -220,8 +207,6 @@ for opt in options:
         depfile_nm = a
     elif o == '--outdir' or o == '-o':
         outdir_prefix = a
-    elif o == '--tex' or o == '-t':
-        texfile_nm = a
     elif o == '--lisp': 
         char_lisp_nm = a
     elif o == '--global-lisp': 
@@ -236,12 +221,11 @@ for opt in options:
         print o
         raise getopt.error
 
-base = re.sub ('.tex$', '', texfile_nm)
+base = os.path.splitext (lyfile_nm)[0]
 
 for filenm in files:
     (g, m, deps) = parse_logfile (filenm)
 
-    write_tex_defs (open (texfile_nm, 'w'), g, m)
     enc_name = 'FetaEncoding'
     if re.search ('parmesan', filenm):
         enc_name = 'ParmesanEncoding'
@@ -257,4 +241,4 @@ for filenm in files:
         write_deps (open (depfile_nm, 'wb'), deps,
               [base + '.log', base + '.dvi', base + '.pfa',
                depfile_nm,
-               base + '.pfb', texfile_nm])
+               base + '.pfb'])
index c60e965baf91c6ea88f957382e1d9136e0164e6c..ea82a93de9c1c7d32d37ca79836725764aa6b16e 100644 (file)
@@ -609,12 +609,17 @@ class SignatureFileLink (FileLink):
             for f in glob.glob (pat):
                 infile = f
                 outfile = (dest_dir + '/' + f).replace ('.eps', '.png')
-
+                data_option = ''
+                if options.local_data_dir:
+                    data_option = ('-slilypond-datadir=%s/share/lilypond/current '
+                                   % os.path.split(infile)[0])
+                
                 mkdir (os.path.split (outfile)[0])
                 cmd = ('gs -sDEVICE=png16m -dGraphicsAlphaBits=4 -dTextAlphaBits=4 '
+                       ' %(data_option)s '
                        ' -r101 '
                        ' -sOutputFile=%(outfile)s -dNOSAFER -dEPSCrop -q -dNOPAUSE '
-                       ' %(infile)s  -c quit '  % locals ())
+                       ' %(infile)s  -c quit ') % locals ()
 
                 files_created[oldnew].append (outfile)
                 system (cmd)
@@ -1221,6 +1226,13 @@ def main ():
                   action="store_true",
                   help="Create PNGs from EPSes")
 
+
+    p.add_option ('--local-datadir',
+                  dest="local_data_dir",
+                  default=False,
+                  action="store_true",
+                  help='whether to use the share/lilypond/ directory in the test directory')
+
     p.add_option ('-o', '--output-dir',
                   dest="output_dir",
                   default=None,
index e5736e06b0834ed6c26e15e01f32d25d91682067..0f0bb61270beee42468ec305e31fb0b4106e06fa 100644 (file)
@@ -177,3 +177,26 @@ File_name::is_absolute () const
   return (dir_.length () && dir_[0] == DIRSEP) || root_.length ();
 }
 
+
+
+File_name
+File_name::canonicalized () const
+{
+  File_name c = *this;
+
+  replace_all (c.dir_, string ("//"), string ("/"));
+
+  vector<string> components =  string_split (c.dir_, '/');
+  vector<string> new_components;
+
+  for (vsize i = 0; i < components.size (); i++)
+    {
+      if (components[i] == "..")
+       new_components.pop_back ();
+      else
+       new_components.push_back (components[i]);
+    }
+
+  c.dir_ = string_join (new_components,  "/");
+  return c;  
+}
index e8ea1ea3c2d67667c535f5ad51b87d07ad9b72df..bd699e0b3151cdf12a207fb39cf6d8795d5a03be 100644 (file)
@@ -27,7 +27,7 @@ public:
 
   bool is_absolute () const;
   string to_string () const;
-
+  File_name canonicalized () const;
   string dir_part () const;
   string file_part () const;
 };
index 4c3dcc0e0e8f61ae506d8672cf81073b0799759b..5c2c09c9d0c908fc7880584774bb11cbda8c2823 100644 (file)
@@ -258,6 +258,7 @@ junk_pointers (vector<T> &v)
 #endif /* HAVE_BOOST_LAMBDA */
 
 vector<string> string_split (string str, char c);
+string string_join (vector<string> const &strs, string infix);
 
 #define iterof(i,s) typeof((s).begin()) i((s).begin())
 
index b78b0196616aa1adde6f46b9ab64df379b523ed5..1221609c6c0ce4bc2e76a140d4fcbb1ed35f3d11 100644 (file)
@@ -67,6 +67,9 @@ to_string (char const *format, ...)
   return str;
 }
 
+/*
+  TODO: this O(n^2) in #occurences of find, due to repeated copying.
+ */
 string &
 replace_all (string &str, string find, string replace)
 {
@@ -113,8 +116,7 @@ string_split (string str, char c)
     {
       string s = str.substr (0, i);
       a.push_back (s);
-      while (str[++i] == c)
-       ;
+      i ++;
       str = str.substr (i);
       i = str.find (c);
     }
@@ -122,3 +124,17 @@ string_split (string str, char c)
     a.push_back (str);
   return a;
 }
+
+string
+string_join (vector<string> const &strs, string infix)
+{
+  string result;
+  for (vsize i = 0; i < strs.size (); i ++)
+    {
+      if (i)
+       result += infix;
+      result += strs[i];
+    }
+
+  return result;
+}
index edae635e822e618d37a18f5fe92433109180091a..9bd06f121cf7201a1a7feea1874f5d0308ba2f5f 100644 (file)
@@ -34,3 +34,10 @@ TEST_STRING (File_name, Mingw_slashify_4, "\\tmp\\x.ly")
   string s = slashify (to_string ());
   EQUAL ("/tmp/x.ly", s);
 }
+
+TEST_STRING (File_name, Canonicalize, "foo//bar/..//bla//z.ly")
+{
+  string s = canonicalized ().to_string ();
+  EQUAL ("foo/bla/z.ly", s);
+}
+
diff --git a/input/regression/dot-column-rest-collision.ly b/input/regression/dot-column-rest-collision.ly
new file mode 100644 (file)
index 0000000..f706d4e
--- /dev/null
@@ -0,0 +1,10 @@
+\header {
+  texidoc = "Dot columns do not trigger beam slanting too early."
+}
+
+\version "2.11.26"
+\paper{ ragged-right=##t }
+<<
+  { e''8 e''8 g'' g''} \\
+  { e8 r4. }
+>>
diff --git a/input/regression/laissez-vibrer-tie-beam.ly b/input/regression/laissez-vibrer-tie-beam.ly
new file mode 100644 (file)
index 0000000..b9ad29a
--- /dev/null
@@ -0,0 +1,17 @@
+\header {
+
+  texidoc = "@code{\laissezVibrer} ties on beamed notes don't trigger
+premature beam slope calculation. "
+
+}
+
+\version "2.11.26"
+
+\paper{
+  ragged-right=##t
+}
+
+{
+  c'8 e' g' c''\laissezVibrer r2 |
+  c'8 e' g' c'' r2
+}
index 429b83af3ef29968ac0b6650c96eccf5a35e1e55..8646f120fed818d568d7aa54b061602b326c09cf 100644 (file)
@@ -26,7 +26,6 @@ public:
   static Grob *accidentals (Grob *me);
   static Grob *arpeggio (Grob *me);
   static Slice head_positions_interval (Grob *me);
-  static Direction static_dir (Grob *);
   static void translate_rests (Grob *me, int dy);
   static Grob *first_head (Grob *me);
   static Grob *get_rest (Grob *me);
index 50f1746b86ba374abb138d9e1a2372051fb16fff..cb7d8c6e1632b51c3bc61db0af335c5d38b4f558 100644 (file)
@@ -42,6 +42,7 @@ class Tie_formatting_problem
   set<int> dot_positions_;
   Interval dot_x_;
   vector<Tie_specification> specifications_;
+  bool use_horizontal_spacing_;
   
   Tie_configuration_map possibilities_;
 
index e5cdbc77f2732aef18d0e38794ccbf950e9aa710..9da6823f194e89e91ab15a13c4ab751ed3b4d03e 100644 (file)
@@ -663,6 +663,7 @@ parse_symbol_list (char const *symbols)
   string s = symbols;
   replace_all (s, '\n', ' ');
   replace_all (s, '\t', ' ');
+  replace_all (s, "  ", " ");
   return ly_string_array_to_scm (string_split (s, ' '));
 }
 
index b636948fa84c8490cb556ebf559a6204fc9dafd6..638aaf634d96fca8d61646e5cacad400bacb7764 100644 (file)
@@ -39,8 +39,6 @@ static SCM option_hash;
 
 void internal_set_option (SCM var, SCM val)
 {
-  scm_hashq_set_x (option_hash, var, val);
-
   if (0)
     ;
   else if (var == ly_symbol2scm ("profile-property-accesses"))
@@ -100,6 +98,16 @@ void internal_set_option (SCM var, SCM val)
       debug_page_breaking_scoring = to_boolean (val);
       val = scm_from_bool (to_boolean (val));
     }
+  else if (var == ly_symbol2scm ("datadir"))
+    {
+      /* ignore input value. */
+      val = ly_string2scm (lilypond_datadir);
+    }
+
+
+  scm_hashq_set_x (option_hash, var, val);
+
+
 }
 
 
index 2ff9fc44d37e7721780bf791d07d4398ac588f1e..42c54a65ff3863bf3d9635b9a21b3956f46698ed 100644 (file)
@@ -230,12 +230,8 @@ setup_paths (char const *argv0_ptr)
 
   if (char const *env = getenv ("LILYPOND_DATADIR"))
     {
-#ifdef __MINGW32__
       /* Normalize file name.  */
       lilypond_datadir = File_name (env).to_string ();
-#else
-      lilypond_datadir = env;
-#endif
     }
 
   /* When running from build dir, a full LILYPOND_DATADIR is set-up at
@@ -245,6 +241,9 @@ setup_paths (char const *argv0_ptr)
   if (!is_dir (lilypond_datadir.c_str ())
       && is_dir (build_datadir_current.c_str ()))
     lilypond_datadir = build_datadir_current;
+
+
+  lilypond_datadir = File_name (lilypond_datadir).canonicalized().to_string();
   
   global_path.append ("");
 
index 063b773a92ae2f3ccf58792ba566095bf884b0a2..dd92f083e36db01a468dcc5a2acf9d1299cd11ad 100644 (file)
@@ -227,8 +227,24 @@ Rest_collision::calc_positioning_done (SCM smob)
 
       Interval notedim;
       for (vsize i = 0; i < notes.size (); i++)
-       notedim.unite (notes[i]->extent (common, Y_AXIS));
-
+       {
+         if (Note_column::dir (notes[i]) == -dir)
+           {
+             /* try not to look at the stem, as looking at a beamed
+                note may trigger beam positioning prematurely.
+
+                This happens with dotted rests, which need Y
+                positioning to compute X-positioning.
+             */
+             Grob *head = Note_column::first_head (notes[i]);
+             if (head)
+               notedim.unite (head->extent (common, Y_AXIS));
+             else
+               programming_error ("Note_column without first_head()");
+           }
+         else
+           notedim.unite (notes[i]->extent (common, Y_AXIS));
+       }
 
       Real y = dir * max (0.0,
                          -dir * restdim[-dir] + dir * notedim[dir]  + minimum_dist);
index f7682c904c56db5af97bcd4c9c3f0c240e6a7b84..3105d784f1615a8e9ec459bfeb99289fa6bb3e1c 100644 (file)
@@ -61,6 +61,7 @@ Tie_formatting_problem::get_attachment (Real y, Drul_array<int> columns) const
 Tie_formatting_problem::Tie_formatting_problem ()
 {
   x_refpoint_ = 0;
+  use_horizontal_spacing_ = true;
 }
 
 Tie_formatting_problem::~Tie_formatting_problem ()
@@ -123,16 +124,23 @@ Tie_formatting_problem::set_column_chord_outline (vector<Item*> bounds,
     {
       if (Stem::is_normal_stem (stem))
        {
-         
          Interval x;
          x.add_point (stem->relative_coordinate (x_refpoint_, X_AXIS));
          x.widen (staff_space / 20); // ugh.
          Interval y;
-         Real stem_end_position =
-           Stem::is_cross_staff (stem)
-           ? get_grob_direction (stem) * infinity_f
-           : Stem::stem_end_position (stem) * staff_space * .5;
 
+         Real stem_end_position = 0.0;
+         if (Stem::is_cross_staff (stem))
+           stem_end_position =  get_grob_direction (stem) * infinity_f;
+         else
+           {
+             if (use_horizontal_spacing_ || !Stem::get_beam (stem))
+               stem_end_position = Stem::stem_end_position (stem) * staff_space * .5;
+             else
+               stem_end_position = Stem::note_head_positions (stem)[get_grob_direction (stem)]
+                 * staff_space * .5;
+           }
+         
          y.add_point (stem_end_position);
 
          Direction stemdir = get_grob_direction (stem);
@@ -347,7 +355,8 @@ Tie_formatting_problem::from_semi_ties (vector<Grob*> const &semi_ties, Directio
 {
   if (semi_ties.empty ())
     return;
-  
+
+  use_horizontal_spacing_ = false; 
   details_.from_grob (semi_ties[0]);
   vector<Item*> heads;
 
index 170bbb13eb14a081b751333dbe88ba28af75acdd..59e22f850f45558692efeb2845e23cd32be9ad4a 100644 (file)
@@ -131,8 +131,8 @@ tree-regen:
 
 ##
 ## todo: this also depends on .tfm, FIXME.
-$(outdir)/%.lisp $(outdir)/%.otf-gtable $(outdir)/%.enc  $(outdir)/%.tex $(outdir)/%.dep: $(outdir)/%.log
-       $(PYTHON) $(buildscript-dir)/mf-to-table.py --global-lisp=$(outdir)/$(<F:.log=.otf-gtable) --lisp=$(outdir)/$(<F:.log=.lisp) --outdir=$(outdir) --dep $(outdir)/$(<F:.log=.dep) --enc $(outdir)/$(<F:.log=.enc) --tex $(outdir)/$(<F:.log=.tex) $<
+$(outdir)/%.lisp $(outdir)/%.otf-gtable $(outdir)/%.enc $(outdir)/%.dep: $(outdir)/%.log
+       $(PYTHON) $(buildscript-dir)/mf-to-table.py --global-lisp=$(outdir)/$(<F:.log=.otf-gtable) --lisp=$(outdir)/$(<F:.log=.lisp) --outdir=$(outdir) --dep $(outdir)/$(<F:.log=.dep) --enc $(outdir)/$(<F:.log=.enc)  $<
 
 local-clean:
        rm -f mfplain.mem mfplain.log
index d1f5dd04f81b2642d0ce862dc9948f24a75e8ceb..4cffe4c248279435865597612bd2bc979c73a5d7 100644 (file)
   (let*
       ((th (chain-assoc-get 'thickness props  0.1))
        (x (car dest))
-       (y (cdr dest)))
+       (y (cdr dest))
+       (s (ly:make-stencil
+          `(draw-line
+            ,th
+            0 0
+            ,x ,y)
 
-    (ly:make-stencil
-     `(draw-line
-       ,th
-       0 0
-       ,x ,y)
+          (cons (min x 0) (max x 0))
+          (cons (min y 0) (max y 0)))))
 
-     (cons (min x 0) (min y 0))
-     (cons (max x 0) (max y 0)))))
+    s))
 
 (define-builtin-markup-command (draw-circle layout props radius thickness fill)
   (number? number? boolean?)
index a119024a1dd0cb38c7636aae11f2bb80e7640de8..0eb622fe48d56d184ab341e28ee429d3e40ff055 100644 (file)
 (define (write-preamble paper load-fonts? port)
 
   (define (load-font-via-GS font-name-filename)
-    (define (ps-load-file name)
-      (format
-       (if (string? name)
-          "(~a) (r) file .loadfont\n"
-          "% cannot find font file: ~a\n")
-       name))
+    (define (ps-load-file file-name)
+      (if (string? file-name)
+         (if (string-contains file-name (ly:get-option 'datadir))
+             (begin
+               (set! file-name (ly:string-substitute (ly:get-option 'datadir) "" file-name))
+               (format "lilypond-datadir (~a) concatstrings (r) file .loadfont" file-name))
+             (format "(~a) (r) file .loadfont\n" file-name))
+         (format "% cannot find font file: ~a\n" file-name)))
 
     (let* ((font (car font-name-filename))
           (name (cadr font-name-filename))
       pfas))
 
   (display "%%BeginProlog\n" port)
+
+  (format port
+           "/lilypond-datadir where {pop} {userdict /lilypond-datadir (~a) put } ifelse"
+           (ly:get-option 'datadir))
+  
   (if load-fonts?
       (for-each
        (lambda (f)
index 48d911751aff6fbda380a2a6f4c735cc5e960704..cee1e74e800423d72e25d75e1985556638e09c38 100644 (file)
@@ -31,6 +31,7 @@
     (backend ps "which backend to use by default; Options: eps, ps [default], scm, svg, tex, texstr)")
     (check-internal-types #f "check every property assignment for types")
     (clip-systems #f "Generate cut-out snippets of a score")
+    (datadir #f "LilyPond prefix for data files (Readonly).")
     (debug-gc #f "dump memory debugging statistics")
     (debug-gc-assert-parsed-dead #f "for memory debugging:
 ensure that all refs to parsed objects are dead.  This is an internal option, and is switched on automatically for -ddebug-gc.") 
index 71fbe9b9057c1dd22441565556db8575b32b20f2..a41a1ca6fa9f431d063bde48f4f45b30d4c3dfa7 100644 (file)
@@ -97,7 +97,7 @@
     (page-width  100)
     (page-height 100)
     (rename-page-1 #f)
-    (be-verbose #f)
+    (be-verbose (ly:get-option 'verbose))
     (pixmap-format 'png16m)
     (anti-alias-factor 1))
 
  ~a\
  -dGraphicsAlphaBits=4\
  -dTextAlphaBits=4\
- -q\
  -dNOPAUSE\
  -sDEVICE=~a\
  -sOutputFile=~S\