From: Han-Wen Nienhuys Date: Fri, 16 Aug 2002 20:09:03 +0000 (+0000) Subject: (ChordNamesContext): minimumverticalExtent X-Git-Tag: release/1.5.74~9 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7954f8012ca7364a1b369465a56f36f83f247685;p=lilypond.git (ChordNamesContext): minimumverticalExtent -> minimumVerticalExtent --- diff --git a/ChangeLog b/ChangeLog index 7abe88c42c..83e615be18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2002-08-16 Han-Wen Nienhuys + + * ly/engraver-init.ly (ChordNamesContext): minimumverticalExtent + -> minimumVerticalExtent + +2002-08-16 Stephen Peters + + * scm/pdf.scm, pdftex.scm: pdftex updates + + * scripts/ly2dvi.py: pdflatex support + 2002-08-16 Jan Nieuwenhuizen * Documentation/windows/installing.texi: Include info from Wiki. diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index 40939ff3c7..2befc77fcf 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -4121,7 +4121,7 @@ abbrev: @code{columns lines roman music bold italic named super sub} 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 diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 3a869f7e39..61f79362af 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -34,7 +34,7 @@ StaffContext=\translator { \consists "Forbid_line_break_engraver" \consistsend "Axis_group_engraver" - minimumverticalExtent = #'(-6 . 6) + minimumVerticalExtent = #'(-6 . 6) extraverticalExtent = ##f verticalExtent = ##f localKeySignature = #'() @@ -53,7 +53,7 @@ StaffContext=\translator { StaffContainerContext = \translator { \type Engraver_group_engraver \consists "Axis_group_engraver" - minimumverticalExtent = ##f + minimumVerticalExtent = ##f extraverticalExtent = ##f verticalExtent = ##f localKeySignature = #'() @@ -91,7 +91,7 @@ RhythmicStaffContext=\translator{ \consists "Output_property_engraver" - minimumverticalExtent = ##f + minimumVerticalExtent = ##f extraverticalExtent = ##f verticalExtent = ##f localKeySignature = #'() @@ -248,7 +248,7 @@ StaffGroupContext = \translator { 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 @@ -266,7 +266,7 @@ NoteNamesContext = \translator { \name NoteNames \consistsend "Axis_group_engraver" - minimumverticalExtent = ##f + minimumVerticalExtent = ##f extraverticalExtent = ##f verticalExtent = ##f @@ -282,7 +282,7 @@ LyricsContext = \translator { \consistsend "Axis_group_engraver" - minimumverticalExtent = ##f + minimumVerticalExtent = ##f extraverticalExtent = ##f verticalExtent = ##f @@ -302,7 +302,7 @@ ChordNamesContext = \translator { \consists "Chord_name_engraver" \consists "Skip_req_swallow_translator" \consistsend "Axis_group_engraver" - minimumverticalExtent = ##f + minimumVerticalExtent = ##f extraverticalExtent = ##f verticalExtent = ##f } diff --git a/scm/pdf.scm b/scm/pdf.scm index 8c2f1722f7..62ee967d7a 100644 --- a/scm/pdf.scm +++ b/scm/pdf.scm @@ -19,12 +19,12 @@ - ; 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 ")) @@ -142,30 +142,39 @@ (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) "") @@ -183,7 +192,6 @@ (define (placebox x y s) "") -;; TODO: bezier-ending, see ps.scm (define (bezier-bow l thick) (bezier-sandwich l thick)) @@ -197,7 +205,21 @@ (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) "") @@ -208,11 +230,18 @@ (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) diff --git a/scm/pdftex.scm b/scm/pdftex.scm index 3d38d7a45e..a3bd441da5 100644 --- a/scm/pdftex.scm +++ b/scm/pdftex.scm @@ -72,7 +72,24 @@ (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) "" 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") @@ -140,7 +157,14 @@ (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")) @@ -182,7 +206,7 @@ (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))) @@ -210,6 +234,8 @@ (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) diff --git a/scripts/ly2dvi.py b/scripts/ly2dvi.py index d6858579cc..5b016b2d5e 100644 --- a/scripts/ly2dvi.py +++ b/scripts/ly2dvi.py @@ -323,6 +323,9 @@ verbose_p = 0 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") @@ -344,6 +347,7 @@ option_definitions = [ ('', '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', @@ -468,7 +472,10 @@ def run_lilypond (files, dep_prefix): fields)) else: opts = opts + ' --no-paper' - + + if pdftex_p: + opts = opts + ' -f pdftex' + if track_dependencies_p: opts = opts + " --dependencies" if dep_prefix: @@ -506,7 +513,7 @@ def analyse_lilypond_output (filename, extra): # 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 () @@ -535,7 +542,7 @@ def find_tex_files_for_base (base, extra): 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): @@ -554,7 +561,7 @@ 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: @@ -697,7 +704,7 @@ None 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 @@ -729,8 +736,8 @@ The error log is as follows: ''' % (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): @@ -902,6 +909,12 @@ for opt in options: 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: @@ -953,7 +966,7 @@ if files: 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) @@ -1028,7 +1041,28 @@ if files: 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') diff --git a/tex/lily-pdf-defs.tex b/tex/lily-pdf-defs.tex index 67c8a88f1d..69cacb71a6 100644 --- a/tex/lily-pdf-defs.tex +++ b/tex/lily-pdf-defs.tex @@ -6,7 +6,9 @@ % 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}% } }