• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ABC notation - Fit to page
#31
Hello again,

It did take quite some time to get it to a working state, but Jean-François Moine (Jef) added a working version of the fit2box module in abc2svg!

If you update abc2svg to the latest version in fossil, you should get it as well.
No implementation needed on your part, it should all be done in the module fit2box-1.js.

Adding a "%%fit2box * *" directive to the file will get the values of %%pagewidth and %%pageheight, and will produce a score that maximizes its size to fit in the box.

I include here a link to the discussion thread with Jef https://groups.io/g/abcusers/topic/pages...054?page=2
It might contain useful information for debugging if you run into issues while testing the feature, I had one where %%fit2box didn't work if the directive was stated before the %%pageheight directive, but I don't think you'll run into this issue as your setup is different.
Reply
#32
How the module works is:
  • a first music generation is made without measure stretching (to find out the real width of a line) and with a lower pagescale (to make sure no line breaks are inserted to split the lines)
  • it finds out from that first generation the width of the longest line and the height of the score
  • from the width and height, it calculates a pagescale that maximizes width and height to fit in the box
  • it inserts this new pagescale in the tune content and re-renders the tune

I'm explaining the workflow because I suppose it could interfere with what you're already injecting yourself into the file as I know you also modify pagescale.
Reply
#33
I've already integrated the latest changes for abc2svg (as of a couple weeks ago) for the next update, so this should all be available when I release that update. I haven't tested %%fit2box yet though, so I'll have to do that.

Mike
Reply
#34
If you integrated a couple weeks ago, you won't have the latest version of fit2box, that fixes a few issues, as I was suggesting changes while testing.

The latest commit for fit2box is May 25th.
https://chiselapp.com/user/moinejf/repos...018d3e17b9
Reply
#35
Don't update just yet, I think I've found another bug, there are some scenarios where it still cuts musical lines, I'm trying to debug and I'll report  to Jef.
Reply
#36
Ok, this should be good now. From my tests, I can't reproduce the latest issue anymore.
If you get a version after May 30th, you should have the working version.
https://chiselapp.com/user/moinejf/repos...64cba81299

Let me know when this is integrated.

If this works well in Mobilesheets, you could take advantage of it to easily implement a fit to screen feature for abc files.
Reply
#37
I've integrated the latest changes. I'll have to do some tests at some point to ensure the fit2box stuff works as expected though (as it may be fighting with the MobileSheets settings for margins and such).

Mike
Reply




Users browsing this thread:
3 Guest(s)


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