[Feature Request]: More flexible SVG snippet cropping

2017-07-25 Thread Étienne Beaulé
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é (Ebe123 )
beauleetien...@gmail.com

The original message is below:

-

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
's Score extension
). 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é (Ebe123 )
___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


[Feature Request]: More flexible SVG snippet cropping

2017-07-25 Thread Étienne Beaulé
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é (Ebe123 )
beauleetien...@gmail.com

The original message is below:

-

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
's Score extension
). 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é (Ebe123 )
___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: [PATCH] Some hooks useful for video production

2017-07-25 Thread James
Knut,

On Tue, 25 Jul 2017 09:40:51 +0200
Knut Petersen  wrote:

> Hi everybody!
> 
> The attached patch implements some hooks that would allow my video
> generation script to work without the requirement to patch some of
> lilyponds scm and ps files.
> 
> Knut

I did a cursory test of this patch and it works, I also see you have
write access to the Tracker so I wonder if you can upload this (git-cl
etc.) for a proper review?

James


___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: LilyDevOS, a LilyDev container + full VM image

2017-07-25 Thread Federico Bruni



Il giorno ven 21 lug 2017 alle 20:29, Paul  ha 
scritto:

On 07/17/2017 04:58 AM, Federico Bruni wrote:

A suggestion: it might be worth clarifying the steps for first setup 
vs repeat use of the container?  I think the main (only?) difference 
is that you don't need to run the setup script after you've already 
done it.




Ok, I've added a comment and a quick note on how to shutdown the 
container.





Also, the authentication in git-cl opens a web page in a browser so 
I'm not sure how that will work from the container?


w3m and elinks accept cookies by default, so login to google is easy 
and saved across different sessions.


I just need to check if the redirect from 
/get-access-token?port=8001 works.


I want to avoid installing a regular browser, as it would add some 
dependencies and increase the final size of the container.


Cool, glad there's a good solution for this.



Actually not.
It seems that git-cl relies on some server stuff redirect 
(http//localhost:8000/) which modern browsers support, but apparently 
not the text browsers. I've had no time to investigate.



BTW, let me know if the password is working. I'm not sure I've 
uploaded the correct version..


It wasn't working for me (e.g. when I tried to install guile-devel).


If it doesn't, use this command as root:

 echo 'dev:lilypond'|chpasswd


This fixed it for me.  And I was able to install guile-devel.  (GNU 
Guile 2.0.14)




It worked fine for me on a fresh build of the container.
I guess I uploaded some older version before the fix.
Next release will be ok.


Thanks again.  It's coming together well!




Thanks :-)




___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Change \note markup command to get a duration (issue 328050043 by d...@gnu.org)

2017-07-25 Thread dak

On 2017/07/25 10:03:08, thomasmorley651 wrote:

LGTM



Though, wouldn't the rest-markup-command needed to be changed

accordingly?

Needed?  No.  The note-markup-command did not need to be changed either.
 But rest-markup-command _wants_ to be changed accordingly of course.
You'll find that I haven't committed anything yet in spite of "Patch
push" since I don't want this in 2.20 and there hasn't been any
discussion of the underlying rather significant syntax addition for
markups which is rather different in spirit to music function argument
behavior.

Also there is no significant documentation or regtests.  This is more a
request for comments than anything else.

https://codereview.appspot.com/328050043/

___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: Change \note markup command to get a duration (issue 328050043 by d...@gnu.org)

2017-07-25 Thread thomasmorley65

LGTM

Though, wouldn't the rest-markup-command needed to be changed
accordingly?

https://codereview.appspot.com/328050043/

___
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel


[PATCH] Some hooks useful for video production

2017-07-25 Thread Knut Petersen

Hi everybody!

The attached patch implements some hooks that would allow my video generation
script to work without the requirement to patch some of lilyponds scm and ps 
files.

Knut
>From 230ad4aa3126562ab9ae87c891f7fe965c64a9de Mon Sep 17 00:00:00 2001
From: Knut Petersen 
Date: Tue, 25 Jul 2017 08:51:12 +0200
Subject: [PATCH] Implement some hooks useful for producing score videos

Producing ps or pdf documents intended to be used as
a source for video production requires some changes to
the output at a very late stage.

Often a page needs to repeated more than once with only
changes to some kind of progress bar / line or changes
to the color of a few grobs.

Parts of this postprocessing might be passed to postscript,
parts of this postprocessing might be done in the dump-page
procedure.

Therefore this patch provides a hook to write arbitrary
code to the prolog section of postscript output and a
hook to take over the dump-page process.

Using rgb values  < 0 and > 1 for grobs is an efficient
way to pass the information that, when and for how long
an object should change its color to a late state of
processing. Therefore a way to disable the range
check implemented in color? and to disable the precision
restriction in setrgbcolor is provided.

Signed-off-by: Knut Petersen 
---
 scm/framework-ps.scm| 52 +++--
 scm/lily.scm|  3 ++-
 scm/output-lib.scm  |  2 +-
 scm/output-ps.scm   |  4 +++-
 scm/videoextensions.scm | 38 
 5 files changed, 73 insertions(+), 26 deletions(-)
 create mode 100644 scm/videoextensions.scm

diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm
index 2cd9b5edc6..002b640189 100644
--- a/scm/framework-ps.scm
+++ b/scm/framework-ps.scm
@@ -109,29 +109,32 @@
(if (ly:get-option 'strokeadjust) "true setstrokeadjust\n" "")
))
 
-(define (dump-page outputter page page-number page-count landscape?)
-  (ly:outputter-dump-string
-   outputter
-   (string-append
-(format #f "%%Page: ~a ~a\n" page-number page-number)
-"%%BeginPageSetup\n"
-(if landscape?
-"page-width output-scale lily-output-units mul mul 0 translate 90 rotate\n"
-"")
-"%%EndPageSetup\n"
-"\n"
-"gsave 0 paper-height translate set-ps-scale-to-lily-scale\n"
-"/helpEmmentaler-Brace where {pop helpEmmentaler-Brace} if\n"
-"/helpEmmentaler-11 where {pop helpEmmentaler-11} if\n"
-"/helpEmmentaler-13 where {pop helpEmmentaler-13} if\n"
-"/helpEmmentaler-14 where {pop helpEmmentaler-14} if\n"
-"/helpEmmentaler-16 where {pop helpEmmentaler-16} if\n"
-"/helpEmmentaler-18 where {pop helpEmmentaler-18} if\n"
-"/helpEmmentaler-20 where {pop helpEmmentaler-20} if\n"
-"/helpEmmentaler-23 where {pop helpEmmentaler-23} if\n"
-"/helpEmmentaler-26 where {pop helpEmmentaler-26} if\n"))
-  (ly:outputter-dump-stencil outputter page)
-  (ly:outputter-dump-string outputter "stroke grestore\nshowpage\n"))
+(define-public (dump-page outputter page page-number page-count landscape?)
+  (if use-ps-dump-page-replacement?
+(ps-dump-page-replacement outputter page page-number page-count landscape?)
+(begin
+  (ly:outputter-dump-string
+   outputter
+   (string-append
+(format #f "%%Page: ~a ~a\n" page-number page-number)
+"%%BeginPageSetup\n"
+(if landscape?
+"page-width output-scale lily-output-units mul mul 0 translate 90 rotate\n"
+"")
+"%%EndPageSetup\n"
+"\n"
+"gsave 0 paper-height translate set-ps-scale-to-lily-scale\n"
+"/helpEmmentaler-Brace where {pop helpEmmentaler-Brace} if\n"
+"/helpEmmentaler-11 where {pop helpEmmentaler-11} if\n"
+"/helpEmmentaler-13 where {pop helpEmmentaler-13} if\n"
+"/helpEmmentaler-14 where {pop helpEmmentaler-14} if\n"
+"/helpEmmentaler-16 where {pop helpEmmentaler-16} if\n"
+"/helpEmmentaler-18 where {pop helpEmmentaler-18} if\n"
+"/helpEmmentaler-20 where {pop helpEmmentaler-20} if\n"
+"/helpEmmentaler-23 where {pop helpEmmentaler-23} if\n"
+"/helpEmmentaler-26 where {pop helpEmmentaler-26} if\n"))
+  (ly:outputter-dump-stencil outputter page)
+  (ly:outputter-dump-string outputter "stroke grestore\nshowpage\n"
 
 (define (supplies-or-needs paper load-fonts?)
   (define (extract-names font)
@@ -579,6 +582,9 @@
   ;; adobe note 5002: should initialize variables before loading routines.
   (display (procset "music-drawing-routines.ps") port)
   (display (procset "lilyponddefs.ps") port)
+  (display (string-append "%%BeginResource: procset (ps-user-prolog.ps) 1 0\n"
+  ps-user-prolog
+  "%%EndResource\n") port)
   (display "%%EndProlog\n" port)
   (display "%%BeginSetup\ninit-lilypond-parameters\n%%EndSetup\n\n" port))
 
diff --git a/scm/lily.scm