+2006-07-17 Han-Wen Nienhuys <hanwen@lilypond.org>
+
+ * stepmake/stepmake/texinfo-rules.make: strip DVI support.
+
+ * scm/framework-eps.scm (dump-stencils-as-EPSes): generate
+ systems.pdftex too.o
+
+ * scm/backend-library.scm (postscript->pdf): use -dEPSCrop for PDF.
+
+ * make/lilypond-vars.make (TEXINPUTS): add pdf output format.
+
+ * Documentation/topdocs/NEWS.tely (Top): add pdftex note.
+
+ * scm/output-ps.scm (resetrotation): use gsave/grestore for rotation.
+
+ * lily/main.cc (parse_argv): don't overwrite previous --formats string.
+
+ * scm/backend-library.scm (postscript->pdf): strip .eps too.
+
2006-07-14 Nicolas Sceaux <nicolas.sceaux@free.fr>
* scm/layout-page-layout.scm: Define module, tidy code, use more
* only show user-visible changes.
@end ignore
+@item
+@code{lilypond-book} now includes support for PDF@TeX{}.
+
+This feature was sponsored by David Roundy.
+
@item
Nested tuplets can have different formatting for each nesting level,
\time 5/4
\tweak #'text #tuplet-number::calc-fraction-text
\times 5/3 {
- \tweak #'tupletNumberFormatFunction #tuplet-number::calc-denominator-text
+ \tweak #'text #tuplet-number::calc-denominator-text
\times 2/3 {
c'8[ c'8 c'8]
}
break;
case 'f':
- output_format_global = option_parser->optional_argument_str0_;
+ {
+ vector<string> components
+ = string_split (option_parser->optional_argument_str0_, ',');
+ for (vsize i = 0; i < components.size (); i++)
+ add_output_format (components[i]);
+ }
break;
case 'H':
LILYPOND_BOOK = $(script-dir)/lilypond-book.py
LILYPOND_BOOK_INCLUDES = -I $(src-dir)/ -I $(outdir) -I $(input-dir) -I $(input-dir)/regression/ -I $(input-dir)/manual/ -I $(input-dir)/tutorial/ -I $(top-build-dir)/mf/$(outconfbase)/ -I $(top-build-dir)/mf/out/
LILYPOND_BOOK_LILYPOND_FLAGS=-dgs-font-load
-LILYPOND_BOOK_FLAGS = --process="$(LILYPOND_BINARY) --backend=eps --formats=ps,png --header=texidoc -I $(top-src-dir)/input/manual -dinternal-type-checking -ddump-signatures -danti-alias-factor=2 $(LILYPOND_BOOK_LILYPOND_FLAGS)"
+LILYPOND_BOOK_FLAGS = --process="$(LILYPOND_BINARY) --backend=eps --formats=ps,png,pdf -deps-font-include -dgs-font-load --header=texidoc -I $(top-src-dir)/input/manual -dinternal-type-checking -ddump-signatures -danti-alias-factor=2 $(LILYPOND_BOOK_LILYPOND_FLAGS)"
TEXINPUTS=$(top-src-dir)/tex/::
export TEXINPUTS
-.SUFFIXES: .doc .dvi .tely .texi .ly
+.SUFFIXES: .doc .tely .texi .ly
-$(outdir)/%.latex $(outdir)/%.psfonts: %.doc
+$(outdir)/%.latex: %.doc
$(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND_BINARY) $(LILYPOND_BOOK_INCLUDES)' --output=$(outdir) --verbose $(LILYPOND_BOOK_FLAGS) $<
# don't do ``cd $(outdir)'', and assume that $(outdir)/.. is the src dir.
# it is not, for --srcdir builds
$(outdir)/%.texi: %.tely
- rm -f $$(grep -LF '% eof' $(outdir)/lily-*systems.tex 2>/dev/null)
- $(PYTHON) $(LILYPOND_BOOK) --psfonts $(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND_BINARY) $(LILYPOND_BOOK_INCLUDES)' --output=$(outdir) --format=$(LILYPOND_BOOK_FORMAT) --verbose $(LILYPOND_BOOK_FLAGS) $<
+ rm -f $$(grep -LF '% eof' $(outdir)/lily-*systems.*tex 2>/dev/null)
+ $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND_BINARY) $(LILYPOND_BOOK_INCLUDES)' --output=$(outdir) --format=$(LILYPOND_BOOK_FORMAT) --verbose $(LILYPOND_BOOK_FLAGS) $<
$(outdir)/%.texi: $(outdir)/%.tely
- rm -f $$(grep -LF '% eof' $(outdir)/lily-*systems.tex 2>/dev/null)
- $(PYTHON) $(LILYPOND_BOOK) --psfonts $(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND_BINARY) $(LILYPOND_BOOK_INCLUDES)' --output=$(outdir) --format=$(LILYPOND_BOOK_FORMAT) --verbose $(LILYPOND_BOOK_FLAGS) $<
+ rm -f $$(grep -LF '% eof' $(outdir)/lily-*systems.*tex 2>/dev/null)
+ $(PYTHON) $(LILYPOND_BOOK) $(LILYPOND_BOOK_INCLUDES) --process='$(LILYPOND_BINARY) $(LILYPOND_BOOK_INCLUDES)' --output=$(outdir) --format=$(LILYPOND_BOOK_FORMAT) --verbose $(LILYPOND_BOOK_FLAGS) $<
#
# DON'T REMOVE SOURCE FILES, otherwise the .TEXI ALWAYS OUT OF DATE.
# rm -f $<
;; must be sure that we don't catch stuff from old GUBs.
(search-executable '("gs")))
-
+
(define-public (postscript->pdf paper-width paper-height name)
- (let* ((pdf-name (string-append (basename name ".ps") ".pdf"))
+ (let* ((pdf-name (string-append
+ (basename (basename name ".ps") ".eps")
+ ".pdf"))
+ (is-eps (string-match "\\.eps$" name))
+ (paper-size-string (if is-eps
+ " -dEPSCrop "
+ (format "-dDEVICEWIDTHPOINTS=~,2f \
+-dDEVICEHEIGHTPOINTS=~,2f "
+ paper-width
+ paper-height)))
+
(cmd (format #f
"~a\
~a\
~a\
+ ~a\
-dCompatibilityLevel=1.4 \
- -dDEVICEWIDTHPOINTS=~,2f -dDEVICEHEIGHTPOINTS=~,2f\
-dNOPAUSE\
-dBATCH\
-r1200 \
(if (ly:get-option 'gs-font-load)
" -dNOSAFER "
" -dSAFER ")
- paper-width
- paper-height
+ paper-size-string
pdf-name
name)))
;; The wrapper on windows cannot handle `=' signs,
(lambda (x)
(member x formats))
completed)))
+
(for-each
(lambda (f)
- ((eval (string->symbol (string-append "convert-to-" f)) module)
+ ((eval (string->symbol (format "convert-to-~a" f)) module)
paper-book filename))
completed)
))
stencils))
+
(define (dump-stencils-as-EPSes stencils book basename)
+ (define do-pdf (member "pdf" (ly:output-formats)))
(define paper (ly:paper-book-paper book))
(define (dump-infinite-stack-EPS stencils)
(let* ((dump-me (stack-stencils Y DOWN 2.0 stencils)))
(dump-stencil-as-EPS paper dump-me basename #t)))
- (define (dump-stencils-as-separate-EPS stencils count)
+ (define (dump-stencils-as-separate-EPS stencils count )
(if (pair? stencils)
(let* ((line (car stencils))
- (rest (cdr stencils)))
+ (rest (cdr stencils))
+ (system-base-name (format "~a-~a" basename count))
+ )
(dump-stencil-as-EPS
- paper line (format "~a-~a" basename count)
+ paper line system-base-name
(ly:get-option 'eps-font-include))
-
+
+ (if do-pdf
+ (postscript->pdf 0 0 (string-append system-base-name ".eps")))
(dump-stencils-as-separate-EPS rest (1+ count)))))
;; main body
(let* ((tex-system-name (format "~a-systems.tex" basename))
+ (pdftex-system-name (format "~a-systems.pdftex" basename))
(texi-system-name (format "~a-systems.texi" basename))
(tex-system-port (open-output-file tex-system-name))
- (texi-system-port (open-output-file texi-system-name)))
+ (texi-system-port (open-output-file texi-system-name))
+ (pdftex-system-port (open-output-file pdftex-system-name)))
(ly:message (_ "Writing ~a...") tex-system-name)
(ly:message (_ "Writing ~a...") texi-system-name)
+ (ly:message (_ "Writing ~a...") pdftex-system-name)
(set! stencils (widen-left-stencil-edges stencils))
" c) tex-system-port))
(display (format "\\includegraphics{~a-~a.eps}\n"
basename (1+ c)) tex-system-port)
+ (display (format "\\includegraphics{~a-~a.pdf}\n"
+ basename (1+ c)) pdftex-system-port)
(display (format "@image{~a-~a}\n"
basename (1+ c)) texi-system-port))
(iota (length stencils)))
(display "@c eof - 'eof' is a Makefile marker; do not remove. " texi-system-port)
(display "% eof - 'eof' is Makefile marker; do not remove. " tex-system-port)
- (dump-infinite-stack-EPS stencils))
+ (dump-infinite-stack-EPS stencils)
(postprocess-output book framework-eps-module
- (format "~a.eps" basename) (ly:output-formats)))
+ (format "~a.eps" basename) (ly:output-formats))))
(define convert-to-tex convert-to-tex)
(define convert-to-dvi convert-to-dvi)
+
;; restore color from stack
(define (resetcolor) "setrgbcolor\n")
-;; reset rotation
-(define (resetrotation ang x y)
- (format "~a translate ~a rotate ~a translate\n"
- (numbers->string4 (list x y))
- (number->string (* -1 ang))
- (numbers->string4 (list (* -1 x) (* -1 y)))))
(define (round-filled-box left right bottom top blotdiam)
(let* ((halfblot (/ blotdiam 2))
;; rotation around given point
(define (setrotation ang x y)
- (format "~a translate ~a rotate ~a translate\n"
+ (format "gsave ~a translate ~a rotate ~a translate\n"
(numbers->string4 (list x y))
(number->string ang)
(numbers->string4 (list (* -1 x) (* -1 y)))))
+(define (resetrotation ang x y)
+ "grestore ")
+
+
(define (text font s)
;; (ly:warning (_ "TEXT backend-command encountered in Pango backend"))
;; (ly:warning (_ "Arguments: ~a ~a"" font str))
(write-system-signatures basename (cdr paper-systems) (1+ count))))))
+(use-modules (scm paper-system))
(define-public (write-system-signature filename paper-system)
(define (float? x)
(and (number? x) (inexact? x)))
exit (1)
if global_options.format in (TEXINFO, LATEX):
- if not global_options.psfonts:
- warning (_ ("option --psfonts not used"))
- warning (_ ("processing with dvips will have no fonts"))
-
psfonts_file = os.path.join (global_options.output_name, basename + '.psfonts')
output = os.path.join (global_options.output_name, basename + '.dvi' )
- progress ('\n')
- progress (_ ("DVIPS usage:"))
- progress ('\n')
- progress (" dvips -h %(psfonts_file)s %(output)s" % vars ())
- progress ('\n')
+ if not global_options.psfonts:
+ warning (_ ("option --psfonts not used"))
+ warning (_ ("processing with dvips will have no fonts"))
+ else:
+ progress ('\n')
+ progress (_ ("DVIPS usage:"))
+ progress ('\n')
+ progress (" dvips -h %(psfonts_file)s %(output)s" % vars ())
+ progress ('\n')
inputs = note_input_file ('')
inputs.pop ()
$(outdir)/%/%.html: $(outdir)/%.texi
$(MAKEINFO) --output=$@ --css-include=$(top-src-dir)/Documentation/texinfo.css --html $<
-
-$(outdir)/%.dvi: $(outdir)/%.texi
- cd $(outdir); texi2dvi $(TEXI2DVI_FLAGS) --batch $(TEXINFO_PAPERSIZE_OPTION) $(<F)
+$(outdir)/%.pdf: $(outdir)/%.texi
+ cd $(outdir); texi2pdf $(TEXI2PDF_FLAGS) --batch $(TEXINFO_PAPERSIZE_OPTION) $(<F)
$(outdir)/%.txt: $(outdir)/%.texi
$(MAKEINFO) -I $(src-dir) -I $(outdir) --no-split --no-headers --output $@ $<