The following warnings occurred:
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.4.4 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/printthread.php(287) : eval()'d code 2 errorHandler->error_callback
/printthread.php 287 eval
/printthread.php 117 printthread_multipage



MobileSheets Forums
ABC notation - Fit to page - Printable Version

+- MobileSheets Forums (https://www.zubersoft.com/mobilesheets/forum)
+-- Forum: Support (https://www.zubersoft.com/mobilesheets/forum/forum-1.html)
+--- Forum: MobileSheets (Android) (https://www.zubersoft.com/mobilesheets/forum/forum-23.html)
+--- Thread: ABC notation - Fit to page (/thread-13117.html)

Pages: 1 2 3


RE: ABC notation - Fit to page - laurent - 05-27-2025

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/pagescale_auto/111991054?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.


RE: ABC notation - Fit to page - laurent - 05-27-2025

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.


RE: ABC notation - Fit to page - Zubersoft - 05-28-2025

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


RE: ABC notation - Fit to page - laurent - 05-28-2025

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/repository/abc2svg/info/c1fdec018d3e17b9


RE: ABC notation - Fit to page - laurent - 05-29-2025

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.


RE: ABC notation - Fit to page - laurent - 06-08-2025

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/repository/abc2svg/info/38dfd164cba81299

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.


RE: ABC notation - Fit to page - Zubersoft - 06-09-2025

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