Re: ly:one-page-breaking (was: ly:one-line-breaking)

2016-01-19 Thread Richard Shann
On Mon, 2016-01-18 at 22:51 -0500, Paul Morris wrote:
> > On Jan 9, 2016, at 1:30 PM, Richard Shann  wrote:
> > 
> > I was wondering if it would be possible to develop a variant of "all on
> > one line", namely "all on one page", where the page height would be
> > automatically adjusted to fit the music, leaving the width as set.
> 
> I’m glad to report that I’ve made some real progress.  

> The code in the attached patch delivers the basic functionality, with a few 
> "known issues".  

> Namely the tagline and any footnotes are not included, 

> and bookparts trigger default page breaking for some reason. 

>  I haven’t tested it extensively but titles (etc.), top level markups, 
> multiple scores, 

> all seem to work just fine.

That's great news! For the application to Denemo taglines and footnotes
are not wanted anyway as it is for creating a score to play from
on-screen.
 I guess it will be some time before this code gets into a release?



> The approach is to temporarily set the page-height to the largest size 
> possible, 

What is the largest size possible? I tried playing around with some
sizes, and some didn't work ...



> do the line breaking and page layout for that page height, then get the 
> vertical position on the page and the height of the lowest system (or top 
> level markup), and use that to calculate and then set the final page height 
> so that it fits the content of the page.

A crude version of this is what will be in the impending Denemo release
- Denemo creates the SVG output and counts the pages and then re-runs
LilyPond at a larger page size.

Richard





___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: ly:one-page-breaking (was: ly:one-line-breaking)

2016-01-19 Thread Paul Morris
> On Jan 19, 2016, at 4:02 AM, Richard Shann  wrote:
> 
> That's great news! For the application to Denemo taglines and footnotes
> are not wanted anyway as it is for creating a score to play from
> on-screen.
> I guess it will be some time before this code gets into a release?

It depends on whether or not this is acceptable with the current known issues.  
(Some other pressing demands mean that I need to take a break from LilyPond 
work for some months, so I won’t have time to further improve upon this any 
time soon.)  In its current state it would already work for many of the more 
obvious use cases – like Denemo’s on-screen score or producing image files 
destined for other documents.

Should I put this up for code review or should we discuss this on the dev list? 
 …or in an issue tracker?


>> The approach is to temporarily set the page-height to the largest size 
>> possible, 
> 
> What is the largest size possible? I tried playing around with some
> sizes, and some didn't work …

I tried setting it to positive infinity, but that gave a programming error when 
there was a tagline.  I traced the error to Stencil::translate, which throws 
the error for any value greater than 1e6.  So I used 1e6 as the temporary 
page-height and everything is working fine.


>> do the line breaking and page layout for that page height, then get the 
>> vertical position on the page and the height of the lowest system (or top 
>> level markup), and use that to calculate and then set the final page height 
>> so that it fits the content of the page.
> 
> A crude version of this is what will be in the impending Denemo release
> - Denemo creates the SVG output and counts the pages and then re-runs
> LilyPond at a larger page size.

I think that should work pretty well for your use case.  I considered a similar 
approach before I worked out the current one.

-Paul



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


ly:one-page-breaking (was: ly:one-line-breaking)

2016-01-18 Thread Paul Morris
> On Jan 9, 2016, at 1:30 PM, Richard Shann  wrote:
> 
> I was wondering if it would be possible to develop a variant of "all on
> one line", namely "all on one page", where the page height would be
> automatically adjusted to fit the music, leaving the width as set.

I’m glad to report that I’ve made some real progress.  The code in the attached 
patch delivers the basic functionality, with a few "known issues".  Namely the 
tagline and any footnotes are not included, and bookparts trigger default page 
breaking for some reason.  I haven’t tested it extensively but titles (etc.), 
top level markups, multiple scores, all seem to work just fine.

The approach is to temporarily set the page-height to the largest size 
possible, do the line breaking and page layout for that page height, then get 
the vertical position on the page and the height of the lowest system (or top 
level markup), and use that to calculate and then set the final page height so 
that it fits the content of the page.

(Also, I now see how to improve the ly:one-line-auto-height code to avoid some 
of the unintuitive results related to bottom-margin and top-system-spacing.  So 
a new patch set for that is on the way, when I can get to it...)

-Paul


%%% TEST SNIPPET %%%

\version "2.19.36"

\paper {
  % system-system-spacing.basic-distance = #0
  page-breaking = #ly:one-page-breaking
  % ragged-bottom = ##t
  % top-margin = 0
  % bottom-margin = 0
  % system-system-spacing.minimum-distance = #0
  % system-system-spacing.padding = #0
}

\header {
  % title = "a title”
  % tagline = ""
}

% \markup \large "top level markup"

\repeat unfold 100 { c’4 d' e' f’ }

\repeat unfold 10 { g'1 }

{ c,1 }

% \markup \large “another top level markup"

%




one-page-breaking-1-18-2016.patch
Description: Binary data


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


ly:one-page-breaking (was: ly:one-line-breaking)

2016-01-18 Thread Paul Morris
> On Jan 9, 2016, at 1:30 PM, Richard Shann  wrote:
> 
> I was wondering if it would be possible to develop a variant of "all on
> one line", namely "all on one page", where the page height would be
> automatically adjusted to fit the music, leaving the width as set.

I’m glad to report that I’ve made some real progress.  The code in the attached 
patch delivers the basic functionality, with a few "known issues".  Namely the 
tagline and any footnotes are not included, and bookparts trigger default page 
breaking for some reason.  I haven’t tested it extensively but titles (etc.), 
top level markups, multiple scores, all seem to work just fine.

The approach is to temporarily set the page-height to the largest size 
possible, do the line breaking and page layout for that page height, then get 
the vertical position on the page and the height of the lowest system (or top 
level markup), and use that to calculate and then set the final page height so 
that it fits the content of the page.

-Paul


%%% TEST SNIPPET %%%

\version "2.19.36"

\paper {
 % system-system-spacing.basic-distance = #0
 page-breaking = #ly:one-page-breaking
 % ragged-bottom = ##t
 % top-margin = 0
 % bottom-margin = 0
 % system-system-spacing.minimum-distance = #0
 % system-system-spacing.padding = #0
}

\header {
 % title = "a title”
 % tagline = ""
}

% \markup \large "top level markup"

\repeat unfold 100 { c’4 d' e' f’ }

\repeat unfold 10 { g'1 }

{ c,1 }

% \markup \large “another top level markup"

%




one-page-breaking-1-18-2016.patch
Description: Binary data


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user