From b1a521c92717244d4bff11bb0b2b1304e4355956 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Wed, 10 Mar 2004 00:58:30 +0000 Subject: [PATCH] * lily/paper-book.cc (get_pages): Bugfix: set dimensions for titles. * 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 | 2 +- lily/paper-book.cc | 31 +++++++++++++++++--------- lily/score.cc | 4 ++-- ps/lilyponddefs.ps | 45 +++++++++++++++++--------------------- scm/output-ps.scm | 16 +++++--------- 5 files changed, 49 insertions(+), 49 deletions(-) diff --git a/input/test/title-markup.ly b/input/test/title-markup.ly index 3739e2349e..862eab29ed 100644 --- a/input/test/title-markup.ly +++ b/input/test/title-markup.ly @@ -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 } } diff --git a/lily/paper-book.cc b/lily/paper-book.cc index 854356baf6..5eedc873fe 100644 --- a/lily/paper-book.cc +++ b/lily/paper-book.cc @@ -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; } diff --git a/lily/score.cc b/lily/score.cc index 089d4b5df1..b1c1c554b3 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -176,14 +176,14 @@ default_rendering (SCM music, SCM outdef, SCM header, SCM outname) if (systems != SCM_UNDEFINED) { Paper_score *ps = dynamic_cast (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_); diff --git a/ps/lilyponddefs.ps b/ps/lilyponddefs.ps index ff80432b9f..3cbc5b1eb5 100644 --- a/ps/lilyponddefs.ps +++ b/ps/lilyponddefs.ps @@ -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: @@ -18,32 +17,25 @@ /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 diff --git a/scm/output-ps.scm b/scm/output-ps.scm index 7553e2f1de..464c85fa77 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -278,16 +278,8 @@ (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)) @@ -386,6 +378,8 @@ (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")) @@ -438,7 +432,7 @@ " draw_zigzag_line ")) (define (start-page) - "\n%start page\n") + "\nstart-page\n") (define (stop-page last?) - "\n%showpage\n") + "\nstop-page\n") -- 2.39.2