+2002-08-16 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+
+ * ly/engraver-init.ly (ChordNamesContext): minimumverticalExtent
+ -> minimumVerticalExtent
+
+2002-08-16 Stephen Peters <portnoy@portnoy.org>
+
+ * scm/pdf.scm, pdftex.scm: pdftex updates
+
+ * scripts/ly2dvi.py: pdflatex support
+
2002-08-16 Jan Nieuwenhuizen <janneke@gnu.org>
* Documentation/windows/installing.texi: Include info from Wiki.
The markup is broken down and converted into a list of grob properties,
which are prepended to the property list. The @var{key}-@var{value}
pair is a grob property. A list of properties available is included in
-the generated documentation for @rint{Text_interface}.
+the generated documentation for @internalsref{text-interface}.
The following abbreviations are defined:
@table @code
\consists "Forbid_line_break_engraver"
\consistsend "Axis_group_engraver"
- minimumverticalExtent = #'(-6 . 6)
+ minimumVerticalExtent = #'(-6 . 6)
extraverticalExtent = ##f
verticalExtent = ##f
localKeySignature = #'()
StaffContainerContext = \translator {
\type Engraver_group_engraver
\consists "Axis_group_engraver"
- minimumverticalExtent = ##f
+ minimumVerticalExtent = ##f
extraverticalExtent = ##f
verticalExtent = ##f
localKeySignature = #'()
\consists "Output_property_engraver"
- minimumverticalExtent = ##f
+ minimumVerticalExtent = ##f
extraverticalExtent = ##f
verticalExtent = ##f
localKeySignature = #'()
LyricsVoiceContext= \translator{
\type "Engraver_group_engraver"
\consistsend "Axis_group_engraver"
- minimumverticalExtent = #(cons -1.2 1.2)
+ minimumVerticalExtent = #(cons -1.2 1.2)
extraverticalExtent = ##f
verticalExtent = ##f
\name LyricsVoice
\name NoteNames
\consistsend "Axis_group_engraver"
- minimumverticalExtent = ##f
+ minimumVerticalExtent = ##f
extraverticalExtent = ##f
verticalExtent = ##f
\consistsend "Axis_group_engraver"
- minimumverticalExtent = ##f
+ minimumVerticalExtent = ##f
extraverticalExtent = ##f
verticalExtent = ##f
\consists "Chord_name_engraver"
\consists "Skip_req_swallow_translator"
\consistsend "Axis_group_engraver"
- minimumverticalExtent = ##f
+ minimumVerticalExtent = ##f
extraverticalExtent = ##f
verticalExtent = ##f
}
- ; simple commands to store and update currentpoint. This makes the
- ; other procedures simple rewrites of the PostScript code.
+; simple commands to store and update currentpoint. This makes the
+; other procedures simple rewrites of the PostScript code.
+
(define currentpoint (cons 0 0))
(define (showcp)
- (string-append (ly-number->string (car currentpoint)) " "
- (ly-number->string (cdr currentpoint)) " "))
+ (string-append (control->string currentpoint) " "))
(define (moveto x y)
(set! currentpoint (cons x y))
(string-append (showcp) "m "))
(ly-number->string (+ depth height))
" re f "))
-;; TODO:
-;;
-;;(define (dot x y diam)
-;; (let (radius (/ diam 2))
-;; (string-append (ly-number->string (x))
-;; (ly-number->string (y))
-;; (ly-number->string (radius))
-;; " ??? "))) ;; how to draw a circle in PDF?
-;;
-;;(define (roundfilledbox x y width height blotdiam)
-;; (string-append " "
-;; (dot x y blotdiam)
-;; (dot (+ x width) y blotdiam)
-;; (dot (+ x width) (+ y height) blotdiam)
-;; (dot x (+ y height) blotdiam)
-;; (filledbox (+ x (/ blotdiam 2)) (+ width (/ blotdiam 2)) y height)
-;; (filledbox x width (+ y (/ blotdiam 2)) (+ height (/ blotdiam 2)))))
-;;
-;;
-;; WORKAROUND:
-;;
+(define (roundfilledbox breadth width depth height blotdiam)
+ (let* ((rad (/ blotdiam 2))
+ (h (- height rad))
+ (d (- depth rad))
+ (w (- width rad))
+ (b (- breadth rad)))
+ (string-append " 0 J "
+ (setlinewidth blotdiam)
+ "1 j "
+ (moveto (- b) (- d))
+ (rlineto (+ b w) 0)
+ (rlineto 0 (+ d h))
+ (rlineto (- (+ b w)) 0)
+ (rlineto 0 (- (+ d h)))
+ "b ")))
+
+;; PDF doesn't have the nifty arc operator. This uses a fast
+;; approximation with two curves. It bulges out a bit more than a
+;; true circle should along the 45 degree axes, but most users won't
+;; notice.
+(define (dot x y radius)
+ (string-append (moveto (- x radius) y)
+ (curveto (- x radius) (+ y (* 1.3333 radius))
+ (+ x radius) (+ y (* 1.3333 radius))
+ (+ x radius) y)
+ (curveto (+ x radius) (- y (* 1.3333 radius))
+ (- x radius) (- y (* 1.3333 radius))
+ (- x radius) y)
+ "f "))
+
+
(define (roundfilledbox breadth width depth height blot)
(filledbox breadth width depth height))
-;;
(define (font-def i s) "")
(define (placebox x y s) "")
-;; TODO: bezier-ending, see ps.scm
(define (bezier-bow l thick)
(bezier-sandwich l thick))
(curveto-pairs (list-ref l 0)
(list-ref l 1)
(list-ref l 2))
- "B "))
+ "B "
+ (bezier-ending (list-ref l 3) (list-ref l 0) (list-ref l 5))
+ (bezier-ending (list-ref l 7) (list-ref l 0) (list-ref l 5))))
+
+(define (bezier-ending z0 z1 z2)
+ (let ((x0 (car z0))
+ (y0 (cdr z0))
+ (x1 (car z1))
+ (y1 (cdr z1))
+ (x2 (car z2))
+ (y2 (cdr z2)))
+ (dot x0 y0
+ (/ (sqrt (+ (* (- x1 x2) (- x1 x2))
+ (* (- y1 y2) (- y1 y2)))) 2))))
+
(define (start-system height) "")
(define (text s) "")
+(define (draw-line thick fx fy tx ty)
+ (string-append (setlineparams)
+ (setlinewidth thick)
+ (moveto fx fy)
+ (lineto tx ty)
+ "S "))
(define (unknown) "\n unknown\n")
- ; Problem here -- we're using /F18 for the font, but we don't know
- ; for sure that that will exist.
+; Problem here -- we're using /F18 for the font, but we don't know
+; for sure that that will exist.
+
(define (ez-ball ch letter-col ball-col)
(let ((origin (cons 0.45 0)))
(string-append (setgray 0)
(define (ez-ball c l b)
(embedded-pdf (list 'ez-ball c l b)))
-
+(define (header-to-file fn key val)
+ (set! key (symbol->string key))
+ (if (not (equal? "-" fn))
+ (set! fn (string-append fn "." key))
+ )
+ (display
+ (format "writing header field `~a' to `~a'..."
+ key
+ (if (equal? "-" fn) "<stdout>" fn)
+ )
+ (current-error-port))
+ (if (equal? fn "-")
+ (display val)
+ (display val (open-file fn "w"))
+ )
+ (display "\n" (current-error-port))
+ ""
+ )
(if (or (equal? (minor-version) "4.1")
(equal? (minor-version) "4")
(define (header-end)
(string-append
- "\\input lilyponddefs\\newdimen\\outputscale \\outputscale=\\lilypondpaperoutputscale pt"
+ "\\def\\lilyoutputscalefactor{"
+ (number->string (cond
+ ((equal? (ly-unit) "mm") (/ 72.0 25.4))
+ ((equal? (ly-unit) "pt") (/ 72.0 72.27))
+ (else (error "unknown unit" (ly-unit)))
+ ))
+ "}\n"
+ "\\input lilyponddefs \\outputscale=\\lilypondpaperoutputscale \\lilypondpaperunit"
"\\turnOnPostScript"
"\\pdfcompresslevel=0"))
(define (placebox x y s)
(string-append
"\\placebox{"
- (number->dim y) "}{" (number->dim x) "}{" s "}\n"))
+ (number->dim y) "}{" (number->dim x) "}{" s "}%\n"))
(define (bezier-bow l thick)
(embedded-pdf (list 'bezier-bow `(quote ,l) thick)))
(define (text s)
(string-append "\\hbox{" (output-tex-string s) "}"))
+(define (draw-line thick fx fy tx ty)
+ (embedded-pdf (list 'draw-line thick fx fy tx ty)))
(define (define-origin file line col)
(if (procedure? point-and-click)
preview_p = 0
preview_resolution = 90
pseudo_filter_p = 0
+latex_cmd = 'latex'
+tex_extension = '.tex'
+pdftex_p = 0
help_summary = _ ("Generate .dvi with LaTeX for LilyPond")
('', 'V', 'verbose', _ ("verbose")),
('', 'v', 'version', _ ("print version number")),
('', 'w', 'warranty', _ ("show warranty and copyright")),
+ ('', '', 'pdftex', _("Use pdflatex to generate a PDF output")),
]
layout_fields = ['dedication', 'title', 'subtitle', 'subsubtitle',
fields))
else:
opts = opts + ' --no-paper'
-
+
+ if pdftex_p:
+ opts = opts + ' -f pdftex'
+
if track_dependencies_p:
opts = opts + " --dependencies"
if dep_prefix:
# urg
'''Grep FILENAME for interesting stuff, and
put relevant info into EXTRA.'''
- filename = filename+'.tex'
+ filename = filename+tex_extension
progress (_ ("Analyzing %s...") % filename)
s = open (filename).read ()
if os.path.exists (base + '.' + f):
extra[f].append (open (base + '.' + f).read ())
- return (base +'.tex',headerfiles)
+ return (base+tex_extension,headerfiles)
def find_tex_files (files, extra):
if x:
fname = fname + '-%d' % x
- if os.path.exists (fname + '.tex'):
+ if os.path.exists (fname + tex_extension):
tfiles.append (find_tex_files_for_base (fname, extra))
analyse_lilypond_output (fname, extra)
else:
f.write (s)
f.close ()
- cmd = 'latex \\\\nonstopmode \\\\input %s' % latex_fn
+ cmd = latex_cmd + ' \\\\nonstopmode \\\\input %s' % latex_fn
status = quiet_system (cmd, 'LaTeX', ignore_error = 1)
signal = 0xf & status
''' % (global_latex_preamble (extra), outbase))
f.close()
- cmd = 'latex \\\\nonstopmode \\\\input %s' % preview_fn
- quiet_system (cmd, "LaTeX for preview")
+ cmd = '%s \\\\nonstopmode \\\\input %s' % (latex_cmd, preview_fn)
+ quiet_system (cmd, '%s for preview' % latex_cmd)
def run_dvips (outbase, extra):
elif o == '--version' or o == '-v':
identify ()
sys.exit (0)
+ elif o == '--pdftex':
+ latex_cmd = 'pdflatex'
+ targets.remove('DVI')
+ targets.append('PDFTEX')
+ pdftex_p = 1
+ tex_extension = '.pdftex'
elif o == '--warranty' or o == '-w':
status = system ('lilypond -w', ignore_error = 1)
if status:
else:
(outdir, outbase) = os.path.split (abspath (output_name))
- for i in ('.dvi', '.latex', '.ly', '.ps', '.tex'):
+ for i in ('.dvi', '.latex', '.ly', '.ps', '.tex', '.pdftex'):
output_name = strip_extension (output_name, i)
outbase = strip_extension (outbase, i)
if 'PNG' in targets:
make_preview (outbase, extra_init)
-
+
+ if 'PDFTEX' in targets:
+ try:
+ run_latex (files, outbase, extra_init)
+ # unless: add --tex, or --latex?
+ targets.remove ('TEX')
+ targets.remove ('LATEX')
+ targets.remove ('PDFTEX')
+ if 'PDF' not in targets:
+ targets.append('PDF')
+ except:
+ # TODO: friendly message about TeX/LaTeX setup,
+ # trying to run tex/latex by hand
+ if 'PDFTEX' in targets:
+ targets.remove ('PDFTEX')
+ if 'PDF' in targets:
+ targets.remove ('PDF')
+ if 'PS' in targets:
+ targets.remove ('PS')
+ traceback.print_exc ()
+ sys.exit(1)
+
# add DEP to targets?
if track_dependencies_p:
depfile = os.path.join (outdir, outbase + '.dep')
% by executing a 0 0 moveto
\def\embeddedpdf##1{%
\pdfliteral{q \lilypondpaperoutputscale\lilySpace 0 0 %
- \lilypondpaperoutputscale\lilySpace 0 0 cm%
+ \lilypondpaperoutputscale\lilySpace 0 0 cm %
+ \lilyoutputscalefactor\lilySpace 0 0 %
+ \lilyoutputscalefactor\lilySpace 0 0 cm %
##1 Q}%
}
}