]> git.donarmstrong.com Git - lilypond.git/blob - lily/page-breaking-scheme.cc
8f66a576771425dad896b88be98a43b38bf738e9
[lilypond.git] / lily / page-breaking-scheme.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2006--2014 Joe Neeman <joeneeman@gmail.com>
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "paper-book.hh"
21 #include "page-turn-page-breaking.hh"
22 #include "one-line-page-breaking.hh"
23 #include "optimal-page-breaking.hh"
24 #include "minimal-page-breaking.hh"
25
26 LY_DEFINE (ly_page_turn_breaking, "ly:page-turn-breaking",
27            1, 0, 0, (SCM pb),
28            "Optimally break (pages and lines) the @code{Paper_book} object"
29            " @var{pb} such that page turns only happen in specified places,"
30            " returning its pages.")
31 {
32   Page_turn_page_breaking b (unsmob_paper_book (pb));
33   return b.solve ();
34 }
35
36 LY_DEFINE (ly_optimal_breaking, "ly:optimal-breaking",
37            1, 0, 0, (SCM pb),
38            "Optimally break (pages and lines) the @code{Paper_book} object"
39            " @var{pb} to minimize badness in bother vertical and horizontal"
40            " spacing.")
41 {
42   Optimal_page_breaking b (unsmob_paper_book (pb));
43   return b.solve ();
44 }
45
46 LY_DEFINE (ly_minimal_breaking, "ly:minimal-breaking",
47            1, 0, 0, (SCM pb),
48            "Break (pages and lines) the @code{Paper_book} object @var{pb}"
49            " without looking for optimal spacing: stack as many lines on"
50            " a page before moving to the next one.")
51 {
52   Minimal_page_breaking b (unsmob_paper_book (pb));
53   return b.solve ();
54 }
55
56 LY_DEFINE (ly_one_line_breaking, "ly:one-line-breaking",
57            1, 0, 0, (SCM pb),
58            "Put each score on a single line, and put each line on its own"
59            " page.  The paper-width setting will be modified so that"
60            " every page will be wider than the widest line.")
61 {
62   One_line_page_breaking b (unsmob_paper_book (pb));
63   return b.solve ();
64 }