]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/paper-book.cc (get_pages): Bugfix: set dimensions for titles.
authorJan Nieuwenhuizen <janneke@gnu.org>
Wed, 10 Mar 2004 00:58:30 +0000 (00:58 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Wed, 10 Mar 2004 00:58:30 +0000 (00:58 +0000)
* ps/lilyponddefs.ps: Use only very small top-marging.
(init-paper): Also pop page size string.
(start-page, stop-page): New function.

* scm/output-ps.scm (header-end): Remove stray exec commands.

input/test/title-markup.ly
lily/paper-book.cc
lily/score.cc
ps/lilyponddefs.ps
scm/output-ps.scm

index 3739e2349e0a4b23533911ad50b4c1cf5c0ff93b..862eab29ede2fed21418138f2cedcaa1652d795c 100644 (file)
@@ -103,7 +103,6 @@ spaceTest = \markup { "two space chars" }
 \score {
     \context Staff \notes \relative c' {
        c2-\sizeTest c2-\spaceTest
-       \break c2-\latinTest c2
     }
 }
 
@@ -114,5 +113,6 @@ spaceTest = \markup { "two space chars" }
 \score {
     \context Staff \notes \relative c' {
        \repeat unfold 10 { a b c d \break }
+       c1
     }
 }
index 854356baf6a2bbe1fb8e29ece6c54344c94713fa..5eedc873fef5c05c455dee3b8be18701868084f5 100644 (file)
@@ -131,9 +131,7 @@ Paper_book::get_title (int i)
                                                 papers_[0]->self_scm (),
                                                 scm_variable_ref (s)));
       
-      /* match systems, which are also aligned to center */
-      //(ly:stencil-align-to! header-stencil Y CENTER)
-      title->align_to (Y_AXIS, CENTER);
+      title->align_to (Y_AXIS, UP);
       return title;
     }
   
@@ -206,13 +204,17 @@ Paper_book::get_pages ()
          if (page->height_ + h <= text_height || page->height_ == 0)
            {
              if (j == 0 && title)
-               page->lines_
-                 = ly_snoc (scm_cons (ly_offset2scm (Offset (0, 0)),
-                                      scm_list_1
-                                      (scm_cons
-                                       (ly_offset2scm (Offset (0, 0)),
-                                        title->smobbed_copy ()))),
+               {
+                 Offset dim = Offset (title->extent (X_AXIS).length (),
+                                      title->extent (Y_AXIS).length ());
+                 page->lines_
+                   = ly_snoc (scm_cons (ly_offset2scm (dim),
+                                        scm_list_1
+                                        (scm_cons
+                                         (ly_offset2scm (Offset (0, 0)),
+                                          title->smobbed_copy ()))),
                             page->lines_);
+               }
              page->lines_ = ly_snoc (line, page->lines_);
              page->height_ += h;
              h = 0;
@@ -250,8 +252,17 @@ IMPLEMENT_SIMPLE_SMOBS (Paper_book)
 IMPLEMENT_TYPE_P (Paper_book, "ly:paper_book?")
 
 SCM
-Paper_book::mark_smob (SCM)
+Paper_book::mark_smob (SCM smob)
 {
+  Paper_book *b = (Paper_book*) SCM_CELL_WORD_1 (smob);
+
+#if 0 //TODO
+  scm_gc_mark (b->scores_);
+  scm_gc_mark (b->global_headers_);
+  scm_gc_mark (b->headers_);
+  scm_gc_mark (b->papers_);
+#endif
+
   return SCM_EOL;
 }
 
index 089d4b5df1ed41970e9818fba09cdcda1ea04477..b1c1c554b3c8b22692cc3fa46a05ca751503b406 100644 (file)
@@ -176,14 +176,14 @@ default_rendering (SCM music, SCM outdef, SCM header, SCM outname)
       if (systems != SCM_UNDEFINED)
        {
          Paper_score *ps = dynamic_cast<Paper_score*> (output);
-         // Hmmr
+#if 1
          paper_book->protect_ = scm_cons (systems, paper_book->protect_);
          paper_book->protect_ = scm_cons (global_input_file->header_,
                                           paper_book->protect_);
          paper_book->protect_ = scm_cons (header, paper_book->protect_);
          paper_book->protect_ = scm_cons (ps->paper_->smobbed_copy (),
                                           paper_book->protect_);
-
+#endif
          paper_book->papers_.push (ps->paper_);
          paper_book->scores_.push (systems);
          paper_book->global_headers_.push (global_input_file->header_);
index ff80432b9f8697e6b6d73acfa2ca6f6d8b12c1db..3cbc5b1eb5cf69c1a47c8ed946cb8807b620b402 100644 (file)
@@ -1,8 +1,7 @@
-%!PS-Adobe-1.0: lilyponddefs.ps
+%!PS-Adobe-2.0: lilyponddefs.ps
 %
 % Functions for direct PostScript output
 
-% hmm
 % /setgray { 1 add } bind def
 
 % To let gs load fonts from builddir, do:
 /lily-output-units 2.83464  def  %% milimeter
 % /lily-output-units 0.996264  def  %% true points.
 
-/output-scale
-lilypondpaperoutputscale lily-output-units mul 
-def
+/output-scale lilypondpaperoutputscale lily-output-units mul def
 
-/set-ps-scale-to-lily-scale
-{
-output-scale output-scale scale
-} bind def
+/set-ps-scale-to-lily-scale { output-scale output-scale scale } bind def
 
 /paper-size { lilypondpaperpapersize } bind def
 
 %% FIXME: base-line-skip is too big, is this RIGHT?
 %% /base-line-skip lilypondpaperlineheight def
-/base-line-skip lilypondpaperlineheight lilypondpaperoutputscale div def
+%%/base-line-skip lilypondpaperlineheight lilypondpaperoutputscale div def
+/base-line-skip 0 def
 
 /init-paper {
        gsave
        .1 setlinewidth
        clippath pathbbox newpath
        /vsize exch def
-       /hsize exch def  pop pop pop
-
-       %FIXME:
-       %vsize text-height sub 2 div /top-margin exch def
-       % 144 2 div /top-margin exch def
-       /top-margin 100 def
+       /hsize exch def pop pop pop pop
+       % FIXME
+       /top-margin 2 def
        hsize line-width sub 2 div /left-margin exch def
        grestore
 } bind def
@@ -85,6 +77,18 @@ output-scale output-scale scale
     end
 } bind def
 
+/start-page
+{
+    /line-x left-margin output-scale div def
+    /line-y vsize top-margin sub def
+} bind def
+
+/stop-page
+{
+    showpage
+} bind def
+
+% dump using baselineskip, fold to new page
 /start-system % height
 {
        dup base-line-skip gt {
@@ -243,13 +247,4 @@ paper-size
 % initialise paper dimensions
 staff-height init-paper
 
-/line-x left-margin output-scale div def
-/line-y vsize top-margin sub def
-
-% FIXME: testing \markup titles
-% make-lilypond-title
-
-% see if we're there...
-% 10 setlinewidth 0 0 moveto 400 800 lineto stroke
-
 % end lilyponddefs.ps
index 7553e2f1de4a357eca3fbfeb2979172bed41609a..464c85fa770324a7d0727f053e82119f22e683a8 100644 (file)
 
 (define (header-end)
   (string-append
-   ;; URG: now we can't use scm output without Lily
    (ly:gulp-file "lilyponddefs.ps")
-   "{exch pop //systemdict /run get exec}\n\n"
-   (ly:gulp-file "music-drawing-routines.ps")
-   "{ exch pop //systemdict /run get exec }\n\n"
-   ;; 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"
-   ))
+   (ly:gulp-file "music-drawing-routines.ps")))
 
 (define (horizontal-line x1 x2 th)
   (draw-line th x1  0 x2 0))
   (string-append
    "\n" (ly:number->string height)
    " start-system\n"
+   ;;(draw-line 2 0 (* OUTPUT-SCALE height) 100 0)
+   (draw-line 2 0 0 50 (- 0 (* OUTPUT-SCALE height)))
    "{\n"
    "set-ps-scale-to-lily-scale\n"))
 
     " draw_zigzag_line "))
 
 (define (start-page)
-  "\n%start page\n")
+  "\nstart-page\n")
 
 (define (stop-page last?)
-  "\n%showpage\n")
+  "\nstop-page\n")