whitespace.
* python/lilylib.py (make_ps_images):
* scm/backend-library.scm (postscript->pdf, postscript->png):
Quote file name. Use format rather than string-append juggling.
+2005-03-18 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * scm/framework-tex.scm (convert-to-dvi): Barf if NAME contains
+ whitespace.
+
+ * python/lilylib.py (make_ps_images):
+ * scm/backend-library.scm (postscript->pdf, postscript->png):
+ Quote file name. Use format rather than string-append juggling.
+
2005-03-18 Han-Wen Nienhuys <hanwen@xs4all.nl>
* lily/key-performer.cc (create_audio_elements): don't use
if y == 0:
y = 1
- ###cmd = r'''gs -g%dx%d -sDEVICE=png16m -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)
cmd = r'''gs\
-g%(x)d%(y)d\
- -sDEVICE=png16m\
- -dTextAlphaBits=4\
-dGraphicsAlphaBits=4\
- -q\
- -sOutputFile=%(output_file)s\
+ -dNOPAUSE\
+ -dTextAlphaBits=4\
+ -sDEVICE=png16m\
+ -sOutputFile='%(output_file)s'\
-sPAPERSIZE=%(papersize)s\
- -r%(resolution)d -dNOPAUSE\
+ -q\
+ -r%(resolution)d\
%(trans_ps)s\
- %(ps_name)s\
+ '%(ps_name)s'\
-c showpage\
-c quit ''' % vars ()
if os.path.isfile (rmfile):
os.unlink (rmfile)
- ###cmd = r'''gs -s -sDEVICE=png16m -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -q -sOutputFile=%s -dNOPAUSE -r%d %s -c quit''' % (output_file,
- ### resolution, ps_name)
cmd = r'''gs\
-s\
- -sDEVICE=png16m\
- -dTextAlphaBits=4\
-dGraphicsAlphaBits=4\
- -q\
- -sOutputFile=%(output_file)s\
+ -dNOPAUSE\
+ -dTextAlphaBits=4\
+ -sDEVICE=png16m\
+ -sOutputFile='%(output_file)s'\
-sPAPERSIZE=%(papersize)s\
- -dNOPAUSE -r%(resolution)d\
- %(ps_name)s\
+ -q\
+ -r%(resolution)d\
+ '%(ps_name)s'\
-c quit''' % vars ()
status = system (cmd)
"\""))
(define-public (postscript->pdf papersizename name)
- (let* ((cmd (string-append "ps2pdf "
- (string-append
- " -sPAPERSIZE="
- (sanitize-command-option papersizename)
- " "
- name)))
+ (let* ((cmd (format #f "ps2pdf -sPAPERSIZE=~a '~a'"
+ (sanitize-command-option papersizename) name))
(pdf-name (string-append (basename name ".ps") ".pdf" )))
(if (access? pdf-name W_OK)
(format (current-error-port) (_ "Converting to `~a'...") pdf-name)
(ly:system cmd)))
-(define-public (postscript->png resolution papersize name)
- (let ((cmd (string-append
- "ps2png --resolution="
- (if (number? resolution)
- (number->string resolution)
- "90 ")
- " --papersize=" (if (string? papersize) papersize "a4")
- (if (ly:get-option 'verbose)
- " --verbose "
- " ")
+(define-public (postscript->png resolution papersizename name)
+ (let ((cmd (format #f
+ "ps2png --resolution=~S --papersize=~a~a '~a'"
+ resolution
+ (sanitize-command-option papersizename)
+ (if (ly:get-option 'verbose) " --verbose " "")
name)))
;; Do not try to guess the name of the png file
(format (current-error-port) (_ "Converting to `~a'...") "png")
-;;;; framework-tex.scm --
+1;;;; framework-tex.scm --
;;;;
;;;; source file of the GNU LilyPond music typesetter
;;;;
(guile)
(srfi srfi-1)
(srfi srfi-13)
+ (srfi srfi-14)
(lily))
(define (output-formats)
(ly:kpathsea-expand-variable "$extra_mem_top")
'pre "" 'post)))
(base (basename name ".tex"))
- (cmd (string-append
- "latex \\\\nonstopmode \\\\input " name)))
+ (cmd (format
+ #f "latex \\\\nonstopmode \\\\input '~a'" name)))
+
+ ;; FIXME: latex 'foo bar' works, but \input 'foe bar' does not?
+ (if (string-index name (char-set #\space #\ht #\newline #\cr))
+ (error (format
+ #f
+ (_"TeX file name must not contain whitespace: `~a'") name)))
+
(setenv "extra_mem_top" (number->string (max curr-extra-mem 1024000)))
(let ((dvi-name (string-append base ".dvi")))
(if (access? dvi-name W_OK)
(string-append base ".dvi"))
(newline (current-error-port))))
- ;; fixme: set in environment?
+ ;; FIXME: set in environment?
(if (ly:get-option 'safe)
(set! cmd (string-append "openout_any=p " cmd)))