X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finclude%2Fpage-spacing.hh;h=bf8a7e1826c3f8a3e2e06f9b2d27874a7fbf1650;hb=794dcbdb52faf4292036cd1b0270a956cf4316a3;hp=846fe1be3e12043f86db917733283eb0eacd345b;hpb=62f221b6b3861ff055dc0384ec3c48cc665688cd;p=lilypond.git diff --git a/lily/include/page-spacing.hh b/lily/include/page-spacing.hh index 846fe1be3e..bf8a7e1826 100644 --- a/lily/include/page-spacing.hh +++ b/lily/include/page-spacing.hh @@ -4,7 +4,7 @@ source file of the GNU LilyPond music typesetter - (c) 2006--2008 Joe Neeman + (c) 2006--2009 Joe Neeman */ #ifndef PAGE_SPACING_HH @@ -13,6 +13,26 @@ #include "constrained-breaking.hh" #include "page-spacing-result.hh" +/* This is a penalty that we add whenever a page breaking solution + is not bad enough to completely discard, but bad enough that + it is worse than any "proper" solution. For example, if we didn't + manage to fit systems on the desired number of pages or if there was + too big for a page. + + This constant is large enough that it dominates any reasonable penalty, + but small enough that nothing will overflow to infinity (so that we + can still distinguish bad spacings by the number of BAD_SPACING_PENALTYs + that they incur. + + BAD_SPACING_PENALTY is for occasions where the spacing is bad. + TERRIBLE_SPACING_PENALTY is for when we are disregarding a user override + (for example, we are failing to satisfy min-systems-per-page). These user + overrides are more important than getting good spacing, so they get a + larger penalty. +*/ +const Real BAD_SPACING_PENALTY = 1e6; +const Real TERRIBLE_SPACING_PENALTY = 1e8; + /* for page_count > 2, we use a dynamic algorithm similar to constrained-breaking -- we have a class that stores the intermediate @@ -33,12 +53,14 @@ private: force_ = infinity_f; penalty_ = infinity_f; prev_ = VPOS; + system_count_status_ = SYSTEM_COUNT_OK; } Real demerits_; Real force_; Real penalty_; vsize prev_; + int system_count_status_; }; Page_breaking const *breaker_; @@ -61,15 +83,15 @@ struct Page_spacing Real rod_height_; Real spring_len_; Real inverse_spring_k_; - Real page_top_space_; Line_details last_line_; Line_details first_line_; + Page_breaking const *breaker_; - Page_spacing (Real page_height, Real page_top_space) + Page_spacing (Real page_height, Page_breaking const *breaker) { page_height_ = page_height; - page_top_space_ = page_top_space; + breaker_ = breaker; clear (); }