Hi,
On Fri, 26 Nov 2004, Han-Wen Nienhuys wrote:
> My suggestion is to skip lilypond-book altogether. Extract the ly code
> directly, and invoke as
>
> lilypond --safe --format=ps --png --pdf FILE
>
> this will make a .png and .pdf for the file specified.
Okay, I translate
<lilypond fragment relative=2>
\key c \minor c4 es g2
</lilypond>
to
\paper {
raggedright = ##t
indent = 0\mm
}
\relative c'' {
\key c \minor c4 es g2
}
As I don't need a PDF, I used the command line
lilypond --safe --format=ps --preview --png FILE
However, in order to use ps2png, I had to patch lilylib.py (see
attachment). Is this patch okay? It replaces a re.match by re.search (as
the %%BoundingBox cannot be at the beginning of the file), and it adds
"-c showpage" to the gs command line (else I don't get BBoxes or PNGs).
Ciao,
Dscho
Index: lilylib.py
===================================================================
RCS file: /cvsroot/lilypond/lilypond/python/lilylib.py,v
retrieving revision 1.48
diff -u -u -r1.48 lilylib.py
--- lilylib.py 17 Nov 2004 16:41:31 -0000 1.48
+++ lilylib.py 26 Nov 2004 16:08:43 -0000
@@ -447,7 +447,7 @@
def get_bbox (filename):
bbox = filename + '.bbox'
## -sOutputFile does not work with bbox?
- cmd = 'gs -sDEVICE=bbox -q -dNOPAUSE %s -c quit 2>%s' % \
+ cmd = 'gs -sDEVICE=bbox -q -dNOPAUSE %s -c showpage -c quit 2>%s' % \
(filename, bbox)
system (cmd, progress_p = 1)
box = open (bbox).read ()
@@ -467,7 +467,7 @@
header = open (ps_name).read (1024)
- match = re.match (BOUNDING_BOX_RE, header)
+ match = re.search (BOUNDING_BOX_RE, header, re.MULTILINE)
bbox = []
if match:
bbox = map (string.atoi, match.groups ())
@@ -501,7 +501,7 @@
if y == 0:
y = 1
- cmd = r'''gs -g%dx%d -sDEVICE=pnggray -dTextAlphaBits=4
-dGraphicsAlphaBits=4 -q -sOutputFile=%s -r%d -dNOPAUSE %s %s -c quit ''' % \
+ cmd = r'''gs -g%dx%d -sDEVICE=pnggray -dTextAlphaBits=4
-dGraphicsAlphaBits=4 -q -sOutputFile=%s -r%d -dNOPAUSE %s %s -c showpage -c
quit ''' % \
(x, y, output_file, resolution, trans_ps, ps_name)
rms = glob.glob (base + '-page*.png')
@@ -513,7 +513,7 @@
if os.path.isfile (rmfile):
os.unlink (rmfile)
- cmd = r'''gs -s -sDEVICE=pnggray -dTextAlphaBits=4
-dGraphicsAlphaBits=4 -q -sOutputFile=%s -dNOPAUSE -r%d %s -c quit''' %
(output_file,
+ cmd = r'''gs -s -sDEVICE=pnggray -dTextAlphaBits=4
-dGraphicsAlphaBits=4 -q -sOutputFile=%s -dNOPAUSE -r%d %s -c showpage -c
quit''' % (output_file,
resolution, ps_name)
status = system (cmd)
_______________________________________________
lilypond-devel mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/lilypond-devel