+void
+Paper_outputter::output_page (Page *p, bool is_last)
+{
+ output_scheme (scm_list_1 (ly_symbol2scm ("start-page")));
+
+#if 0 /* FIXME: how stupid is this, memorywise? */
+
+ output_scheme (scm_list_3 (ly_symbol2scm ("start-system"),
+ ly_quote_scm (ly_offset2scm (Offset (0, 0))),
+ ly_quote_scm (ly_offset2scm (Offset (0, 0)))));
+
+ output_stencil (unsmob_stencil (p->to_stencil ()));
+
+ output_scheme (scm_list_2 (ly_symbol2scm ("stop-system"), SCM_BOOL_T));
+#else
+ Offset o (p->left_margin_, p->top_margin_);
+ Real vfill = (p->line_count_ > 1
+ ? (p->text_height () - p->height_) / (p->line_count_ - 1)
+ : 0);
+
+ Real coverage = p->height_ / p->text_height ();
+ if (coverage < p->MIN_COVERAGE_)
+ /* Do not space out a badly filled page. This is too simplistic
+ (ie broken), because this should not vary too much between
+ (subsequent?) pages in a book. */
+ vfill = 0;
+
+ if (unsmob_stencil (p->header_))
+ {
+ output_line (stencil2line (unsmob_stencil (p->header_)), &o, false);
+ o[Y_AXIS] += p->head_sep_;
+ }
+ for (SCM s = p->lines_; s != SCM_EOL; s = ly_cdr (s))
+ {
+ SCM line = ly_car (s);
+ output_line (line, &o,
+ is_last && ly_cdr (s) != SCM_EOL
+ && !unsmob_stencil (p->copyright_)
+ && !unsmob_stencil (p->tagline_)
+ && !unsmob_stencil (p->footer_));
+
+ /* Do not put vfill between title and its music, */
+ if (scm_pair_p (ly_cdr (s))
+ && (!unsmob_paper_line (line)->is_title () || vfill < 0))
+ o[Y_AXIS] += vfill;
+ /* rather put extra just before the title. */
+ if (ly_cdr (s) != SCM_EOL
+ && (unsmob_paper_line (ly_cadr (s))->is_title () && vfill > 0))
+ o[Y_AXIS] += vfill;
+ }
+
+ o[Y_AXIS] = p->vsize_ - p->bottom_margin_;
+ if (unsmob_stencil (p->copyright_))
+ o[Y_AXIS] -= unsmob_stencil (p->copyright_)->extent (Y_AXIS).length ();
+ if (unsmob_stencil (p->tagline_))
+ o[Y_AXIS] -= unsmob_stencil (p->tagline_)->extent (Y_AXIS).length ();
+ if (unsmob_stencil (p->footer_))
+ o[Y_AXIS] -= unsmob_stencil (p->footer_)->extent (Y_AXIS).length ();
+
+ if (unsmob_stencil (p->copyright_))
+ output_line (stencil2line (unsmob_stencil (p->copyright_)), &o,
+ is_last
+ && !unsmob_stencil (p->tagline_)
+ && !unsmob_stencil (p->footer_));
+ if (unsmob_stencil (p->tagline_))
+ output_line (stencil2line (unsmob_stencil (p->tagline_)), &o,
+ is_last && !unsmob_stencil (p->footer_));
+ if (unsmob_stencil (p->footer_))
+ output_line (stencil2line (unsmob_stencil (p->footer_)), &o, is_last);
+#endif
+
+ output_scheme (scm_list_2 (ly_symbol2scm ("stop-page"),
+ ly_bool2scm (is_last
+ && !unsmob_stencil (p->footer_))));
+}
+