]> git.donarmstrong.com Git - lilypond.git/commitdiff
* ps/lilyponddefs.ps: Remove automatic page layout.
authorJan Nieuwenhuizen <janneke@gnu.org>
Thu, 11 Mar 2004 15:42:34 +0000 (15:42 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Thu, 11 Mar 2004 15:42:34 +0000 (15:42 +0000)
* scm/output-ps.scm (new-start-system): New interface function.

* lily/include/paper-outputter.hh (output_line): Add ORIGIN parameter.

* lily/paper-book.cc (output): Bugfix.

* ps/lilyponddefs.ps: Bugfix.

ChangeLog
input/test/title-markup.ly
lily/include/paper-outputter.hh
lily/paper-book.cc
lily/paper-outputter.cc
ps/lilyponddefs.ps
scm/font.scm
scm/output-ps.scm
scm/page-layout.scm

index 52b485a52bdffd0d7d1f467ba967b89cd5a1a7c6..5b66db56518d149f110c6c878b6b795eee4a2dfe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2004-03-11  Jan Nieuwenhuizen  <janneke@gnu.org>
 
+       * ps/lilyponddefs.ps: Remove automatic page layout.
+
+       * scm/output-ps.scm (new-start-system): New interface function.
+
+       * lily/include/paper-outputter.hh (output_line): Add ORIGIN parameter.
+
+       * lily/paper-book.cc (output): Bugfix.
+
        * Documentation/user/lilypond.tely: Bugfix: Remove './' from
        direntries.
 
index d5b77ced73431b80689657df1dedfba4d87b9bf8..f22d13f10c5904c1278383a767e3398242e8fef0 100644 (file)
@@ -42,7 +42,10 @@ spaceTest = \markup { "two space chars" }
     
     %dedication = "För my dør Lily"
     % ugh: encoding char-size
-    dedication = "For my öòóôõø so dear Lily"
+    %dedication = "For my öòóôõø so dear Lily"
+    dedication = \markup { "For my "
+                          \latin-i { "öòóôõø" }
+                          " so dear Lily" }
     title = "Title"
     subtitle = "(and (the) subtitle)"
     subsubtitle = "Sub sub title"
index 58c23e2464367efa74c6afe42252f584abbaf296..fc59ec65bc30d28654f022e05fd777c61564a0dc 100644 (file)
@@ -43,7 +43,7 @@ public:
   void output_scheme (SCM scm);
   void output_expr (SCM expr, Offset o);
   void output_header (Paper_def*);
-  void output_line (SCM, bool);
+  void output_line (SCM, Offset*, bool);
 };
 
 #endif /* PAPER_OUTPUTTER_HH */
index d75befab14e2d01f7c494423ed803d81f44daaef..f9c13d404369a4fa38adde19f99ba854c497cdb7 100644 (file)
@@ -26,21 +26,15 @@ stencil2line (Stencil* stil)
                   scm_list_1 (scm_cons (z, stil->smobbed_copy ())));
 }
 
-static SCM
-height2line (Real h)
-{
-  static SCM z = ly_offset2scm (Offset (0, 0));
-  return scm_cons (ly_offset2scm (Offset (0, h)),
-                  scm_list_1 (scm_cons (z, SCM_EOL)));
-}
-
 // WIP -- simplistic page interface
 // Do we need this at all?  SCM, smob?
 class Page
 {
 public:
   Paper_def *paper_;
+  static int page_count_;
   int number_;
+  int line_count_;
 
   Protected_scm lines_;
   Protected_scm header_;
@@ -55,10 +49,12 @@ public:
   // HMMM all this size stuff to paper/paper-outputter?
   Real hsize_;
   Real vsize_;
+  Real left_margin_;
   Real top_margin_;
   Real bottom_margin_;
   Real foot_sep_;
   Real head_sep_;
+  Real text_width_;
 
   /* available area for text.  */
   Real text_height ();
@@ -67,12 +63,17 @@ public:
   void output (Paper_outputter*, bool);
 };
 
+int Page::page_count_ = 0;
+
 Page::Page (Paper_def *paper, int number)
 {
   paper_ = paper;
   number_ = number;
+  page_count_++;
+  
   height_ = 0;
   lines_ = SCM_EOL;
+  line_count_ = 0;
   
   hsize_ = paper->get_realvar (ly_symbol2scm ("hsize"));
   vsize_ = paper->get_realvar (ly_symbol2scm ("vsize"));
@@ -80,6 +81,8 @@ Page::Page (Paper_def *paper, int number)
   bottom_margin_ = paper->get_realvar (ly_symbol2scm ("bottom-margin"));
   head_sep_ = paper->get_realvar (ly_symbol2scm ("head-sep"));
   foot_sep_ = paper->get_realvar (ly_symbol2scm ("foot-sep"));
+  text_width_ = paper->get_realvar (ly_symbol2scm ("linewidth"));
+  left_margin_ = (hsize_ - text_width_) / 2;
   
   SCM make_header = scm_primitive_eval (ly_symbol2scm ("make-header"));
   SCM make_footer = scm_primitive_eval (ly_symbol2scm ("make-footer"));
@@ -100,21 +103,22 @@ Page::Page (Paper_def *paper, int number)
 void
 Page::output (Paper_outputter *out, bool is_last)
 {
+  Offset o (left_margin_, top_margin_);
+  Real vfill = line_count_ > 1 ? (text_height () - height_) / (line_count_ - 1)
+    : 0;
+  out->output_scheme (scm_list_1 (ly_symbol2scm ("start-page")));
   if (get_header ())
+    out->output_line (stencil2line (get_header ()), &o, false);
+  for (SCM s = lines_; gh_pair_p (s); s = ly_cdr (s))
     {
-      out->output_line (stencil2line (get_header ()), false);
-      out->output_line (height2line (head_sep_), false);
+      out->output_line (ly_car (s), &o, is_last && gh_pair_p (ly_cdr (s)));
+      if (gh_pair_p (ly_cdr (s)))
+       o[Y_AXIS] += vfill;
     }
-  out->output_scheme (scm_list_1 (ly_symbol2scm ("start-page")));
-  for (SCM s = lines_; gh_pair_p (s); s = ly_cdr (s))
-    out->output_line (ly_car (s), is_last && gh_pair_p (ly_cdr (s)));
+  if (get_footer ())
+    out->output_line (stencil2line (get_footer ()), &o, is_last);
   out->output_scheme (scm_list_2 (ly_symbol2scm ("stop-page"),
                                  gh_bool2scm (is_last && !get_footer ())));
-  if (get_footer ())
-    {
-      out->output_line (height2line (foot_sep_), false);
-      out->output_line (stencil2line (get_footer ()), is_last);
-    }
 }
 
 Real
@@ -228,6 +232,7 @@ Paper_book::get_pages ()
     }
 
   Paper_def *paper = papers_[0];
+  Page::page_count_ = 0;
   int page_number = 1;
   Page *page = new Page (paper, page_number++);
   fprintf (stderr, "book_height: %f\n", book_height);
@@ -260,6 +265,7 @@ Paper_book::get_pages ()
              if (j == 0 && title)
                page->lines_ = ly_snoc (stencil2line (title), page->lines_);
              page->lines_ = ly_snoc (line, page->lines_);
+             page->line_count_++;
              page->height_ += h;
              h = 0;
            }
@@ -282,7 +288,7 @@ Paper_book::classic_output (String outname)
   int line_count = SCM_VECTOR_LENGTH ((SCM) scores_.top ());
   for (int i = 0; i < line_count; i++)
     out->output_line (scm_vector_ref ((SCM) scores_.top (), scm_int2num (i)),
-                     i == line_count - 1);
+                     0, i == line_count - 1);
   
   out->output_scheme (scm_list_1 (ly_symbol2scm ("end-output")));
   progress_indication ("\n");
index 0fe1330ba1ed8cf75a1a420e386083183663a791..4797a837ec0e18150151828e6840d85f9206ea8a 100644 (file)
@@ -95,20 +95,26 @@ Paper_outputter::output_header (Paper_def *paper)
 }
 
 void
-Paper_outputter::output_line (SCM line, bool is_last)
+Paper_outputter::output_line (SCM line, Offset *origin, bool is_last)
 {
   Offset dim = ly_scm2offset (ly_car (line));
-  Real width = dim[X_AXIS];
-  Real height = dim[Y_AXIS];
-      
-  if (height > 50 CM)
+  if (dim[Y_AXIS] > 50 CM)
     {
       programming_error ("Improbable system height.");
-      height = 50 CM;
+      dim[Y_AXIS] = 50 CM;
     }
 
-  output_scheme (scm_list_3 (ly_symbol2scm ("start-system"),
-                            gh_double2scm (width), gh_double2scm (height)));
+  if (output_format_global != PAGE_LAYOUT)
+    output_scheme (scm_list_3 (ly_symbol2scm ("start-system"),
+                              gh_double2scm (dim[X_AXIS]),
+                              gh_double2scm (dim[Y_AXIS])));
+  else
+    {
+      output_scheme (scm_list_3 (ly_symbol2scm ("new-start-system"),
+                                ly_quote_scm (ly_offset2scm (*origin)),
+                                ly_quote_scm (ly_offset2scm (dim))));
+      (*origin)[Y_AXIS] += dim[Y_AXIS];
+    }
 
   SCM between = SCM_EOL;
   for (SCM s = ly_cdr (line); gh_pair_p (s); s = ly_cdr (s))
index 37cfbf2dd659d1a9fdc79f89cde49f8929628e5a..b4116e2b21276363c483052fb4b85d47852856f0 100644 (file)
@@ -1,4 +1,6 @@
 %!PS-Adobe-2.0: lilyponddefs.ps
+% TODO:
+%  * junk all magic, start-line/stop-line just: placebox @ x.y
 %
 % Functions for direct PostScript output
 
@@ -11,9 +13,6 @@
 /staff-height lilypondpaperstaffheight def
 /line-width lilypondpaperlinewidth def
 
-% FIXME: why isn't this set (by default) by lily?
-% /text-height lilypondpapertextheight def
-
 /lily-output-units 2.83464  def  %% milimeter
 % /lily-output-units 0.996264  def  %% true points.
 
 
 /paper-size { lilypondpaperpapersize } bind def
 
-%% FIXME: base-line-skip is too big, is this RIGHT?
-%% /line-height 14 staff-space mul def
-%% /base-line-skip lilypondpaperlineheight def
-%%/base-line-skip lilypondpaperlineheight lilypondpaperoutputscale div def
-/base-line-skip 0 def
-
 /init-paper {
        gsave
        .1 setlinewidth
 
 /start-page
 {
-    %/line-x left-margin output-scale div def
-    %/line-y vsize top-margin sub def
-    /line-x 0 def
-    /line-y vsize def
 } bind def
 
 /stop-page
     showpage
 } bind def
 
-% dump using baselineskip, fold to new page
-/start-system % height
-{
-       dup base-line-skip gt {
-               /line-height exch def
-       }
-       {
-               pop /line-height base-line-skip def
-       } ifelse
-       line-y top-margin sub base-line-skip lt {
-               showpage
-               /line-y vsize top-margin sub def
-       } if
-       gsave
-       line-x line-y translate
-} bind def
-
-/stop-system
-{ 
-       /the-line exch def
-       the-line
-       stroke
-       grestore
-       line-y line-height output-scale mul sub /line-y exch def
-} bind def
-
-% FIXME: font definitions should come from LilyPond
-%        built-in ps fonts are ugly
-/huge-bold-font {
-       /Palatino-Bold findfont 20.7 scalefont setfont
-} bind def
-
-/Large-bold-font {
-       /Palatino-Bold findfont 17.3 scalefont setfont
-} bind def
-
-/large-bold-font {
-       /Palatino-Bold findfont 14.4 scalefont setfont
-} bind def
-
-/large-font {
-       /Palatino-Roman findfont 14.4 scalefont setfont
-} bind def
-
-/large-smallcaps-font {
-       % urg
-       /Bookman-Light findfont 14.4 scalefont setfont
-} bind def
-
-/normal-font {
-       /Palatino-Roman findfont 12 scalefont setfont
-} bind def
-
-/footnote-font {
-       /Palatino-Roman findfont 10 scalefont setfont
-} bind def
-
-/get-text-dimensions % path .. width height
-{
-       dup true charpath pathbbox
-       newpath
-       line-x line-y moveto
-       exch 4 -1 roll
-       sub
-       3 1 roll
-       exch sub
-} bind def
-
-/set-centered
+/stop-last-page
 {
-       line-x line-y moveto
-       get-text-dimensions
-       neg line-y add /line-y exch def
-       neg line-width add 2 div 0 rmoveto
-       show
 } bind def
 
-/set-left
+/start-system % x y
 {
-       line-x line-y moveto
-       get-text-dimensions
-       neg line-y add /line-y exch def
-       pop
-       show
+    gsave
+    exch output-scale mul exch
+    output-scale mul vsize exch sub translate
 } bind def
 
-/set-right
-{
-       line-x line-y moveto
-       get-text-dimensions
-       neg line-y add /line-y exch def
-       neg line-width add 0 rmoveto
-       show
-} bind def
-
-/make-lilypond-title
-{
-       currentdict /lilyponddedication known {
-               normal-font lilyponddedication set-centered
-               line-y 10 sub /line-y exch def
-       } if
-       currentdict /lilypondtitle known {
-               huge-bold-font lilypondtitle set-centered
-               line-y 5 sub /line-y exch def
-       } if
-       currentdict /lilypondsubtitle known {
-               Large-bold-font lilypondsubtitle set-centered
-               line-y 5 sub /line-y exch def
-       } if
-       currentdict /lilypondsubsubtitle known {
-               large-bold-font lilypondsubsubtitle set-centered
-       } if
-       line-y /mini-page exch def
-       currentdict /lilypondcomposer known {
-               large-smallcaps-font lilypondcomposer set-right
-               line-y 2 sub /line-y exch def
-       } if
-       currentdict /lilypondopus known {
-               normal-font lilypondopus set-right
-               line-y 3 sub /line-y exch def
-       } if
-       currentdict /lilypondarranger known {
-               normal-font lilypondarranger set-right
-               line-y 3 sub /line-y exch def
-       } if
-       currentdict /lilypondpoet known {
-               mini-page /line-y exch def
-               normal-font lilypondpoet set-left
-               line-y 3 sub /line-y exch def
-       } if
-       currentdict /lilypondtexttranslator known {
-               normal-font lilypondtexttranslator set-left
-               line-y 3 sub /line-y exch def
-       } if
-       currentdict /lilypondinstrument known {
-               large-font lilypondinstrument set-centered
-       } if
-       currentdict /lilypondpiece known {
-               large-smallcaps-font lilypondpiece set-left
-       } if
+/stop-system
+{ 
+    /the-line exch def
+    the-line stroke grestore
 } bind def
 
 /end-lilypond-output
 {
-       /line-y top-margin def
-       footnote-font lilypondtagline set-left
-       showpage
+%    showpage
 } bind def
 
-/turnOnExperimentalFeatures { } bind def
-
 staff-line-thickness setlinewidth
 
 % set postscript paper size
@@ -250,9 +110,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
-/line-x 0 def
-/line-y vsize def
-
 % end lilyponddefs.ps
index b74d878dfd0cc712aa5009f03b4b0e526628e269..6e9d409c05a4d62bfe83abf574100cc202e2fa69 100644 (file)
@@ -27,19 +27,12 @@ or
   
 (define-public paper20-font-vector
   '((#(medium upright number) .
-     (10 . #(
-            (4.0  . "feta-nummer4")
+     (10 . #((4.0  . "feta-nummer4")
             (6.0  . "feta-nummer6")
             (8.0  . "feta-nummer8")
             (10.0  . "feta-nummer10")
             (12.0  . "feta-nummer12")
-            (16.0  . "feta-nummer16")
-            
-
-            )
-
-
-        ))
+            (16.0  . "feta-nummer16"))))
     (#(medium upright roman) .
      (10.0 . #((6.0 . "cmr6")
               (8.0 . "cmr8") 
index 7f3953bc8d4fe2743d355d2c5a48129cac027e33..8db25eb918b9d3c3483fd2d14d97f1e9715628f4 100644 (file)
   
   (string-append (select-font name-mag-pair) exp))
 
-(define (header creator time-stamp) 
+(define (header creator time-stamp)
   (string-append
    "%!PS-Adobe-3.0\n"
    "%%Creator: " creator " " time-stamp "\n"
     (numbers->string
      (list x y width height blotdiam)) " draw_round_box"))
 
-(define (start-system width height)
+(define (new-start-system origin dim)
   (string-append
-   "\n" (ly:number->string height)
-   " start-system\n"
-   ;; Show height of system
-   (draw-line 1 0 0 (- 0 10) (- 0 (* OUTPUT-SCALE height)))
+   "\n" (number-pair->string origin) " start-system\n"
    "{\n"
    "set-ps-scale-to-lily-scale\n"))
 
    (numbers->string (list breapth width depth height))
    " draw_box" ))
 
-(define (stop-last-system)
-  (stop-system))
-
 (define (stop-system)
   "}\nstop-system\n")
 
+(define stop-last-system stop-system)
+
 (define (symmetric-x-triangle thick w h)
   (string-append
    (numbers->string (list h w thick))
   "\nstart-page\n")
 
 (define (stop-page last?)
-  "\nstop-page\n")
+  (if last?
+      "\nstop-last-page\n"
+      "\nstop-page\n"))
index fc86c8bb3f25d525a36d020ee94441eeb5858605..eb0af1b92882598d475db88effa960084f1e7668 100644 (file)
@@ -30,7 +30,7 @@
       (#:override '(baseline-skip . 4)
       #:column
       (#:fill-line
-       (#:latin-i (get 'dedication))
+       (#:normalsize (get 'dedication))
        #:fill-line
        (#:huge #:bigger #:bigger #:bigger #:bigger #:bold (get 'title))
        #:override '(baseline-skip . 3)