lilypond-user
[Top][All Lists]
Advanced

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

Re: Why does -dbackend=svg -dcrop remove system-system-spacing?


From: Trevor Bača
Subject: Re: Why does -dbackend=svg -dcrop remove system-system-spacing?
Date: Tue, 12 Jan 2021 08:40:37 -0500



On Fri, Jan 8, 2021 at 6:02 PM David Wright <lilylis@lionunicorn.co.uk> wrote:
On Thu 07 Jan 2021 at 19:57:12 (-0500), Trevor Bača wrote:
> On Wed, Jan 6, 2021 at 2:29 PM David Wright wrote:
> > On Wed 06 Jan 2021 at 11:34:24 (-0500), Trevor Bača wrote:
> > > On Tue, Jan 5, 2021 at 11:31 PM David Wright wrote:
> > > > On Tue 05 Jan 2021 at 19:05:30 (-0500), Trevor Bača wrote:
> > > > > I love the functionality for cropped SVGs! (Added back in 2019, or
> > > > > around then?)
> > > > >
> > > > > Question: it appears that cropped multisystem SVGs remove all
> > > > > whitespace between systems. Is this supposed to happen?
> > > >
> > > > I think that removing all the margins is the functionality "crop" is
> > > > supposed to add to LP. To generate the equivalent cropped and packed
> > > > image without this facility would be quite tedious to do (unless
> > > > someone has a trick for doing it?).
> > > >
> > > > > %%% BEGIN %%%
> > > > > […]
> > > > > %%% END %%%
> > > > >
> > > > > Called with ...
> > > > >    lilypond -dbackend=svg -dcrop test.ly
> > > > > ... produces test.cropped.svg as attached here.
> > > > >
> > > > > Screenshot:
> > > > > […]
> > > > >
> > > > > Seems like cropping should be around the edges of the image (rather
> > > > > than between systems)?
> > > >
> > > > If you just want to crop the whole page image, you can do that easily
> > > > at the end of a normal run with the usual utilities. If you require
> > > > LP to set the entire score on a single page, just use a very long
> > > > custom page (as in NR §4.1.2: width, then length).
> > >
> > > I'm sorry; I don't understand.
> > >
> > > What I want Lily to do: remove whitespace from the *edges* of an SVG.
> >
> > As I said, you run LP as normal, and then trim to taste. So, taking
> > your example, I ran it with
> > $ lilypond-2.21.80-1.linux-64/bin/lilypond --svg -dno-point-and-click
> > Bača.ly
> > and then edited the first line of Bača.svg, resulting in Bača-trimmed.svg.
> > The end of the first line is modified from
> >  width="210.00mm" height="297.00mm" viewBox="0 0 119.5016 169.0094">
> > to
> >  width="192.00mm" height="297.00mm" viewBox="4.5 0 109.5016 169.0094">
> > which I did by inspection. As you use SVG files in your workflow,
> > I assume you can carry this out more easily and precisely¹ with some
> > particular tool. (I'm PDF-centric myself.) I only considered X because
> > I was inspecting the file on a landscape screen (and you didn't remove
> > the tagline anyway).
> >
> > > What Lily actually does when -dcrop is set: removes whitespace from the
> > > edges *and from between all systems* of an SVG.
> >
> > That's right, so that your file contains all the information,
> > unencumbered by margins, ready for some sort of further processing.
> > Obviously, I don't know what that will be in your case.
> >
> > It reminds me of those PNG files that you find in browsers' cache,
> > which have a strip or grid of little images that are used internally,
> > either as a toolbar, or displayed sequentially like a movie.
> >
> > > So my question is: is Lily supposed to remove whitespace from *between*
> > > systems when -d[c]rop is set?
> >
> > AIUI yes. But this is policy: I await pronouncements from higher-ups.
> >
> > ¹ I believe the modifications need to be kept proportional, in order
> >   to preserve the aspect ratio.
>
> I really appreciate the responses, but I'm even more confused than before.
>
> When you ran ...
>
> $ lilypond-2.21.80-1.linux-64/bin/lilypond --svg -dno-point-and-click Bača.ly
>
> ... why didn't you include the -dcrop option?

[You need a fixed width font to make sense of text below.]

What running my command on your source produces might be represented by:

A   ┌────────────────────┐
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱▒▒▒▒▒▒▒▒▒▒▒▒▒▒⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱▒▒▒▒▒▒▒▒▒▒▒▒▒▒⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱▒▒▒▒▒▒▒▒▒▒▒▒▒▒⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱tttttttttt⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    └────────────────────┘

where ⸱ is white space, ▒ is music, and t is the tagline.

What my previous post also had attached to it was the result of
trimming off the whitespace from just the sides:

B   ┌──────────────┐
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱tttttttttt⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    └──────────────┘

(I trimmed only the sides because the image was taller than
my screen, which made it difficult to inspect the entire
image in the Y direction.)

Then Niols posted inkscape command lines to produce:

C   ┌──────────────┐
    │▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │⸱⸱tttttttttt⸱⸱│
    └──────────────┘

which might be improved by adding
\header { tagline = ##f }
to the source file and producing:

D   ┌──────────────┐
    │▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
    │⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱⸱│
    │▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
    └──────────────┘

which is what I assume you actually want—just the music,
with the whitespace left untouched between the systems.

All of the images B, C and D can easily be produced with
widely-available utilities, and no involvement from LP.

To answer your question—why not use the -dcrop option—I think
we are in agreement that:

$ lilypond-2.21.80-1.linux-64/bin/lilypond --svg -dcrop Bača.ly

will produce the tightly packed:

E   ┌──────────────┐
    │▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
    │▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
    │▒▒▒▒▒▒▒▒▒▒▒▒▒▒│
    └──────────────┘

which is what you implied you didn't want (by saying "Is this
supposed to happen?" and "Seems like cropping should be …").

Cheers,
David.

Hi David,

This is an exceptionally generous answer that you've penned here, really above and beyond to help me understand. I wanted to just acknowledge your thoughtfulness, because I know how much time it takes to author something like this.

I'll reply to Aaron and Werner's responses later in the thread, too, to weigh in on the status of bug / not-bug, etc.

Thanks so much.

Trevor.

--

reply via email to

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