]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/output-ps.scm (header): Papersize from paper.
authorJan Nieuwenhuizen <janneke@gnu.org>
Sun, 11 Apr 2004 10:34:45 +0000 (10:34 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sun, 11 Apr 2004 10:34:45 +0000 (10:34 +0000)
* scripts/lilypond.py (global_latex_preamble): Oldish behaviour
for classic output.

* tex/lilyponddefs.tex (interscoreline): Oldish behaviour if
lilypondclassic is defined.
(lilypondstart): Oldish behaviour if lilypondclassic is defined.

* input/regression/between-systems.ly: Remove.

* python/lilylib.py (get_bbox): Fix regular expression
for bounding box.

* tex/lilyponddefs.tex (lilypondpagebreak): New overridable macro.

* scm/output-tex.scm (stop-page): Use it.

* scm/output-ps.scm (define-fonts): Bugfix.

ChangeLog
input/regression/between-systems.ly [deleted file]
lily/include/paper-outputter.hh
lily/paper-book.cc
lily/paper-outputter.cc
po/nl.po
python/lilylib.py
scm/output-ps.scm
scm/output-tex.scm
scripts/lilypond.py
tex/lilyponddefs.tex

index dcdddb978eb05d07ddc715962b21ef74de115f5a..0e055fec6a2d7b597d5a8b9038cfd8332a8aca1f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2004-04-11  Jan Nieuwenhuizen  <janneke@gnu.org>
 
+       * scm/output-ps.scm (header): Papersize from paper.
+
+       * scripts/lilypond.py (global_latex_preamble): Oldish behaviour
+       for classic output.
+
+       * tex/lilyponddefs.tex (interscoreline): Oldish behaviour if
+       lilypondclassic is defined.
+       (lilypondstart): Oldish behaviour if lilypondclassic is defined.
+
+       * input/regression/between-systems.ly: Remove.
+
+       * python/lilylib.py (get_bbox): Fix regular expression
+       for bounding box.
+
        * tex/lilyponddefs.tex (lilypondpagebreak): New overridable macro.
 
        * scm/output-tex.scm (stop-page): Use it.
diff --git a/input/regression/between-systems.ly b/input/regression/between-systems.ly
deleted file mode 100644 (file)
index b091328..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-
-\version "2.2.0"
-
-\header{
-texidoc="
-By inserting @TeX{} commands between systems, you can force pagebreaks.
-
-In reality, you'd use the LateX command @code{\\newpage} instead of (pagebreak)
-of course. 
-"
-}
-
-
-#(define (set-page-break grob grob-c context)
-  (let*
-   ((meta (ly:grob-property grob 'meta))
-    (name (cdr (assoc 'name meta))))
-   
-   (if (equal? 'NonMusicalPaperColumn name)
-    (ly:grob-set-property! grob 'between-system-string "(pagebreak)\n\n"))
-))
-
-\score {
-    \notes \relative c' {
-       c1
-       \context Score \applyoutput #set-page-break
-       \break
-       
-       c1
-    }
-}
-
index b90408ba4702b2b26d85629a315ea9b89cb6af81..824618db5ee14da26304eb51e58e8395657cd8bb 100644 (file)
@@ -41,7 +41,7 @@ public:
   void output_music_output_def (Music_output_def* odef);
   void output_scheme (SCM scm);
   void output_expr (SCM expr, Offset o);
-  void output_header (Paper_def*, SCM, int);
+  void output_header (Paper_def*, SCM, int, bool);
   void output_line (SCM, Offset*, bool);
 };
 
index 7cfd6e10f6e0af4314ad719d083e09a3b943309d..fb4b9a76fc873565a84394c8e631b03de6be38ed 100644 (file)
@@ -251,7 +251,7 @@ Paper_book::output (String outname)
 
   Paper_def *paper = papers_[0];
   Paper_outputter *out = paper->get_paper_outputter (outname);
-  out->output_header (paper, scopes (0), pages->size ());
+  out->output_header (paper, scopes (0), pages->size (), false);
 
   int page_count = pages->size ();
   for (int i = 0; i < page_count; i++)
@@ -309,7 +309,7 @@ Paper_book::classic_output (String outname)
 {
   int count = scores_.size ();
   Paper_outputter *out = papers_.top ()->get_paper_outputter (outname);
-  out->output_header (papers_.top (), scopes (count - 1), 0);
+  out->output_header (papers_.top (), scopes (count - 1), 0, true);
 
   Paper_line *first = unsmob_paper_line (scm_vector_ref (scores_.top (),
                                                         scm_int2num (0)));
@@ -404,10 +404,10 @@ Paper_book::pages ()
   SCM all = lines ();
   SCM proc = paper->get_scmvar ("page-breaking");
   SCM breaks = scm_apply_0 (proc, scm_list_n (all, scm_make_real (height_),
-                                           scm_make_real (text_height),
-                                           scm_make_real (-copy_height),
-                                           scm_make_real (-tag_height),
-                                           SCM_UNDEFINED));
+                                             scm_make_real (text_height),
+                                             scm_make_real (-copy_height),
+                                             scm_make_real (-tag_height),
+                                             SCM_UNDEFINED));
 
   /* Copyright on first page.  */
   if (unsmob_stencil (copyright_))
index 56d4e9b378bee9d03bb2fb62a1783c5d79c479b5..009eb381e147d2863f8075d1c20e04b3bec02d30 100644 (file)
@@ -126,7 +126,8 @@ Paper_outputter::output_metadata (Paper_def *paper, SCM scopes)
 }
 
 void
-Paper_outputter::output_header (Paper_def *paper, SCM scopes, int page_count)
+Paper_outputter::output_header (Paper_def *paper, SCM scopes, int page_count,
+                               bool is_classic)
 {
   String creator = gnu_lilypond_version_string ();
   creator += " (http://lilypond.org)";
@@ -134,10 +135,13 @@ Paper_outputter::output_header (Paper_def *paper, SCM scopes, int page_count)
   String time_stamp = ctime (&t);
   time_stamp = time_stamp.left_string (time_stamp.length () - 1)
     + " " + *tzname;
-  output_scheme (scm_list_4 (ly_symbol2scm ("header"),
+  output_scheme (scm_list_n (ly_symbol2scm ("header"),
                             scm_makfrom0str (creator.to_str0 ()),
                             scm_makfrom0str (time_stamp.to_str0 ()),
-                            scm_int2num (page_count)));
+                            paper->self_scm (),
+                            scm_int2num (page_count),
+                            ly_bool2scm (is_classic),
+                            SCM_UNDEFINED));
 
   output_metadata (paper, scopes);
   output_music_output_def (paper);
index 20d3af23199457f83f70faada76c10868828c4d1..30f42c63b187ba278e7fc0af855de69f1abedf86 100644 (file)
--- a/po/nl.po
+++ b/po/nl.po
@@ -12,7 +12,7 @@ msgstr ""
 "Project-Id-Version: lilypond 2.2.0\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2004-03-31 16:22+0200\n"
-"PO-Revision-Date: 2004-04-10 23:36+0200\n"
+"PO-Revision-Date: 2004-04-11 11:01+0200\n"
 "Last-Translator: Jan Nieuwenhuizen <janneke@gnu.org>\n"
 "Language-Team: Dutch <vertaling@nl.linux.org>\n"
 "MIME-Version: 1.0\n"
@@ -1584,7 +1584,7 @@ msgstr "niemand om een x-ool start haak af te drukken"
 #: time-signature.cc:95
 #, c-format
 msgid "time signature symbol `%s' not found; reverting to numbered style"
-msgstr "maatsoortsymbool `%s' niet gevondend; val terug op numerieke stijl"
+msgstr "maatsoortsymbool `%s' niet gevonden; val terug op numerieke stijl"
 
 #.
 #. Todo: should make typecheck?
index b3dde26a20795792a3899d1dae072ed203750b71..4df1532a19d04302af197533d9faf5ac54728c94 100644 (file)
@@ -433,6 +433,7 @@ def print_environment ():
        for (k,v) in os.environ.items ():
                sys.stderr.write ("%s=\"%s\"\n" % (k, v)) 
 
+BOUNDING_BOX_RE = '^%%BoundingBox: (-?[0-9]+) (-?[0-9]+) (-?[0-9]+) (-?[0-9]+)'
 def get_bbox (filename):
        bbox = filename + '.bbox'
        ## -sOutputFile does not work with bbox?
@@ -440,8 +441,7 @@ def get_bbox (filename):
              (filename, bbox)
        system (cmd, progress_p = 1)
        box = open (bbox).read ()
-       m = re.match ('^%%BoundingBox: ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)',
-                     box)
+       m = re.match (BOUNDING_BOX_RE, box)
        gr = []
        if m:
                gr = map (string.atoi, m.groups ())
index 7a1d8e03af8bd86ef6d9103b19dad9ed0e14e59f..3635daf6b0ab4a012bb46b92ff4a2cdfb2b58cef 100644 (file)
   (string-append (ly:numbers->string (list breapth width depth height))
                 " draw_box"))
 
-(define (header creator time-stamp page-count-)
+(define (header creator time-stamp paper page-count- classic?)
   (set! page-count page-count-)
   (set! page-number 0)
   (string-append
    "%%Creator: " creator " " time-stamp "\n"
    "%%Pages: " (number->string page-count) "\n"
    "%%PageOrder: Ascend\n"
-   ;; FIXME: TODO get from paper
-   ;; "%%DocumentPaperSizes: a6\n"
+   "%%DocumentPaperSizes: " (ly:paper-lookup paper 'papersize) "\n"
    ;;(string-append "GNU LilyPond (" (lilypond-version) "), ")
    ;;     (strftime "%c" (localtime (current-time))))
    ;; FIXME: duplicated in every backend
index a74d8e883b831aee28f47d5c709da24d375ee524..0bfed3774550fc0a9597204ebb65b0a1fb0835f9 100644 (file)
    "\\lilypondspecial\n"
    "\\lilypondpostscript\n"))
 
-(define (header creator time-stamp page-count)
+(define (header creator time-stamp paper page-count classic?)
   (string-append
    "% Generated by " creator "\n"
    "% at " time-stamp "\n"
+   (if classic?
+       (tex-string-def "lilypond" 'classic "1")
+       "")
    ;; FIXME: duplicated in every backend
    "\\def\\lilypondtagline{Engraved by LilyPond (version "
    (lilypond-version)")}\n"))
index 7511467cd8f818b654ce533a00230c4768238b0e..dae512954f337cbf8d442df79e806b672f914d8d 100644 (file)
@@ -84,6 +84,8 @@ global re;re = ly.re
 # lilylib globals
 program_name = 'lilypond'
 program_version = '@TOPLEVEL_VERSION@'
+# input without \book, use classic latex definitions
+classic_p = 0
 verbose_p = 0
 pseudo_filter_p = 0
 original_dir = os.getcwd ()
@@ -161,6 +163,7 @@ extra_init = {
        'latexheaders' : [],
        'latexoptions' : [],
        'latexpackages' :  [],
+       'linewidth' : [],
        'orientation' : [],
        'papersize' : [],
        'unit' : ['pt'],
@@ -274,9 +277,14 @@ def analyse_lilypond_output (filename, extra):
        # search only the first 10k
        s = s[:10240]
        for x in header_fields:
-               m = re.search (r'\\def\\lilypondpaper%s{([^}]*)}'%x, s)
+               m = re.search (r'\\def\\lilypondpaper%s{([^}]*)}' % x, s)
                if m:
                        set_setting (extra, x, m.group (1))
+
+       global classic_p
+       if s.find ('\\def\\lilypondclassic{1}') >= 0:
+               classic_p = 1
+       
        ly.progress ('\n')
 
 def find_tex_files_for_base (base, extra):
@@ -330,10 +338,38 @@ def one_latex_definition (defn, first):
                        s += r'''\let\lilypond%s\relax''' % k
                s += '\n'
 
+       if classic_p and not first:
+               s += '\interscoreline'
+
        s += '%%PREVIEW%%\n'
        s += '\\input %s\n' % defn[0]
        return s
 
+               
+## FIXME: copied from tex/lilyponddefs.tex
+LATEX_PREAMBLE = '''
+%% Nullify [La]TeX page layout settings, page layout by LilyPond.
+\\topmargin-1in
+\\headheight0pt\\headsep0pt
+\\oddsidemargin-1in
+\\evensidemargin\oddsidemargin
+\\parindent 0pt'''
+
+CLASSIC_LATEX_PREAMBLE = '''
+%% FIXME: cannot do this, dimens in header part of lilypond output
+%% Center staves horizontally on page
+\\ifdim\\lypylinewidth\\lypyunit > 0pt
+\\hsize\\lypylinewidth\\lypyunit
+\\newdimen\\lypytempdim
+\\lypytempdim\\paperwidth
+\\advance\\lypytempdim-\\the\\hsize
+\\lypytempdim0.5\\lypytempdim
+\\advance\\lypytempdim -1in
+\\oddsidemargin\\lypytempdim
+\\evensidemargin\\lypytempdim
+\\fi
+\\parindent 0pt'''
+
 def global_latex_preamble (extra):
        '''construct preamble from EXTRA,'''
        
@@ -350,9 +386,16 @@ def global_latex_preamble (extra):
        if safe_mode_p:
                s += '\\nofiles\n'
 
+       if classic_p:
+               if extra['linewidth']:
+                       s += '\\def\\lypylinewidth{%s}\n' \
+                            % extra['linewidth'][-1]
+               else:
+                       s += '\\let\\lypylinewidth\\texwidth\n'
+               s += '\\def\\lypyunit{%s}\n' % extra['unit'][-1]
+
        if extra['language']:
-               s += r'\usepackage[%s]{babel}' \
-                   % extra['language'][-1] + '\n'
+               s += '\\usepackage[%s]{babel}' % extra['language'][-1] + '\n'
 
        s += '\\usepackage{%s}\n' \
                % string.join (extra['latexpackages'], ',')
@@ -367,15 +410,12 @@ def global_latex_preamble (extra):
        s += r'''
 \usepackage[latin1]{inputenc}
 \pagestyle{empty}
-%%PREVIEW%%
-%% Nullify [La]TeX page layout settings, page layout by LilyPond.
-\pagestyle{empty}
-\topmargin-1in
-\headheight0pt\headsep0pt
-\oddsidemargin-1in
-\evensidemargin\oddsidemargin
-\parindent 0pt
-'''
+%%PREVIEW%%'''
+       
+       if classic_p:
+               s += CLASSIC_LATEX_PREAMBLE
+       else:
+               s += LATEX_PREAMBLE
        return s
 
        
index a26ea6877c8b1285e8b947ca947d94b05313e262..5869d13626ca171f4d92ce0ab9877315de31ab6a 100644 (file)
@@ -25,6 +25,7 @@
 %%   <font setup and note output>
 %%   \lilypondend
 
+\newdimen\lytempdim
 \newdimen\outputscale
 
 %% Handy macros from the LaTeX manual.
         \documentclass[a4paper]{article}
         %% safe-mode
         \nofiles
-        %% Nullify [La]TeX page layout settings, page layout by LilyPond.
         \pagestyle{empty}
-        \topmargin-1in
-        \headheight0pt\headsep0pt
-        \oddsidemargin-1in
-        \evensidemargin\oddsidemargin
+        \lilypondifundefined{lilypondclassic}
+        {
+          %% Nullify [La]TeX page layout settings, page layout by LilyPond.
+          \topmargin-1in
+          \headheight0pt\headsep0pt
+          \oddsidemargin-1in
+          \evensidemargin\oddsidemargin
+        }
+        {
+          %% Center staves horizontally on page
+          \ifdim\lilypondpaperlinewidth\lilypondpaperunit > 0pt
+          \hsize\lilypondpaperlinewidth\lilypondpaperunit
+          \lytempdim \paperwidth
+          \advance\lytempdim -\the\hsize
+          \lytempdim 0.5\lytempdim
+          \advance\lytempdim -1in
+          \oddsidemargin \lytempdim
+          \evensidemargin \lytempdim
+          \fi
+        }
         \parindent 0pt
         %% TEXINFO workaround: \begin is defined as \outer, use \csname.
         \csname begin\endcsname{document}}}
 \gdef\lyitem#1#2#3{
   \topalign{\raise#2\outputscale\leftalign{\kern#1\outputscale#3}}}
 
-\newdimen\lytempdim
 \gdef\lybox#1#2#3#4#5{
   \lytempdim\baselineskip
   \advance\lytempdim-#4\outputscale
 
 %% Allow overriding of interscoreline, e.g. for lilypond.py's --preview
 \lilypondifundefined{interscoreline}
-{\gdef\interscoreline{}}{}
+{
+  \lilypondifundefined{lilypondclassic}
+  {\gdef\interscoreline{}}
+  {\gdef\interscoreline{
+      \vskip\lilypondpaperinterscoreline\lilypondpaperunit
+      plus \lilypondpaperinterscorelinefill fill}}
+}
+{}
 
 %% Include postscript definitions unless using PDFTeX,
 %% in that case use pdf definitions.