lilypond-auto
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Lilypond-auto] [LilyIssues-auto] [testlilyissues:issues] #5165 [Feature


From: Auto mailings of changes to Lily Issues via Testlilyissues-auto
Subject: [Lilypond-auto] [LilyIssues-auto] [testlilyissues:issues] #5165 [Feature Request]: More flexible SVG snippet cropping
Date: Wed, 26 Jul 2017 14:58:02 +0000

Hello! I use lilypond quite often to illustrate and show snippets of music
on the web, both using lilypond-book and other tools (such as MediaWiki
https://www.mediawiki.org/wiki/MediaWiki's Score extension
https://www.mediawiki.org/wiki/Extension:Score). Looking at the process
for lilypond-book, I see that the snippets are in a .png format and are cropped
using "gs", not natively.

As a feature, my final objective would be the ability to typeset the
snippets into a vector format, as the resolution's better and it takes up
less space.

In order for the goal to be eventually reached, cropping would have to be
native to lilypond. Right now, there is no cropping for SVGs. Each
generated SVG is the size of the page, through the height, width, and
viewBox="0
0 119.5016 169.0094" attributes.

With individual snippets I've typeset into SVG, I've been taking the
bounding box and using that as the viewBox; modifying the snippets with
this js:

var svg = document.getElementsByTagName("svg")[0];
var box = svg.getBBox();
var viewBox = [box.x, box.y, box.width, box.height].join(" ");

console.log(svg.getAttribute(viewBox));
svg.setAttribute("viewBox", viewBox);
svg.removeAttribute("height");
svg.removeAttribute("width");
console.log(viewBox);

However, I don't think it's a very good solution; finding that such
functionality should be built-in to lilypond, and not require the use of
user _javascript_ (of which would be unusable anyway with img tags used with
PNGs.

In the MediaWiki extension, I've been trying to find a way, and the feature
request is being tracked: https://phabricator.wikimedia.org/T49578. Making
the extension output SVG is no problem (just change the backend on the
lilypond command), but cropping is. I believe that the Lilypond project
would be more suited to handle and incorporate this proposed feature, and
could potentially be useful when outputting PNG too. A flag could be added
to the command if cropping is desired.

Thank you for considering my feature request. This would not only help me,
but make Lilypond more flexible for typesetting music.

Cordially,

Étienne Beaulé


[issues:#5165] [Feature Request]: More flexible SVG snippet cropping

Status: New
Created: Wed Jul 26, 2017 02:56 PM UTC by pkx166h
Last Updated: Wed Jul 26, 2017 02:56 PM UTC
Owner: nobody

I might have posted my request to the wrong mailing list. The original
message is below, but is not quite relevant with some new developments.

I have found the -dpreview option, but has a big limitation as it only
outputs the first line.

Looking through the code, my feature seems like in between the two existing
methods dump-page and dump-preview, found in scm/framework-svg.scm. The
little stumbling block is how both methods are invoked
separately: output-framework or output-preview-framework, both supplying
different arguments, the main difference being "stensil" that is required
for calculating the viewbox, but is not in dump-page.

Would it be possible for the two methods to be merged, so that there's an
option for cropping on pages that are not just previews (and on multi-page
scores)? (Or if a third method could be made...)

If someone could add this feature, it would be very useful for my work, and
for Lilypond's prominence on Wikipedia.

Cordially,

Étienne Beaulé


Sent from sourceforge.net because address@hidden is subscribed to https://sourceforge.net/p/testlilyissues/issues/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/testlilyissues/admin/issues/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Testlilyissues-auto mailing list
address@hidden
https://lists.sourceforge.net/lists/listinfo/testlilyissues-auto

reply via email to

[Prev in Thread] Current Thread [Next in Thread]