From: fred Date: Wed, 27 Mar 2002 01:04:15 +0000 (+0000) Subject: lilypond-1.4.2 X-Git-Tag: release/1.5.59~681 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=31ff7e4c39abcb6bc463f626ab3c7a9c4d891bd0;p=lilypond.git lilypond-1.4.2 --- diff --git a/scm/lily.scm b/scm/lily.scm index ecf2171ffc..2b9d42b5cb 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -112,6 +112,8 @@ '("output-lib.scm" "tex.scm" "ps.scm" + "pdf.scm" + "pdftex.scm" "ascii-script.scm" )) diff --git a/scm/pdf.scm b/scm/pdf.scm new file mode 100644 index 0000000000..b5a3cb6352 --- /dev/null +++ b/scm/pdf.scm @@ -0,0 +1,288 @@ +;;; pdf.scm -- implement Scheme output routines for PDF. +;;; +;;; source file of the GNU LilyPond music typesetter +;;; +;;; (c) 2001 Stephen Peters + +; currently no font commands; this is a helper for pdftex.scm. + +(define (pdf-scm action-name) + ; 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)) " ")) + (define (moveto x y) + (set! currentpoint (cons x y)) + (string-append (showcp) "m ")) + (define (moveto-pair pair) + (moveto (car pair) (cdr pair))) + (define (rmoveto x y) + (moveto (+ x (car currentpoint)) (+ y (cdr currentpoint)))) + (define (lineto x y) + (set! currentpoint (cons x y)) + (string-append (showcp) "l ")) + (define (lineto-pair pair) + (lineto (car pair) (cdr pair))) + (define (rlineto x y) + (lineto (+ x (car currentpoint)) (+ y (cdr currentpoint)))) + (define (curveto x1 y1 x2 y2 x y) + (set! currentpoint (cons x y)) + (string-append (ly-number->string x1) (ly-number->string y1) + (ly-number->string x2) (ly-number->string y2) + (ly-number->string x) (ly-number->string y) "c ")) + (define (curveto-pairs pt1 pt2 pt) + (curveto (car pt1) (cdr pt1) (car pt2) (cdr pt2) (car pt) (cdr pt))) + (define (closefill) "h f ") + (define (closestroke) "S ") + (define (setlinewidth w) (string-append (ly-number->string w) "w ")) + (define (setgray g) (string-append (ly-number->string g) "g ")) + (define (setlineparams) "1 j 1 J ") + + (define (beam width slope thick) + (let ((ht (* slope width))) + (string-append (moveto 0 (- (/ thick 2))) + (rlineto width ht) + (rlineto 0 thick) + (lineto 0 (/ thick 2)) + (closefill)))) + + (define (comment s) + (string-append "% " s "\n")) + + (define (brack-traject pair ds alpha) + (let ((alpha-rad (* alpha (/ 3.141592654 180)))) + (cons (+ (car pair) (* (cos alpha-rad) ds)) + (+ (cdr pair) (* (sin alpha-rad) ds))))) + + (define (bracket arch_angle arch_width arch_height height arch_thick thick) + (let* ((halfht (+ (/ height 2) thick)) + (farpt (cons (+ thick arch_height) + (+ (- halfht arch_thick) arch_width))) + (halfbrack + (string-append (moveto 0 0) + (lineto thick 0) + (lineto thick (- halfht arch_thick)) + (curveto-pairs + (brack-traject (cons thick + (- halfht arch_thick)) + (* 0.4 arch_height) 0) + (brack-traject farpt + (* -0.25 arch_height) + arch_angle) + farpt) + (curveto-pairs + (brack-traject farpt + (* -0.15 arch_height) + arch_angle) + (brack-traject (cons (/ thick 2) halfht) + (/ arch_height 2) 0) + (cons 0 halfht)) + (lineto 0 0) + (closefill)))) + (string-append (setlinewidth (/ thick 2)) + (setlineparams) + "q 1 0 0 -1 0 0 cm " ; flip coords + halfbrack + "Q " ; grestore + halfbrack))) + + (define (char i) + (invoke-char " show" i)) + + (define (hairpin thick width starth endh ) + (string-append (setlinewidth thick) + (moveto 0 starth) + (lineto width endh) + (moveto 0 (- starth)) + (lineto width (- endh)) + (closestroke))) + + (define (dashed-slur thick dash l) + (string-append (setlineparams) + "[ " (ly-number->string dash) " " + (ly-number->string (* 10 thick)) " ] 0 d " + (setlinewidth thick) + (moveto-pair (car l)) + (apply curveto (cdr l)) + (closestroke))) + + (define (dashed-line thick on off dx dy) + (string-append (setlineparams) + "[ " (ly-number->string on) " " + (ly-number->string off) " ] 0 d " + (setlinewidth thick) + (moveto 0 0) + (lineto dx dy) + (closestroke))) + + (define (repeat-slash width slope beamthick) + (let* ((height (/ beamthick slope)) + (xwid (sqrt (+ (* beamthick beamthick) (* height height))))) + (string-append (moveto 0 0) + (rlineto xwid 0) + (rlineto width (* slope width)) + (rlineto (- xwid) 0) + (closefill)))) + + (define (end-output) "") + + (define (experimental-on) "") + + (define (filledbox breadth width depth height) + (string-append (ly-number->string (- breadth)) + (ly-number->string (- depth)) + (ly-number->string (+ breadth width)) + (ly-number->string (+ depth height)) + " re f ")) + + (define (font-def i s) "") + + (define (font-switch i) "") + + (define (header-end) "") + + (define (lily-def key val) "") + + (define (header creator generate) "") + + (define (invoke-char s i) + (string-append + "(\\" (inexact->string i 8) ") " s " " )) + + (define (invoke-dim1 s d) + (string-append + (ly-number->string (* d (/ 72.27 72))) " " s )) + + (define (placebox x y s) "") + + (define (bezier-sandwich l thick) + (string-append (setlinewidth thick) + (moveto-pair (list-ref l 7)) + (curveto-pairs (list-ref l 4) + (list-ref l 5) + (list-ref l 6)) + (lineto-pair (list-ref l 3)) + (curveto-pairs (list-ref l 0) + (list-ref l 1) + (list-ref l 2)) + "B ")) + + (define (start-line height) "") + + (define (stem breadth width depth height) + (filledbox breadth width depth height)) + + (define (stop-line) "") + + (define (text s) "") + + (define (volta h w thick vert_start vert_end) + (string-append (setlinewidth thick) + (setlineparams) + (if (= vert_start 0) + (string-append (moveto 0 0) + (lineto 0 h)) + (moveto 0 h)) + (lineto w h) + (if (= vert_end 0) (lineto w 0) "") + (closestroke))) + + (define (tuplet ht gap dx dy thick dir) + (let ((gapy (* (/ dy dx) gap))) + (string-append (setlinewidth thick) + (setlineparams) + (moveto 0 (- (* ht dir))) + (lineto 0 0) + (lineto (/ (- dx gap) 2) + (/ (- dy gapy) 2)) + (moveto (/ (+ dx gap) 2) + (/ (+ dy gapy) 2)) + (lineto dx dy) + (lineto dx (- dy (* ht dir))) + (closestroke)))) + + (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. + (define (ez-ball ch letter-col ball-col) + (let ((origin (cons 0.45 0))) + (string-append (setgray 0) + (setlinewidth 1.1) + (moveto-pair origin) (lineto-pair origin) + (closestroke) + (setgray ball-col) + (setlinewidth 0.9) + (moveto-pair origin) (lineto-pair origin) + (closestroke) + (setgray letter-col) + (moveto-pair origin) + "BT " + "/F18 0.85 Tf " + "-0.28 -0.30 Td " ; move for text block + "[(" ch ")] TJ ET "))) + + (define (define-origin a b c ) "") + (define (no-origin) "") + + ;; PS + (cond ((eq? action-name 'all-definitions) + `(begin + (define beam ,beam) + (define tuplet ,tuplet) + (define bracket ,bracket) + (define char ,char) + (define volta ,volta) + (define bezier-sandwich ,bezier-sandwich) + (define dashed-line ,dashed-line) + (define dashed-slur ,dashed-slur) + (define hairpin ,hairpin) + (define end-output ,end-output) + (define experimental-on ,experimental-on) + (define filledbox ,filledbox) + (define font-def ,font-def) + (define font-switch ,font-switch) + (define header-end ,header-end) + (define lily-def ,lily-def) + (define font-load-command ,font-load-command) + (define header ,header) + (define invoke-char ,invoke-char) + (define invoke-dim1 ,invoke-dim1) + (define placebox ,placebox) + (define repeat-slash ,repeat-slash) + (define select-font ,select-font) + (define start-line ,start-line) + (define stem ,stem) + (define stop-line ,stop-line) + (define stop-last-line ,stop-line) + (define text ,text) + (define no-origin ,no-origin) + (define define-origin ,define-origin) + (define ez-ball ,ez-ball) + )) + ((eq? action-name 'tuplet) tuplet) + ((eq? action-name 'beam) beam) + ((eq? action-name 'bezier-sandwich) bezier-sandwich) + ((eq? action-name 'bracket) bracket) + ((eq? action-name 'char) char) + ((eq? action-name 'dashed-line) dashed-line) + ((eq? action-name 'dashed-slur) dashed-slur) + ((eq? action-name 'hairpin) hairpin) + ((eq? action-name 'experimental-on) experimental-on) + ((eq? action-name 'ez-ball) ez-ball) + ((eq? action-name 'filledbox) filledbox) + ((eq? action-name 'repeat-slash) repeat-slash) + ((eq? action-name 'select-font) select-font) + ((eq? action-name 'volta) volta) + (else (error "unknown tag -- PDF-SCM " action-name)) + ) + ) + +(define (scm-pdf-output) + (ly-eval (pdf-scm 'all-definitions))) + +; Local Variables: +; scheme-program-name: "guile" +; End: \ No newline at end of file diff --git a/scm/pdftex.scm b/scm/pdftex.scm new file mode 100644 index 0000000000..01d16ec145 --- /dev/null +++ b/scm/pdftex.scm @@ -0,0 +1,248 @@ +;;; pdftex.scm -- implement Scheme output routines for PDFTeX +;;; +;;; source file of the GNU LilyPond music typesetter +;;; modified from the existing tex.scm +;;; +;;; (c) 1998--2001 Jan Nieuwenhuizen +;;; Han-Wen Nienhuys +;;; Stephen Peters + +(define (pdftex-scm action-name) + (define (unknown) + "%\n\\unknown%\n") + + + (define (select-font name-mag-pair) + (let* + ( + (c (assoc name-mag-pair font-name-alist)) + ) + + (if (eq? c #f) + (begin + (display "FAILED\n") + (display (object-type (car name-mag-pair))) + (display (object-type (caaar font-name-alist))) + + (ly-warn (string-append + "Programming error: No such font known " + (car name-mag-pair) " " + (ly-number->string (cdr name-mag-pair)) + )) + "") ; issue no command + (string-append "\\" (cddr c))) + + + )) + + (define (beam width slope thick) + (embedded-pdf ((pdf-scm 'beam) width slope thick))) + + (define (bracket arch_angle arch_width arch_height height arch_thick thick) + (embedded-pdf ((pdf-scm 'bracket) arch_angle arch_width arch_height height arch_thick thick))) + + (define (dashed-slur thick dash l) + (embedded-pdf ((pdf-scm 'dashed-slur) thick dash l))) + + (define (hairpin thick w sh eh) + (embedded-pdf ((pdf-scm 'hairpin) thick w sh eh))) + + (define (char i) + (string-append "\\char" (inexact->string i 10) " ")) + + (define (dashed-line thick on off dx dy) + (embedded-pdf ((pdf-scm 'dashed-line) thick on off dx dy))) + + (define (font-load-command name-mag command) + (string-append + "\\font\\" command "=" + (car name-mag) + " scaled " + (ly-number->string (inexact->exact (* 1000 (cdr name-mag)))) + "\n")) + + (define (ez-ball c l b) + (embedded-pdf ((pdf-scm 'ez-ball) c l b))) + + (define (embedded-pdf s) + (string-append "\\embeddedpdf{ " s "}")) + + (define (comment s) + (string-append "% " s)) + + (define (end-output) + (begin +; uncomment for some stats about lily memory +; (display (gc-stats)) + (string-append "\n\\EndLilyPondOutput" + ; Put GC stats here. + ))) + + (define (experimental-on) + "") + + (define (repeat-slash w a t) + (embedded-pdf ((pdf-scm 'repeat-slash) w a t))) + + (define (font-switch i) + (string-append + "\\" (font i) "\n")) + + (define (font-def i s) + (string-append + "\\font" (font-switch i) "=" s "\n")) + + (define (header-end) + (string-append + "\\input lilyponddefs\\newdimen\\outputscale \\outputscale=\\lilypondpaperoutputscale pt" + "\\turnOnPostScript" + "\\pdfcompresslevel=0")) + + ;; Note: this string must match the string in ly2dvi.py!!! + (define (header creator generate) + (string-append + "% Generated automatically by: " creator generate "\n")) + + (define (invoke-char s i) + (string-append + "\n\\" s "{" (inexact->string i 10) "}" )) + + (define (invoke-dim1 s d) + (string-append + "\n\\" s "{" (number->dim d) "}")) + (define (pt->sp x) + (* 65536 x)) + + ;; + ;; need to do something to make this really safe. + ;; + (define (output-tex-string s) + (if security-paranoia + (if use-regex + (regexp-substitute/global #f "\\\\" s 'pre "$\\backslash$" 'post) + (begin (display "warning: not paranoid") (newline) s)) + s)) + + (define (lily-def key val) + (let ((tex-key + (if use-regex + (regexp-substitute/global + #f "_" (output-tex-string key) 'pre "X" 'post) + (output-tex-string key))) + (tex-val (output-tex-string val))) + (if (equal? (sans-surrounding-whitespace tex-val) "") + (string-append "\\let\\" tex-key "\\undefined\n") + (string-append "\\def\\" tex-key "{" tex-val "}\n")))) + + (define (number->dim x) + (string-append + ;;ugh ly-* in backend needs compatibility func for standalone output + (ly-number->string x) " \\outputscale ")) + + (define (placebox x y s) + (string-append + "\\placebox{" + (number->dim y) "}{" (number->dim x) "}{" s "}\n")) + + (define (bezier-sandwich l thick) + (embedded-pdf ((pdf-scm 'bezier-sandwich) l thick))) + + (define (start-line ht) + (string-append"\\vbox to " (number->dim ht) "{\\hbox{%\n")) + + (define (stop-line) + "}\\vss}\\interscoreline\n") + (define (stop-last-line) + "}\\vss}") + (define (filledbox breapth width depth height) + (string-append + "\\kern" (number->dim (- breapth)) + "\\vrule width " (number->dim (+ breapth width)) + "depth " (number->dim depth) + "height " (number->dim height) " ")) + + (define (text s) + (string-append "\\hbox{" (output-tex-string s) "}")) + + (define (tuplet ht gapx dx dy thick dir) + (embedded-pdf ((pdf-scm 'tuplet) ht gapx dx dy thick dir))) + + (define (volta h w thick vert_start vert_end) + (embedded-pdf ((pdf-scm 'volta) h w thick vert_start vert_end))) + + (define (define-origin file line col) + (if (procedure? point-and-click) + (string-append "\\special{src:\\string:" + (point-and-click line col file) + "}" ) + "") + ) + + ; no-origin not supported in PDFTeX + (define (no-origin) "") + + ;; The procedures listed below form the public interface of + ;; PDFTeX-scm. (should merge the 2 lists) + (cond ((eq? action-name 'all-definitions) + `(begin + (define font-load-command ,font-load-command) + (define beam ,beam) + (define bezier-sandwich ,bezier-sandwich) + (define bracket ,bracket) + (define char ,char) + (define dashed-line ,dashed-line) + (define dashed-slur ,dashed-slur) + (define hairpin ,hairpin) + (define end-output ,end-output) + (define experimental-on ,experimental-on) + (define filledbox ,filledbox) + (define font-def ,font-def) + (define font-switch ,font-switch) + (define header-end ,header-end) + (define lily-def ,lily-def) + (define ez-ball ,ez-ball) + (define header ,header) + (define invoke-char ,invoke-char) + (define invoke-dim1 ,invoke-dim1) + (define placebox ,placebox) + (define select-font ,select-font) + (define start-line ,start-line) + (define stop-line ,stop-line) + (define stop-last-line ,stop-last-line) + (define text ,text) + (define tuplet ,tuplet) + (define volta ,volta) + (define define-origin ,define-origin) + (define no-origin ,no-origin) + (define repeat-slash ,repeat-slash) + )) + + ((eq? action-name 'beam) beam) + ((eq? action-name 'tuplet) tuplet) + ((eq? action-name 'bracket) bracket) + ((eq? action-name 'hairpin) hairpin) + ((eq? action-name 'dashed-line) dashed-line) + ((eq? action-name 'dashed-slur) dashed-slur) + ((eq? action-name 'end-output) end-output) + ((eq? action-name 'experimental-on) experimental-on) + ((eq? action-name 'font-def) font-def) + ((eq? action-name 'font-switch) font-switch) + ((eq? action-name 'header-end) header-end) + ((eq? action-name 'lily-def) lily-def) + ((eq? action-name 'header) header) + ((eq? action-name 'invoke-char) invoke-char) + ((eq? action-name 'invoke-dim1) invoke-dim1) + ((eq? action-name 'placebox) placebox) + ((eq? action-name 'bezier-sandwich) bezier-sandwich) + ((eq? action-name 'start-line) start-line) + ((eq? action-name 'stem) stem) + ((eq? action-name 'stop-line) stop-line) + ((eq? action-name 'stop-last-line) stop-last-line) + ((eq? action-name 'volta) volta) + ((eq? action-name 'repeat-slash) repeat-slash) + (else (error "unknown tag -- PDFTEX " action-name)) + ) + ) + +(define (scm-pdftex-output) + (ly-eval (pdftex-scm 'all-definitions))) diff --git a/tex/lily-pdf-defs.tex b/tex/lily-pdf-defs.tex index 5e91c0da92..67c8a88f1d 100644 --- a/tex/lily-pdf-defs.tex +++ b/tex/lily-pdf-defs.tex @@ -1,283 +1,15 @@ -% A Native PDF version of lily-ps-defs.tex, in which the language -% features of the PS code are handled by TeX. This takes the place of -% lilyponddefs.ps, lily.ps, and lily-ps-defs.tex for PDFTeX. -% -% Note that this file will probably require changes if the lily.ps -% file changes, which is annoying in the long run. It might be best -% if sometime the intelligence embodied in lily.ps could be moved up -% to the GUILE level, so that the \embeddedps commands could consist -% simply of moveto, lineto, curveto, fill, and stroke commands, with -% numeric arguments. Such a setup would allow this file to be simpler -% and probably cause the resulting PostScript code to be faster as -% well. +% Defines an embeddedpdf command so that we can do the right thing. -% Redefine @ and _ so we can use them in definition names here. -\catcode`\@=11 -\catcode`\_=11 - -% Define a helper procedure for PDF coding. This file really -% shouldn't be read if \pdfliteral is undefined, but the alternate -% definition is nice for testing. - -\ifx\pdfliteral\undefined - \def\LYPDF#1{\message{[ignored pdfliteral: #1]}} -\else - \let\LYPDF=\pdfliteral -\fi - -% Strip 'pt' off of dimensions. Borrowed from latex. -\begingroup - \catcode`P=12 - \catcode`T=12 - \lowercase{ - \def\x{\def\lypdf@rempt##1.##2PT{##1\ifnum##2>\z@.##2\fi}}} - \expandafter\endgroup\x -\def\lypdf@strippt{\expandafter\lypdf@rempt\the} - -\def\LYDIM#1{\expandafter\lypdf@strippt\dimen#1\space} - -\def\lypdf@correctfactor{65536} -\def\lypdf@divcorrect#1{\multiply\dimen#1 \lypdf@correctfactor\relax} - -%% Stack handling. The design for this is borrowed from supp-pdf.tex - -\newcount\nofLYPDFargs -\def\@@LYPDF{@@LYPDF} - -% Add an argument to the `stack' -\def\setLYPDFarg#1{ - \advance\nofLYPDFargs by 1 - \expandafter\def - \csname\@@LYPDF\the\nofLYPDFargs\endcsname - {#1} -} - -% Get the values for stack variables. The a form includes a closing -% \space and is thus useful for embedding in \LYPDF macros. -\def\gLYPDFa#1 - {\csname\@@LYPDF#1\endcsname\space} -\def\gLYPDFan#1 - {\csname\@@LYPDF#1\endcsname} - -% Reset the stack back to normal. -\def\resetLYPDFstack{\nofLYPDFargs=0} - -% A translator for \embeddedps commands. This simply stacks up the -% arguments and then passes the last arg to the appropriate lypdf@name -% macro. - -\def\embeddedps#1{ - \lypdf@handleArgs#1 \\} - -%% Handle the argument list. Note: when working with arrays, just -%% keep tacking things onto a string until we get a close bracket. -%% The various LYPDFarray... variables are used for that. -\newif\ifLYPDFarray -\def\LYPDFarraystart{[} -\def\LYPDFarrayend{]} -\def\LYPDFarraystring{} - -\def\lypdf@{lypdf@} -\def\lypdf@handleArgs#1 #2\\{ - \ifx\\#2\\% - \csname\lypdf@#1\endcsname - \resetLYPDFstack - \else - \edef\argstring{#1} - \ifLYPDFarray% - \edef\LYPDFarraystring{\LYPDFarraystring\space\argstring} - \ifx\argstring\LYPDFarrayend% - \LYPDFarrayfalse - \setLYPDFarg{\LYPDFarraystring} - \fi - \else - \ifx\argstring\LYPDFarraystart% - \LYPDFarraytrue - \edef\LYPDFarraystring{[} - \else - \setLYPDFarg{#1} - \fi - \fi - \lypdf@handleArgs#2\\ - \fi} - -% Here turning on PostScript sets up the bracket stuff. This should -% probably be called by a more generic header macro. -\def\turnOnPostScript{\lypdf@load_bracket_dimens}% -\def\turnOnExperimentalFeatures{}% - -%% TODO: lily-ps-defs sets a linecap of 1. I'm not yet sure how to do that -%% for the Page Description level in PDFTeX. - -%% What follows are the definitions for the embeddedps commands. -%% Notes that in general, \dimen0 and \dimen1 are the x and y -%% positions of the cursor (used for rlineto handling), and dimen2-9 -%% are used for local dimension handling in the various commands. - -\def\lypdf@resetstring{\edef\lypdf@curstring{}} - -\def\lypdf@moveto#1#2{ - \dimen0=#1pt - \dimen1=#2pt - \edef\lypdf@curstring{\lypdf@curstring\space\LYDIM0 \LYDIM1 m} -} - -\def\lypdf@rmoveto#1#2{ - \advance\dimen0 by #1 pt - \advance\dimen1 by #2 pt - \edef\lypdf@curstring{\lypdf@curstring\space\LYDIM0 \LYDIM1 m} -} - -\def\lypdf@rlineto#1#2{ - \advance\dimen0 by #1 pt - \advance\dimen1 by #2 pt - \edef\lypdf@curstring{\lypdf@curstring\space\LYDIM0 \LYDIM1 l} +\def\lilySpace{ } +\def\turnOnPostScript{% + % This sets CTM so that you get to the currentpoint + % by executing a 0 0 moveto + \def\embeddedpdf##1{% + \pdfliteral{q \lilypondpaperoutputscale\lilySpace 0 0 % + \lilypondpaperoutputscale\lilySpace 0 0 cm% + ##1 Q}% + } } -\def\lypdf@draw_beam{% takes width, slope, thick - \dimen2=\gLYPDFa3 pt\divide\dimen2 by 2 - \dimen3=\gLYPDFa1 pt\dimen3=\gLYPDFa2 \dimen3 - \lypdf@resetstring - \lypdf@moveto{0}{-\LYDIM2} - \lypdf@rlineto{\gLYPDFa1}{\LYDIM3} - \lypdf@rlineto{0}{\gLYPDFa3} - \LYPDF{\lypdf@curstring\space 0 \LYDIM2 l b} -} - -\def\lypdf@draw_decrescendo{% takes width, ht, cont, thick - \LYPDF{\gLYPDFa4 w - \gLYPDFa1 \gLYPDFa3 m 0 \gLYPDFa2 l S - \gLYPDFa1 -\gLYPDFa3 m 0 -\gLYPDFa2 l S} -} -\def\lypdf@draw_crescendo{% takes width, ht, cont, thick - \LYPDF{\gLYPDFa4 w - 0 \gLYPDFa3 m \gLYPDFa1 \gLYPDFa2 l S -\gLYPDFa3 m - \gLYPDFa1 -\gLYPDFa2 l S} -} - -\def\lypdf@draw_tuplet{% takes height, gap, dx, dy, thickness, dir - \dimen2=\gLYPDFa1 pt\multiply\dimen2 by \gLYPDFa6 \relax - % height*dir - \dimen3=\gLYPDFa2 pt % tuplet_gapx - \dimen0=\gLYPDFa3 pt - \dimen4=\gLYPDFa4 \dimen3 \divide\dimen4 by \dimen0 - \lypdf@divcorrect4 % tuplet_gapy - \dimen5=\gLYPDFa3 pt \advance\dimen5 by-\dimen3 - \divide\dimen5 by 2 % (dx-gx)/2 - \dimen6=\gLYPDFa4 pt \advance\dimen6 by-\dimen4 - \divide\dimen6 by 2 % (dx-gx)/2 - - \lypdf@resetstring - \lypdf@moveto{0}{0} - \lypdf@rlineto{0}{\LYDIM2} - \lypdf@rlineto{\LYDIM5}{\LYDIM6} - \lypdf@rmoveto{\LYDIM3}{\LYDIM4} - \lypdf@rlineto{\LYDIM5}{\LYDIM6} - \lypdf@rlineto{0}{-\LYDIM2} - \LYPDF{\gLYPDFa5 w 1 j 1 J \lypdf@curstring} -} - -\def\lypdf@draw_volta{% takes height, width, thickness, v_start, v_end - \dimen2=\gLYPDFa1 pt % volta height - \ifnum\gLYPDFa4 =0 - \edef\vstartstr{0 0 m 0 \LYDIM2 l\space} - \else - \edef\vstartstr{0 \LYDIM2 m\space} - \fi - \ifnum\gLYPDFa5 =0 - \edef\vendstr{\gLYPDFa2 0 l\space} - \else - \edef\vendstr{} - \fi - \LYPDF{\gLYPDFa3 w 1 J 1 j \vstartstr \gLYPDFa2 \LYDIM2 l \vendstr S} -} - -\def\lypdf@draw_bezier_sandwich{% sixteen coords, thickness - \LYPDF{\gLYPDFa17 w - \gLYPDFa15 \gLYPDFa16 m - \gLYPDFa9 \gLYPDFa10 \gLYPDFa11 \gLYPDFa12 \gLYPDFa13 \gLYPDFa14 c - \gLYPDFa7 \gLYPDFa8 l - \gLYPDFa1 \gLYPDFa2 \gLYPDFa3 \gLYPDFa4 \gLYPDFa5 \gLYPDFa6 c - b}} - -\def\lypdf@draw_dashed_slur{% - \LYPDF{1 J 1 j \gLYPDFa10 \gLYPDFa11 d \gLYPDFa9 w - \gLYPDFa1 \gLYPDFa2 m - \gLYPDFa3 \gLYPDFa4 \gLYPDFa5 \gLYPDFa6 \gLYPDFa7 \gLYPDFa8 c - S}} - -%% Definitions for the various dimensions used by the brackets. -\newdimen\lypdf@interline -\newdimen\lypdf@bracket_b -\newdimen\lypdf@bracket_w -\newdimen\lypdf@bracket_v -\newdimen\lypdf@bracket_u -\newdimen\lypdf@bracket_t - -\def\lypdf@load_bracket_dimens{ - \lypdf@interline=\lilypondpaperinterline pt - \lypdf@bracket_b=0.3333\lypdf@interline - \lypdf@bracket_w=2\lypdf@interline - \lypdf@bracket_v=1.5\lypdf@interline - \lypdf@bracket_u=\lypdf@bracket_v - \lypdf@bracket_t=\lilypondpaperstaffline pt - \lypdf@bracket_t=2\lypdf@bracket_t - \relax -} - -%alpha=50. We calculate the sin and cos directly because TeX can't. -\def\lypdf@bracket_sin{0.76604}% -\def\lypdf@bracket_cos{0.64279}% - -\def\lypdf@draw_half_bracket{% dimen2 is the bracket height - \dimen3=\dimen2\advance\dimen3 by -\lypdf@bracket_t % h - t - - % Here, dimen0 and dimen1 are the end points of the bracket - \dimen0=\lypdf@bracket_b\relax\advance\dimen0 by \lypdf@bracket_v - \dimen1=\dimen3\advance\dimen1 by \lypdf@bracket_u - - % bottom of half bracket and inner side - \edef\lypdf@halfbrack{0 0 m \lypdf@strippt\lypdf@bracket_b\space 0 l - \lypdf@strippt\lypdf@bracket_b\space \LYDIM3 l} - - % inner curve -- first control point is just 0.4*v to the right - \dimen4=\lypdf@bracket_b\advance\dimen4 by 0.4\lypdf@bracket_v - % ... second point is calc'd using alpha - \dimen5=-0.25\lypdf@bracket_v\relax - \dimen6=\dimen0\advance\dimen6 by \lypdf@bracket_cos\dimen5\relax - \dimen7=\dimen1\advance\dimen7 by \lypdf@bracket_sin\dimen5\relax - % draw the curve - \edef\lypdf@halfbrack - {\lypdf@halfbrack\space\LYDIM4 \LYDIM3 \LYDIM6 \LYDIM7 \LYDIM0 \LYDIM1 c} - - % outer curve -- second control point is just .5*v to the right - % (plus 1 pt) - \dimen4=0.5\lypdf@bracket_v\advance\dimen4 by 1pt - % ... first point is calc'd using alpha - \dimen5=-0.15\lypdf@bracket_v\relax - \dimen6=\dimen0\advance\dimen6 by \lypdf@bracket_cos\dimen5\relax - \dimen7=\dimen1\advance\dimen7 by \lypdf@bracket_sin\dimen5\relax - % draw the curve, close, stroke, fill - \edef\lypdf@halfbrack - {\lypdf@halfbrack\space\LYDIM6 \LYDIM7 \LYDIM4 \LYDIM2 0 \LYDIM2 c b} -} - -\def\lypdf@draw_bracket{% height - \dimen2=\gLYPDFa1 pt \divide\dimen2 by 2 - \advance\dimen2 by \lypdf@bracket_b\relax - % calculate the half bracket - \lypdf@draw_half_bracket - % set up graphics state, gsave, and flip the coord system - % then draw both half brackets. - \LYPDF{\lypdf@strippt\lypdf@bracket_t\space w - 1 J 1 j q 1 0 0 -1 0 0 cm - \lypdf@halfbrack\space Q \lypdf@halfbrack} - } - - -%% Clean up after ourselves. - -\catcode`\@=12 -\catcode`\_=8 +\def\turnOnExperimentalFeatures{} -\endinput diff --git a/tex/lilyponddefs.tex b/tex/lilyponddefs.tex index aaeab27d9c..de417a1ddd 100644 --- a/tex/lilyponddefs.tex +++ b/tex/lilyponddefs.tex @@ -51,8 +51,7 @@ \def\placebox#1#2#3{% \botalign{\hbox{\raise #1\leftalign{\kern #2{}#3}}}}% -% Are we using PDFTeX? If so, use pdf definitions to translate -% \embeddedps commands to embedded PDF. +% Are we using PDFTeX? If so, use pdf definitions. \ifx\pdfoutput\undefined \input lily-ps-defs \else