• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ChordPro: {new_page} directive causes unwanted empty page
#1
In case a page is almost completely filled with chords and lyrics, adding a {new_page} directive adds not only the intended page break but also an additional unwanted empty page.

The following steps reproduce this behaviour on my 7.9'' tablet with a 1024 x 768 pixel 4:3 display.
It should be possible to reproduce the issue on any device.

I import the attached DerMondIstAufgegangen.pro

Text Display Settings > Auto-Size Font
proposes
Title Size: 47
Meta Size: 40
Lyric Size: 40
Chord Size: 40
The longest line
'der Wald steht schwarz und schweiget'
determines the value for Lyric Size as expected

With the new_page directive still commented out
#{new_page}
reducing size values to
Title Size: 35
Meta Size: 10
allows keeping
Lyric Size: 40
Chord Size: 40
and getting the desired page break with
'verschlafen und vergessen sollt!'
as the last line of page 1 and
'Seht ihr den Mond dort stehen?'
as the first line of page 2

As soon as I remove the # so that
{new_page}
becomes active the mentioned unwanted empty page 2 is created and
'Seht ihr den Mond dort stehen?'
is moved to page 3

It seems that {new_page} is considered to be the first line of page 2, leaves page 2 empty and creates the page break after page 2 instead of after page 1

reducing Lyric Size (keeping all other size values unchanged) until the empty page disappears ends up with
Lyric Size: 37

removing the { before new_page proves that the space required by the new_page directive is the cause of the issue,
new_page} is displayed as the last lyric line of page 1

Expected behaviour:
the line height of the {new_page} directive shall be assumed as =0 like line comments (lines starting with #) so that {new_page} does not need vertical space

Background
My second device has a 16:10 display. Sometimes I want to keep the same page breaks and rather accept unused empty space at the bottom of the page.


Attached Files Thumbnail(s)
       
first language: German
Acer A1-830, Android 4.4.2 - HP x2 210 G2 Detachable, Win 10 21H1
www.moonlightcrisis.de - www.basdjo.de - www.frankenbaend.de


Reply
#2
The way the code currently works, after processing a line, it makes sure that there is still enough room on the page for another line of lyrics/chords/etc. So when it reaches the end of the page, if there isn't room for anything, it proceeds to start processing the next page. If the {new_page} happens to be the first thing it processes after getting to the next page, then it will just generate a completely empty page and move on to the next page.

In order to accomodate what you are asking for, the easiest thing is probably just to remove the code that checks to see if another line can be added. Then the code will just process the next line normally, and if there isn't enough room for it, it will move it to the next page or column as needed. I've tested this change and it seems to work okay. I'm hoping it won't break anything that I haven't accounted for. If you would like to help test this to ensure this change doesn't negatively impact any of your songs, let me know.

Thanks,
Mike
Reply
#3
Thanks a lot.

Processing the line first and checking afterwards if the result still fits on the current page is definitely the better and more exact way to do it.

As soon as the fix is available I will look into it.
first language: German
Acer A1-830, Android 4.4.2 - HP x2 210 G2 Detachable, Win 10 21H1
www.moonlightcrisis.de - www.basdjo.de - www.frankenbaend.de


Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2022 MyBB Group.