Page MenuHomePhabricator

Score should output SVG
Open, Stalled, NormalPublic10 Story Points

Description

Svg output would be nice as it could solve all complaints about transparent background (bug T49444) and rendering size (bug T49523).

It's as easy as
lilypond ... -dbackend=svg ...
and it's _not_ using ghostscript, which is a fantastic step towards world peace.


Version: master
Severity: enhancement

Details

Reference
bz47578

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 1:32 AM
bzimport set Reference to bz47578.
grin created this task.Apr 23 2013, 10:14 PM

What about the current --png parameter?

		$cmd = wfEscapeShellArg( $wgScoreLilyPond )
			. ' ' . wfEscapeShellArg( '-dsafe=#t' )
			. ' -dbackend=ps --png --header=texidoc '
			. wfEscapeShellArg( $factoryLy )
			. ' 2>&1';

reedy@ubuntu64-web-esxi:~/git/mediawiki/core$ lilypond --h
Usage: lilypond [OPTION]... FILE...

Typeset music and/or produce MIDI from FILE.

LilyPond produces beautiful music notation.
For more information, see http://lilypond.org

Options:

-d, --define-default=SYM[=VAL]      set Scheme option SYM to VAL (default: #t).
                                      Use -dhelp for help.
-e, --evaluate=EXPR                 evaluate scheme code
-f, --formats=FORMATs               dump FORMAT,...  Also as separate options:
    --pdf                           generate PDF (default)
    --png                           generate PNG
    --ps                            generate PostScript
-h, --help                          show this help and exit
-H, --header=FIELD                  dump header field FIELD to file
                                      named BASENAME.FIELD
-I, --include=DIR                   add DIR to search path
-i, --init=FILE                     use FILE as init file
-j, --jail=USER, GROUP, JAIL, DIR   chroot to JAIL, become USER:GROUP
                                      and cd into DIR
-o, --output=FILE                   write output to FILE (suffix will be added)
    --relocate                      relocate using directory of lilypond program
-v, --version                       show version number and exit
-V, --verbose                       be verbose
-w, --warranty                      show warranty and copyright

Report bugs via http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs

Well we'll need PNG for old browsers anyway so this'll need some fallback behavior...

grin added a comment.Apr 23 2013, 11:57 PM

@Reedy: simply drop it. try: 'reedy$ lilypond -dsafe=#t -dbackend=svg --header=texidoc whatever.ly'

(btw I believe you can drop texidoc as well, it's only required for eps)

@brion: Indeed, that's the main reason I didn't propose code fragment right away.

brion added a comment.May 4 2013, 7:24 PM

Poking at this for a weekend quick hack project.

brion added a comment.May 4 2013, 7:56 PM

Did a quick test here: https://gerrit.wikimedia.org/r/#/c/62243/

It's not quite working, at least on my MacBook the SVG files come out corrupt.

brion added a comment.May 4 2013, 10:57 PM

Here's an alternate which allows for scaling up the PNG rendering for high-resolution, but doesn't do the fancy srcset stuff. This has the advantage of also looking cleaner in print, but may not scale down cleanly

https://gerrit.wikimedia.org/r/#/c/62313/

SVG makes more sense, given the suggestion that we transition quite a bit MW's front-end imagery to SVG for the HiDPI and zooming benefits, and the increasingly-widespread support for and higher-quality rendering of them.

brion added a comment.May 5 2013, 3:24 PM

Everybody seems to prefer the SVG idea, so I'll keep working on that. May require either patches to Lilypond or some file manipulation on our end to make things happy. :)

jgerber wrote:

https://gerrit.wikimedia.org/r/#/c/62243/ adds SVG support with png fallback, would be good to get it reviewed.

Change 62243 had a related patch set uploaded by Ebe123:
Optional SVG mode with PNG fallback

https://gerrit.wikimedia.org/r/62243

brion removed brion as the assignee of this task.Sep 2 2015, 8:04 PM

Removing assignment from some tasks I'm not actively working on. Volunteers welcome, I'm happy to help if pinged!

Restricted Application added subscribers: Matanya, Aklapper. · View Herald TranscriptSep 2 2015, 8:04 PM
Jdforrester-WMF moved this task from Untriaged to Backlog on the Multimedia board.Sep 4 2015, 6:39 PM
Gwendal added a subscriber: Gwendal.Dec 8 2015, 4:31 PM
Ebe123 claimed this task.Jul 19 2017, 8:21 PM
Ebe123 updated the task description. (Show Details)

Trying some things out. Unfortunately, Lilypond's cropping method is also through the use of another program, as seen in lilypond-book. Trying the two methods for a PNG fallback: converting the svg into png, or typesetting the lilypond twice, there are some problems.

To typeset Lilypond into SVG, I am using this command:

lilypond -dbackend=svg --header=texidoc -dno-point-and-click [file] 2>&1

The command works. However, ImageMagick garbles up the generated png (using the same command as currently used to trim). Using an example:

becomes

Furthermore, trimming the SVG file can't be done in ImageMagick, as it's a raster image processor. As a remedy, this JS could be used:

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

But I find it odd to package javascript in all the svg files, and set sizes by that. Using both methods seems like an "in the interim" fix. Any ideas?

Ebe123 added a comment.EditedJul 22 2017, 12:38 AM

Sent a upstream email to Lilypond requesting cropping functionality (or an alternate solution...): http://lists.gnu.org/archive/html/bug-lilypond/2017-07/msg00010.html and is being tracked upstream: https://sourceforge.net/p/testlilyissues/issues/5165/

Change 370209 had a related patch set uploaded (by Ebe123; owner: Ebe123):
[mediawiki/extensions/Score@master] Output SVG in scores

https://gerrit.wikimedia.org/r/370209

Ebe123 changed the task status from Open to Stalled.Aug 4 2017, 11:39 PM
Ebe123 set the point value for this task to 10.

A caveat that may prove important is the treatment of text (like in tempo markings) in SVG. There are some outstanding bugs, such as issue 5174 and issue 3778 (each of them relating to text handling, specifically in tempo markings) that make SVG output less good, although it's very minor.

Further on text, the conversion, using MediaWiki's rasterizer leaves us with the problem described in T36947: Incorrect text positioning in SVG rasterization (scale/transform; font-size; kerning).

Ebe123 moved this task from Backlog to Patch merged upstream on the Upstream board.Dec 9 2017, 6:06 PM
IZoid closed this task as Resolved.Dec 9 2017, 6:26 PM
IZoid raised the priority of this task from Normal to High.
IZoid added parent tasks: T1: Get puppet runs into logstash, T38: Migrate RT to Phabricator, T7: Get icinga alerts into logstash, T110: Let users configure date format in account settings, T125: Allow viewing diffs of single commits within a Differential, T136: Pulling patches from Phabricator does not give consistent commit hashes, T141: Fork ChemDoodle Web components, improve code readablility, T207: Update Code Review related documentation on wiki pages from Gerrit to Differential, T261: Metadata fields for SMILES and InChI, T329: Use EventEmitter in Flow, T351: RfC: Square bounding boxes, T352: Run the requested stats on Square bounding boxes, T353: RFC: Vertical writing support, T356: RfC: Standardized thumbnails sizes, T359: Document the Wikidata API in the Developer Hub, T409: Editing files and contributing changes via web, T468: RfC: CentralNotice backend improvements, T500: Create basic endpoint for JS error logging, T514: Collect environment information for JS error logging, T519: Improve error id generation in JS error logging, T522: Add JS error counts to graphite, T523: Deduplicate JS error logs, T542: Improvements to Wikimedia SUL login dialog UI: Avoid HTML entities, spell "MediaWiki" account type with upper case, T555: Per-user projects for personal work in progress tracking, T623: OAuth login refers to mediawiki.org:/ instead of mediawiki.org/ (exposing unneeded port syntax), T653: Refresh the mediawiki.org homepage, T706: Requests for addition to the #acl*Project-Admins group (in comments), T715: GitHub -> Phabricator import system, T877: Add IRC name and MediaWiki Username as alternate auto-complete lookups, T882: Converted bugs could link to the original report in static-bugzilla.wikimedia.org, T949: update make-release to refuse to work if tag != $wgVersion, T1012: Add i18n for Spanish, T1032: Contact softaculous.com, T1124: Write design document for content/storage APIs, T1126: Mobile friendly OAuth permission screen when logging in to Phabricator, T1175: Get rid of screen scraping in Wikibugs, T1287: Define the architecture areas for MediaWiki core and platform extensions, T1380: Nature.com articles gives citoid 401s., T1384: Capture Javascript support level for web users, T2166: Identify redirects with CSS class *everywhere*, T2209: [DO NOT USE] HTML validity (tracking), T2235: Auto unit conversion, T2576: [OAI-PMH] Open Archives Initiative Protocol for Metadata Harvesting (tracking), T2851: when viewing an old version of a page, use old version of templates, T2980: Automatical merge of conflicting non-section edits to unintersecting sets of sections, T3007: Cartouche ends do not scale to fit the enclosed hieroglyphs, T3310: Recursive tags in extensions., T3316: Allow image thumb output format to be specified, T3340: Size thumbnails in galleries according to user preferences, T3433: Add metainformation for interlanguage links (link rel="alternate" hreflang), T182148: Weird FK constraint problems in Civi, T3575: #REDIRECT with transcluded string does not redirect, T3581: pre over multiple lines in lists, T14156: FEATURE REQUEST: Per Entry Question/FAQ/Want-to-Know so readers could ask/influence contributors, T14191: Show links to intermediate revisions rather than "(One intermediate revision not shown.)", T14341: Warning for truncation of pages to 32kb, T14490: Warning needed if dimensions of reupload differ, T182151: inform national WLE/WLAf organizers about dashboard proposal, T14535: all inter project prefixes should be resolved before « oldid= », T14610: generalize function switchPrefTab() (previously tabbedprefs()), T14653: Honour protection status in Special:Import, T14681: New messages bar should appear above page title, for consistency with other message boxes, T14804: Image missing all revisions, T14874: batch deletion for file histories, T19143: Introduce magic word that restricts certain categories (and their sub-categories) to the article namespace., T19131: Feature Request: Transclusion Preprocessing Hook, T19125: Correct rendering of ViewAPC for non-latin characters, T19090: Site notice has layout problem with links in the upper edge., T17212: Allow self-renames, T17159: Turn wikilinks different colors depending on a page's presence on this wiki AND another specified wiki (e.g. Wikipedia), T17075: Per book, category and/or template CSS and JavaScript, T17074: List, count and search all books, T17060: Make non-sensitive browser referrers available through Wikistats, T16892: Linkify plain external links in revision editsummary and log reason, T16880: Preset Special:CategoryTree input with main category., T16843: RCFeed: Send boolean flag indicating that target page is a redirect, T16720: robots.txt (tracking), T16688: User isn't allowed to upload, but there is no permission error, T16611: Special:Version should show all third party software which it depends on, T16591: Special:Linksearch should be case insensitive, T16530: Classic edit toolbar should be more accessible for change and modification, T16501: A way to hide the sidebar providing a "fullscreen" view, T16417: Generate upload log entry when duplicate file uploaded, T16281: Rename "Bad image list" to something better, T16215: Allow definition to be used as a link target, T16171: Allow Special:FileDuplicateSearch to match against previously deleted images, T15955: Include HTML meta tags for pages' Atom/RSS feeds in article view mode, T15951: Provide all URL parameters for all RSS/Atom feeds consistently, T15765: more "jump to" accessibility links needed, T15588: Track link changes, T15466: Design of diffs should be improved to indicate white space changes better, T15303: Implement HTML e-mail support in MediaWiki, T15170: Namespace-based category specification, T15090: Add magic word to generate combined-TOC from a set of pages, T15038: Top edge of image clobbers text, T15025: New parser function / magic word, for "pretty-printed" numbers, T15698: (top) in watchlists, T182152: Get more connections for instagram account Wiki Loves Monuments, T14942: Uncategorized categories/pages/templates/files refactoring, T14896: Spam Blacklist shouldn't be fooled by similar-looking Unicode characters.Dec 9 2017, 6:34 PM
IZoid added parent tasks: T1: Get puppet runs into logstash, T38: Migrate RT to Phabricator, T7: Get icinga alerts into logstash, T110: Let users configure date format in account settings, T125: Allow viewing diffs of single commits within a Differential, T136: Pulling patches from Phabricator does not give consistent commit hashes, T141: Fork ChemDoodle Web components, improve code readablility, T207: Update Code Review related documentation on wiki pages from Gerrit to Differential, T261: Metadata fields for SMILES and InChI, T329: Use EventEmitter in Flow, T351: RfC: Square bounding boxes, T352: Run the requested stats on Square bounding boxes, T353: RFC: Vertical writing support, T356: RfC: Standardized thumbnails sizes, T359: Document the Wikidata API in the Developer Hub, T409: Editing files and contributing changes via web, T468: RfC: CentralNotice backend improvements, T500: Create basic endpoint for JS error logging, T514: Collect environment information for JS error logging, T519: Improve error id generation in JS error logging, T522: Add JS error counts to graphite, T523: Deduplicate JS error logs, T542: Improvements to Wikimedia SUL login dialog UI: Avoid HTML entities, spell "MediaWiki" account type with upper case, T555: Per-user projects for personal work in progress tracking, T623: OAuth login refers to mediawiki.org:/ instead of mediawiki.org/ (exposing unneeded port syntax), T653: Refresh the mediawiki.org homepage, T706: Requests for addition to the #acl*Project-Admins group (in comments), T715: GitHub -> Phabricator import system, T877: Add IRC name and MediaWiki Username as alternate auto-complete lookups, T882: Converted bugs could link to the original report in static-bugzilla.wikimedia.org, T949: update make-release to refuse to work if tag != $wgVersion, T1012: Add i18n for Spanish, T1032: Contact softaculous.com, T1124: Write design document for content/storage APIs, T1126: Mobile friendly OAuth permission screen when logging in to Phabricator, T1175: Get rid of screen scraping in Wikibugs, T1287: Define the architecture areas for MediaWiki core and platform extensions, T1380: Nature.com articles gives citoid 401s., T1384: Capture Javascript support level for web users, T2166: Identify redirects with CSS class *everywhere*, T2209: [DO NOT USE] HTML validity (tracking), T2235: Auto unit conversion, T2576: [OAI-PMH] Open Archives Initiative Protocol for Metadata Harvesting (tracking), T2851: when viewing an old version of a page, use old version of templates, T2980: Automatical merge of conflicting non-section edits to unintersecting sets of sections, T3007: Cartouche ends do not scale to fit the enclosed hieroglyphs, T3310: Recursive tags in extensions., T3316: Allow image thumb output format to be specified, T3340: Size thumbnails in galleries according to user preferences, T3433: Add metainformation for interlanguage links (link rel="alternate" hreflang), T182148: Weird FK constraint problems in Civi, T3575: #REDIRECT with transcluded string does not redirect, T3581: pre over multiple lines in lists, T14156: FEATURE REQUEST: Per Entry Question/FAQ/Want-to-Know so readers could ask/influence contributors, T14191: Show links to intermediate revisions rather than "(One intermediate revision not shown.)", T14341: Warning for truncation of pages to 32kb, T14490: Warning needed if dimensions of reupload differ, T182151: inform national WLE/WLAf organizers about dashboard proposal, T14535: all inter project prefixes should be resolved before « oldid= », T14610: generalize function switchPrefTab() (previously tabbedprefs()), T14653: Honour protection status in Special:Import, T14681: New messages bar should appear above page title, for consistency with other message boxes, T14804: Image missing all revisions, T14874: batch deletion for file histories, T19143: Introduce magic word that restricts certain categories (and their sub-categories) to the article namespace., T19131: Feature Request: Transclusion Preprocessing Hook, T19125: Correct rendering of ViewAPC for non-latin characters, T19090: Site notice has layout problem with links in the upper edge., T17212: Allow self-renames, T17159: Turn wikilinks different colors depending on a page's presence on this wiki AND another specified wiki (e.g. Wikipedia), T17075: Per book, category and/or template CSS and JavaScript, T17074: List, count and search all books, T17060: Make non-sensitive browser referrers available through Wikistats, T16892: Linkify plain external links in revision editsummary and log reason, T16880: Preset Special:CategoryTree input with main category., T16843: RCFeed: Send boolean flag indicating that target page is a redirect, T16720: robots.txt (tracking), T16688: User isn't allowed to upload, but there is no permission error, T16611: Special:Version should show all third party software which it depends on, T16591: Special:Linksearch should be case insensitive, T16530: Classic edit toolbar should be more accessible for change and modification, T16501: A way to hide the sidebar providing a "fullscreen" view, T16417: Generate upload log entry when duplicate file uploaded, T16281: Rename "Bad image list" to something better, T16215: Allow definition to be used as a link target, T16171: Allow Special:FileDuplicateSearch to match against previously deleted images, T15955: Include HTML meta tags for pages' Atom/RSS feeds in article view mode, T15951: Provide all URL parameters for all RSS/Atom feeds consistently, T15765: more "jump to" accessibility links needed, T15588: Track link changes, T15466: Design of diffs should be improved to indicate white space changes better, T15303: Implement HTML e-mail support in MediaWiki, T15170: Namespace-based category specification, T15090: Add magic word to generate combined-TOC from a set of pages, T15038: Top edge of image clobbers text, T15025: New parser function / magic word, for "pretty-printed" numbers, T15698: (top) in watchlists, T182152: Get more connections for instagram account Wiki Loves Monuments, T14942: Uncategorized categories/pages/templates/files refactoring, T14896: Spam Blacklist shouldn't be fooled by similar-looking Unicode characters.
Ebe123 added a comment.Dec 9 2017, 6:35 PM

Eh, no. We still must wait for it to be released in their 2.20 (or 2.22 if
there's bad luck) stable, and still have to implement it in the MediaWiki-extensions-Score
extension. Re-opening.

Ebe123 reopened this task as Open.Dec 9 2017, 6:37 PM
Ebe123 removed parent tasks: T14896: Spam Blacklist shouldn't be fooled by similar-looking Unicode characters, T14942: Uncategorized categories/pages/templates/files refactoring, T182152: Get more connections for instagram account Wiki Loves Monuments, T15698: (top) in watchlists, T15025: New parser function / magic word, for "pretty-printed" numbers, T15038: Top edge of image clobbers text, T15090: Add magic word to generate combined-TOC from a set of pages, T15170: Namespace-based category specification, T15303: Implement HTML e-mail support in MediaWiki, T15466: Design of diffs should be improved to indicate white space changes better, T15588: Track link changes, T15765: more "jump to" accessibility links needed, T15951: Provide all URL parameters for all RSS/Atom feeds consistently, T15955: Include HTML meta tags for pages' Atom/RSS feeds in article view mode, T16171: Allow Special:FileDuplicateSearch to match against previously deleted images, T16215: Allow definition to be used as a link target, T16281: Rename "Bad image list" to something better, T16417: Generate upload log entry when duplicate file uploaded, T16501: A way to hide the sidebar providing a "fullscreen" view, T16530: Classic edit toolbar should be more accessible for change and modification, T16591: Special:Linksearch should be case insensitive, T16611: Special:Version should show all third party software which it depends on, T16688: User isn't allowed to upload, but there is no permission error, T16720: robots.txt (tracking), T16843: RCFeed: Send boolean flag indicating that target page is a redirect, T16880: Preset Special:CategoryTree input with main category., T16892: Linkify plain external links in revision editsummary and log reason, T17060: Make non-sensitive browser referrers available through Wikistats, T17074: List, count and search all books, T17075: Per book, category and/or template CSS and JavaScript, T17159: Turn wikilinks different colors depending on a page's presence on this wiki AND another specified wiki (e.g. Wikipedia), T17212: Allow self-renames, T19090: Site notice has layout problem with links in the upper edge., T19125: Correct rendering of ViewAPC for non-latin characters, T19131: Feature Request: Transclusion Preprocessing Hook, T19143: Introduce magic word that restricts certain categories (and their sub-categories) to the article namespace., T14874: batch deletion for file histories, T14804: Image missing all revisions, T14681: New messages bar should appear above page title, for consistency with other message boxes, T14653: Honour protection status in Special:Import, T14610: generalize function switchPrefTab() (previously tabbedprefs()), T14535: all inter project prefixes should be resolved before « oldid= », T182151: inform national WLE/WLAf organizers about dashboard proposal, T14490: Warning needed if dimensions of reupload differ, T14341: Warning for truncation of pages to 32kb, T14191: Show links to intermediate revisions rather than "(One intermediate revision not shown.)", T14156: FEATURE REQUEST: Per Entry Question/FAQ/Want-to-Know so readers could ask/influence contributors, T3581: pre over multiple lines in lists, T3575: #REDIRECT with transcluded string does not redirect, T182148: Weird FK constraint problems in Civi, T3433: Add metainformation for interlanguage links (link rel="alternate" hreflang), T3340: Size thumbnails in galleries according to user preferences, T3316: Allow image thumb output format to be specified, T3310: Recursive tags in extensions., T3007: Cartouche ends do not scale to fit the enclosed hieroglyphs, T2980: Automatical merge of conflicting non-section edits to unintersecting sets of sections, T2851: when viewing an old version of a page, use old version of templates, T2576: [OAI-PMH] Open Archives Initiative Protocol for Metadata Harvesting (tracking), T2235: Auto unit conversion, T2209: [DO NOT USE] HTML validity (tracking), T2166: Identify redirects with CSS class *everywhere*, T1384: Capture Javascript support level for web users, T1380: Nature.com articles gives citoid 401s., T1287: Define the architecture areas for MediaWiki core and platform extensions, T1175: Get rid of screen scraping in Wikibugs, T1126: Mobile friendly OAuth permission screen when logging in to Phabricator, T1124: Write design document for content/storage APIs, T1032: Contact softaculous.com, T1012: Add i18n for Spanish, T949: update make-release to refuse to work if tag != $wgVersion, T882: Converted bugs could link to the original report in static-bugzilla.wikimedia.org, T877: Add IRC name and MediaWiki Username as alternate auto-complete lookups, T715: GitHub -> Phabricator import system, T706: Requests for addition to the #acl*Project-Admins group (in comments), T653: Refresh the mediawiki.org homepage, T623: OAuth login refers to mediawiki.org:/ instead of mediawiki.org/ (exposing unneeded port syntax), T555: Per-user projects for personal work in progress tracking, T542: Improvements to Wikimedia SUL login dialog UI: Avoid HTML entities, spell "MediaWiki" account type with upper case, T523: Deduplicate JS error logs, T522: Add JS error counts to graphite, T519: Improve error id generation in JS error logging, T514: Collect environment information for JS error logging, T500: Create basic endpoint for JS error logging, T468: RfC: CentralNotice backend improvements, T409: Editing files and contributing changes via web, T359: Document the Wikidata API in the Developer Hub, T356: RfC: Standardized thumbnails sizes, T353: RFC: Vertical writing support, T352: Run the requested stats on Square bounding boxes, T351: RfC: Square bounding boxes, T329: Use EventEmitter in Flow, T261: Metadata fields for SMILES and InChI, T207: Update Code Review related documentation on wiki pages from Gerrit to Differential, T141: Fork ChemDoodle Web components, improve code readablility, T136: Pulling patches from Phabricator does not give consistent commit hashes, T125: Allow viewing diffs of single commits within a Differential, T110: Let users configure date format in account settings, T7: Get icinga alerts into logstash, T38: Migrate RT to Phabricator, T1: Get puppet runs into logstash.
Aklapper lowered the priority of this task from High to Normal.Dec 9 2017, 6:38 PM
Ebe123 changed the task status from Open to Stalled.Dec 22 2017, 8:06 PM

The new -dcrop option will be in the next stable release (2.20), which may be in the next few months.

After this blocker, there is also the problem with librsvg, which renders text in SVG scores very badly. As an example:


Updating librsvg is another block here, notwithstanding further text improvements needed in lilypond, such as with skylines, but that is much less severe.