From e3feba6290cb220921e03229f5b82b325d582037 Mon Sep 17 00:00:00 2001 From: Tom Cato Amundsen Date: Sat, 7 Nov 1998 13:26:24 +0100 Subject: [PATCH] patch::: 1.1.3.tca1 pl 3.tca1 - accordion symbols in mf/feta-accordion.mf and init/accordion-defs.ly. - small changes to mudela-book and Documentation/man/mudela-book.yo - mudela-book example file in Documentation/tex/mudela-book-doc.doc --- Documentation/man/mudela-book.yo | 41 ++- Documentation/tex/mudela-book-doc.doc | 209 +++++++++++++ NEWS | 5 + VERSION | 2 +- buildscripts/set-lily.sh | 3 +- init/accordion-defs.ly | 55 ++++ mf/feta-accordion.mf | 411 ++++++++++++++++++++++++++ mf/feta-schrift.mf | 1 + scripts/mudela-book.py | 151 ++++++---- 9 files changed, 818 insertions(+), 60 deletions(-) create mode 100644 Documentation/tex/mudela-book-doc.doc create mode 100644 init/accordion-defs.ly create mode 100644 mf/feta-accordion.mf diff --git a/Documentation/man/mudela-book.yo b/Documentation/man/mudela-book.yo index c6f2dce08d..a3e854d892 100644 --- a/Documentation/man/mudela-book.yo +++ b/Documentation/man/mudela-book.yo @@ -13,6 +13,8 @@ metalC(Automatically generated by yodl(1) from mudela-book.yo.) manpagename(mudela-book)(integrate LaTeX and mudela) +manpagesynopsis() bf(mudela-book) [options] inputfile + manpagedescription() file(mudela-book) is a script that helps integrating mudela and LaTeX(). mudela-book runs LilyPond on fragments of mudela in your source file, and includes the results into @@ -33,32 +35,57 @@ surrounded by code(\preMudelaExample) and code(\postMudelaExample) commands. The code(\begin) takes the following options: description( +dit(floating) + the created graphics can be inserted in the middle of a text line, + not only as a separate paragraph dit(fragment) mudela-book adds some redtape. You can substitute voice-contents for CONTENTS in this case. dit(verbatim) CONTENTS is copied into the TeX source enclosed in a verbatim block. +dit(11pt, 13pt, 16pt, 20pt, 26pt) + set the fontsize to use for the music ) -manpagesection(Synopsis) +manpageoptions() -description( +startdit() + +dit(--mudela-fontsize) + Set the fontsize to use for mudela if no fontsize is given + as option. +dit(--force-mudela-fontsize) + Force all mudela to use this fontsize, overriding options + given to \begin{mudela} dit(--outname) The name of LaTeX() file to output. If this option is not given, -the output name derived from the input name. The extension file(.doc) -is stripped, and code(.mudtex) appended. +the output name derived from the input name. dit(--outdir) The directory to output lilypond output and input to. dit(--help) print a short help message -) +dit(--dependencies) + write dependencies to outdir/filname.dep +enddit() + +manpagefiles() + You have to install LaTeX. file(mudela-book) is not tested on LaTeX 2.09 + and will probably fail on something else than LaTeX2e. + + file(mudela-book) is written in python 1.5, so you have to install + url(python)(http://www.python.org). manpagebugs() -Doesn't handle incorrect input sanely. mudela-book is written in -python, so you have install url(python)(http://www.python.org). +The LaTeX \includeonly{...} command is ignored. + +You get trouble if you use the --force-verbatim option and have some +music in \footnote{...} or \marginpar{...}. + +Ignores almost all LaTeX commands that changes margins and linewidths. manpageauthor() nemail(Han-Wen Nienhuys)(hanwen@cs.uu.nl), lurl(http://www.cs.uu.nl/people/hanwen) +nemail(Tom Cato Amundsen)(tomato@xoommail.com) diff --git a/Documentation/tex/mudela-book-doc.doc b/Documentation/tex/mudela-book-doc.doc new file mode 100644 index 0000000000..a5ffc1868d --- /dev/null +++ b/Documentation/tex/mudela-book-doc.doc @@ -0,0 +1,209 @@ +\documentclass[a4paper, 12pt, oneside]{article} + +\usepackage{t1enc,isolatin1} +\usepackage{graphics} +%\usepackage{showframe} +\sloppy +\def\postMudelaExample{\normalsize} +\begin{document} +%\printparam + +Mudela-book is a script that process your \LaTeX ~file and +translates blocks of mudela code it finds inside \verb|mudela| +environment to tex or eps graphics. It then creates a new +file that can be sent through \LaTeX~ to create a document with +lines of music integrated with text. + +So what does this look like? Well, here is a really +simple example: + +\begin{mudela}[fragment, verbatim] + \relative c'{c4 d e f | g2 g} +\end{mudela} + +As you can see the mudela code is put inside a environment +called \verb|mudela|, shouldn't be too difficult to remember. +If you have never heard about \LaTeX, Mudela or that stuff +about environment, you should probably read some other manuals +before this. + +The code above produces this music: + +\begin{mudela}[fragment, floating] + \relative c' {c4 d e f | g2 g} +\end{mudela} + + +The parameter \verb|fragment| means that mudela-book will insert +some red tape for you. There are one thing to remember. Currently +\verb|fragment|s don't know about margins and line width, so if +you type more than a few bars and want a line break, you can not +use \verb|fragment|. The \verb|verbatim| parameter is used to +make mudela-book print the mudela source instead of the +music. The parameter will probably not be visible in later versions +of mudela-book. + +If you use \verb|\default_paper| as your paper, mudela-book will +(I hope) adjust the music to reach from the left to the right margin. +The following code +\begin{mudela}[verbatim] +\score{ + \notes\relative c'{c d e f | g2 g | a4 a a a | g1 | + f4 f f f | e2 e | d4 d d d | c1} + \paper{\default_paper} +} +\end{mudela} +gives this music: +\begin{mudela} +\score{ + \notes\relative c'{c d e f | g2 g | a4 a a a | g1 | + f4 f f f | e2 e | d4 d d d | c1} + \paper{\default_paper} +} +\end{mudela} + +On my Debian 2.0 with LilyPond 1.0.17, teTex 0.9, +a4 paper and default line widht, the music is printet with +7 bars on the first line and 1 bars on the second. + +This does not look to well, but you can fix it by setting +the \verb|linewidth| variable to, let's say 8 cm. The paper +definition +\begin{verbatim} +\paper{\default_paper +linewidth=8.\cm;} +\end{verbatim} +makes this score: + +\begin{mudela} +\score{ + \notes\relative c'{c d e f | g2 g | a4 a a a | g1 | + f4 f f f | e2 e | d4 d d d | c1} + \paper{\default_paper + linewidth=8.\cm;} +} +\end{mudela} + +The \verb|linewidth| variable is a LilyPond paper variable. +It is not spesific to mudela-book. See LilyPond tutorial and +reference manual for other variables. + +You can also, +\begin{mudela}[fragment, floating] + \relative c'{c c g' g | a a g2} +\end{mudela} +~include music in the middle of your text. Just give the option +\verb|floating| to \verb|\begin{mudela}| + +Oh, you think the notes are to big to be in the middle of all those +small characters, that something like this, +\begin{mudela}[fragment, floating, 11pt] + \relative c'{c c g' g | a a g2} +\end{mudela} +~is better? If you have a lot of small music examples like this +in the middle of your text, you might get a nicer look by using +``double'' line spacing. Put the \verb|\linespread{1.6}| command +into the preamble of your document. Then the line spacing will not +be increased between the lines where you have music printed with the +smalles font size. + + +To change font size is easy, just give the fontsize as a parameter to +\verb|\begin{mudela}|. The last piece of music was created with this +code: +\begin{mudela}[fragment, floating, 11pt, verbatim] + \relative c'{c c g' g | a a g2} +\end{mudela} + +You can use the following font sizes: +\begin{itemize} +\item 11 pt +\begin{mudela}[11pt, fragment, floating] + \relative c'{ + r16 [c d e][f d e c] [g'8 c][b-\prall c] | + [d16 g, a b][c a b g][d'8 g f-\prall g] + } +\end{mudela} +\item 13 pt +\begin{mudela}[13pt, fragment, floating] + \relative c'{ + r16 [c d e][f d e c] [g'8 c][b-\prall c] | + [d16 g, a b][c a b g][d'8 g f-\prall g] + } +\end{mudela} +\item 16 pt +\begin{mudela}[16pt, fragment, floating] + \relative c'{ + r16 [c d e][f d e c] [g'8 c][b-\prall c] | + [d16 g, a b][c a b g][d'8 g f-\prall g] + } +\end{mudela} +\item 20 pt +\begin{mudela}[20pt, fragment, floating] + \relative c'{ + r16 [c d e][f d e c] [g'8 c][b-\prall c] | + [d16 g, a b][c a b g][d'8 g f-\prall g] + } +\end{mudela} +\item 26 pt +\begin{mudela}[26pt, fragment, floating] + \relative c'{ + r16 [c d e][f d e c] [g'8 c][b-\prall c] | + [d16 g, a b][c a b g][d'8 g f-\prall g] + } +\end{mudela} +\end{itemize} + +As\marginpar{ +marginpar! +\begin{mudela}[11pt, fragment, floating] + \relative c''{\key es; r8 [g g g] es2} +\end{mudela} +} +you can see, \verb|floating| mudela don't know about margins. +Remember that to place the music anywhere\footnote{ +footnote! +\begin{mudela}[11pt, fragment, floating] + \relative c''{\key es; r8 [g g g] es2} +\end{mudela} +} + else than at the left margin you must use the option \verb|floating|. + +\twocolumn[\Large The following is written in two columns \normalsize] +Sinse the version number is quite low, 0.4.0 last I checked, you +should be careful not to mix braces that belongs to mudela-book and +\LaTeX ~on the same line. The following code will probably break: + +\verb|\footnote{\be|\verb|gin{mudela}| + +\verb|\relative c''{ \key es; r8 [g g g] es2} | + +\verb|\e|\verb|nd{mudela}}| + +Mudela-book does know about \verb|\onecolumn| and \verb|\twocolumn|. +So the music will be adjusted to the new linewith: +\begin{mudela}[verbatim] +\score{ + \notes\relative c'{c d e f | g2 g | a4 a a a | g1 | + f4 f f f | e2 e | d4 d d d | c1} + \paper{\default_paper} +} +\end{mudela} +produces +\begin{mudela} +\score{ + \notes\relative c'{c d e f | g2 g | a4 a a a | g1 | + f4 f f f | e2 e | d4 d d d | c1} + \paper{\default_paper} +} +\end{mudela} + +As in one column mode, \verb|fragment|s don't know about +the line width: +\begin{mudela}[fragment] + \relative c'{[c8 e][d f][e g][f a] | [g b][a c][b d] c4 | + [e8 c][d b][c a][b g] | [a f][g e][f d] c4 } +\end{mudela} +Verbatim environments will also ignore the page margins. That is +a feature of \LaTeX. +\end{document} \ No newline at end of file diff --git a/NEWS b/NEWS index d5d19e5b7b..0595cce22e 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +pl 3.tca1 + - accordion symbols in mf/feta-accordion.mf and + init/accordion-defs.ly. + - small changes to mudela-book and Documentation/man/mudela-book.yo + - mudela-book example file in Documentation/tex/mudela-book-doc.doc pl 2.jcn2 pl 2.uu1 diff --git a/VERSION b/VERSION index b3ee0f556a..1d931661d6 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=1 PATCH_LEVEL=3 -MY_PATCH_LEVEL=jcn1 +MY_PATCH_LEVEL=tca1 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/buildscripts/set-lily.sh b/buildscripts/set-lily.sh index bbacf89292..c1db5b8408 100755 --- a/buildscripts/set-lily.sh +++ b/buildscripts/set-lily.sh @@ -42,7 +42,8 @@ fi ln -sf $LILYPOND_SOURCEDIR/lily/out/lilypond $prefix/bin/lilypond ln -sf $LILYPOND_SOURCEDIR/mi2mu/out/mi2mu $prefix/bin/mi2mu -ln -sf $LILYPOND_SOURCEDIR/scripts/ly2dvi.sh $prefix/bin/ly2dvi +ln -sf $LILYPOND_SOURCEDIR/scripts/out/ly2dvi $prefix/bin/ly2dvi +ln -sf $LILYPOND_SOURCEDIR/scripts/out/mudela-book $prefix/bin/mudela-book chmod 755 $LILYPOND_SOURCEDIR/buildscripts/ps-to-gifs.sh ln -sf $LILYPOND_SOURCEDIR/buildscripts/ps-to-gifs.sh $prefix/bin/ps-to-gifs diff --git a/init/accordion-defs.ly b/init/accordion-defs.ly new file mode 100644 index 0000000000..12c4723467 --- /dev/null +++ b/init/accordion-defs.ly @@ -0,0 +1,55 @@ +% Symbols needed to print accordion music +% +% 2' = T +% 4' = F +% 8' = E +% 16' = S +% + +accDiscant = \script{ "accDiscant" 0 0 1 0 0 } +accDiscantF = \script{ "accDiscantF" 0 0 1 0 0 } +accDiscantE = \script{ "accDiscantE" 0 0 1 0 0 } +accDiscantEh = \script{ "accDiscantEh" 0 0 1 0 0 } +accDiscantFE = \script{ "accDiscantFE" 0 0 1 0 0 } +accDiscantFEh = \script{ "accDiscantFEh" 0 0 1 0 0 } +accDiscantEE = \script{ "accDiscantEE" 0 0 1 0 0 } +accDiscantFEE = \script{ "accDiscantFEE" 0 0 1 0 0 } +accDiscantEEE = \script{ "accDiscantEEE" 0 0 1 0 0 } +accDiscantFEEE = \script{ "accDiscantFEEE" 0 0 1 0 0 } +accDiscantS = \script{ "accDiscantS" 0 0 1 0 0 } +accDiscantFS = \script{ "accDiscantFS" 0 0 1 0 0 } +accDiscantES = \script{ "accDiscantES" 0 0 1 0 0 } +accDiscantEhS = \script{ "accDiscantEhS" 0 0 1 0 0 } +accDiscantFES = \script{ "accDiscantFES" 0 0 1 0 0 } +accDiscantFEhS = \script{ "accDiscantFEhS" 0 0 1 0 0 } +accDiscantEES = \script{ "accDiscantEES" 0 0 1 0 0 } +accDiscantFEES = \script{ "accDiscantFEES" 0 0 1 0 0 } +accDiscantEEES = \script{ "accDiscantEEES" 0 0 1 0 0 } +accDiscantFEEES = \script{ "accDiscantFEEES" 0 0 1 0 0 } +accDiscantSS = \script{ "accDiscantSS" 0 0 1 0 0 } +accDiscantESS = \script{ "accDiscantESS" 0 0 1 0 0 } +accDiscantEESS = \script{ "accDiscantEESS" 0 0 1 0 0 } +accDiscantEEESS = \script{ "accDiscantEEESS" 0 0 1 0 0 } + +accFreebass = \script{ "accFreebass" 0 0 1 0 0 } +accFreebassF = \script{ "accFreebassF" 0 0 1 0 0 } +accFreebassE = \script{ "accFreebassE" 0 0 1 0 0 } +accFreebassFE = \script{ "accFreebassFE" 0 0 1 0 0 } + +accBayanbass = \script{ "accBayanbass" 0 0 1 0 0 } +accBayanbassT = \script{ "accBayanbassT" 0 0 1 0 0 } +accBayanbassE = \script{ "accBayanbassE" 0 0 1 0 0 } +accBayanbassTE = \script{ "accBayanbassTE" 0 0 1 0 0 } +accBayanbassEE = \script{ "accBayanbassEE" 0 0 1 0 0 } +accBayanbassTEE = \script{ "accBayanbassTEE" 0 0 1 0 0 } + +accStdbass = \script{ "accStdbass" 0 0 1 0 0 } +accStdbassTp = \script{ "accStdbassTp" 0 0 1 0 0 } +accStdbassT = \script{ "accStdbassT" 0 0 1 0 0 } +accStdbassBp = \script{ "accStdbassBp" 0 0 1 0 0 } +accStdbassM = \script{ "accStdbassM" 0 0 1 0 0 } + +accSB = \script{ "accSB" 0 0 1 0 0 } +accBB = \script{ "accBB" 0 0 1 0 0 } +accOldEE = \script{ "accOldEE" 0 0 1 0 0 } +accOldEES = \script{ "accOldEES" 0 0 1 0 0 } diff --git a/mf/feta-accordion.mf b/mf/feta-accordion.mf new file mode 100644 index 0000000000..0067bb3c4a --- /dev/null +++ b/mf/feta-accordion.mf @@ -0,0 +1,411 @@ +% -*- Fundamental -*- + +accreg_dot_size# := .7interline#; +accreg_linethickness# := 1.3stafflinethickness#; + +% This dimention is the same on all registersymbols. +% The different symbols should calculate their other +% dimensions from this and accreg_dot_size +accreg_lh# := 1.2interline#; + +define_pixels(accreg_dot_size, accreg_linethickness, accreg_lh); +pen accreg_pen; +accreg_pen := pencircle xscaled accreg_linethickness yscaled 0.7accreg_linethickness; +def draw_discant_reg(expr A, B, C, D, E, F) = + save r, sx; + r# = 3/2accreg_lh#; + define_pixels(r); +% set_char_box(r#, r#, 2r#, 0); + set_char_box(r#, r#, 0r#, 2r#); %% arg3 = under linjen, arg4 = over + pickup accreg_pen; + draw fullcircle scaled 2r; + sx = cosd(19.471221); + draw (-sx*r, r/3)--(sx*r, r/3); + draw (-sx*r, -r/3)--(sx*r, -r/3); + + pickup pencircle scaled accreg_dot_size; + if A = 1: drawdot (0, 2/3r); fi + if B = 1: drawdot (r/2, 0); fi + if C = 1: drawdot (0, 0); fi + if D = 1: drawdot (-r/2, 0); fi + if E = 1: drawdot (0, -2/3r); fi + if F = 1: drawdot (-.25r, -.642r); drawdot (.25r, -.642r); fi + currentpicture := currentpicture shifted (0, r); +enddef; + +def draw_freebass_reg(expr rFour, rEight) = + save r; + r#= accreg_lh#; + define_pixels(r); + set_char_box(r#, r#, 0, 2r#); + pickup accreg_pen; + draw fullcircle scaled 2r; + draw (-r, 0)--(r, 0); + pickup pencircle scaled accreg_dot_size; + if rFour = 1: draw (0, r/2); fi + if rEight = 1: draw (0, -r/2); fi + currentpicture := currentpicture shifted (0, r); +enddef; + +def draw_stdbass_reg(expr A, B, C, D, E) = + save r, sx; + r# = 2accreg_lh#; + define_pixels(r); + sx = cosd 30 ; + set_char_box(r#, r#, 0, 2r#); + pickup accreg_pen; + draw fullcircle scaled 2r; + draw (-r, 0)--(r, 0); + draw (-sx*r, r/2)--(sx*r, r/2); + draw (-sx*r, -r/2)--(sx*r, -r/2); + pickup pencircle scaled accreg_dot_size; + if A = 1: draw (0, -3/4r); fi + if B = 1: draw (0, -1/4r); fi + if C = 1: draw (0, 1/4r); fi + if D = 1: draw (0, 3/4r); fi + if E = 1: draw (1/2r, 0); fi + currentpicture := currentpicture shifted (0, r); +enddef; + +def draw_bayanbass_reg_sign(expr nTwo, nEight) = + save lh; + lh = accreg_lh; +% set_char_box(accreg_lh#, accreg_lh#, 3accreg_lh#, 0); + set_char_box(accreg_lh#, accreg_lh#, 0, 3accreg_lh#); + pickup pencircle scaled accreg_linethickness; + draw (0, 0)--(2w, 0)--(2w, 3accreg_lh)--(0, 3accreg_lh)--(0, 0); + draw (0, accreg_lh)--(2w, accreg_lh); + draw (0, 2accreg_lh)--(2w, 2accreg_lh); + + pickup pencircle scaled accreg_dot_size; + if nTwo = 1: draw (w, 5/2lh); fi + if nEight = 1: draw (w, lh/2); fi + if nEight = 2: draw (5/8w, lh/2); draw (11/8w, lh/2); fi + currentpicture := currentpicture shifted (-w, 0);% -3lh); +enddef; + +fet_beginchar("accDiscant", "accDiscant", "accDiscant") + draw_discant_reg(0, 0, 0, 0, 0, 0); +fet_endchar; + +fet_beginchar("accDiscantF", "accDiscantF", "accDiscantF") + draw_discant_reg(1, 0, 0, 0, 0, 0); +fet_endchar; + +fet_beginchar("accDiscantEh", "accDiscantEh", "accDiscantEh") + draw_discant_reg(0, 1, 0, 0, 0, 0); +fet_endchar; + +fet_beginchar("accDiscantE", "accDiscantE", "accDiscantE") + draw_discant_reg(0, 0, 1, 0, 0, 0); +fet_endchar; + +fet_beginchar("accDiscantFE", "accDiscantFE", "accDiscantFE") + draw_discant_reg(1, 0, 1, 0, 0, 0); +fet_endchar; + +fet_beginchar("accDiscantFEh", "accDiscantFEh", "accDiscantFEh") + draw_discant_reg(1, 1, 0, 0, 0, 0); +fet_endchar; + +fet_beginchar("accDiscantEE", "accDiscantEE", "accDiscantEE") + draw_discant_reg(0, 1, 0, 1, 0, 0); +fet_endchar; + +fet_beginchar("accDiscantFEE", "accDiscantFEE", "accDiscantFEE") + draw_discant_reg(1, 1, 0, 1, 0, 0); +fet_endchar; + +fet_beginchar("accDiscantEEE", "accDiscantEEE", "accDiscantEEE") + draw_discant_reg(0, 1, 1, 1, 0, 0); +fet_endchar; + +fet_beginchar("accDiscantFEEE", "accDiscantFEEE", "accDiscantFEEE") + draw_discant_reg(1, 1, 1, 1, 0, 0); +fet_endchar; + +fet_beginchar("accDiscantS", "accDiscantS", "accDiscantS") + draw_discant_reg(0, 0, 0, 0, 1, 0); +fet_endchar; + +fet_beginchar("accDiscantFS", "accDiscantFS", "accDiscantFS") + draw_discant_reg(1, 0, 0, 0, 1, 0); +fet_endchar; + +fet_beginchar("accDiscantES", "accDiscantES", "accDiscantES") + draw_discant_reg(0, 0, 1, 0, 1, 0); +fet_endchar; + +fet_beginchar("accDiscantEhS", "accDiscantEhS", "accDiscantEhS") + draw_discant_reg(0, 1, 0, 0, 1, 0); +fet_endchar; + +fet_beginchar("accDiscantFES", "accDiscantFES", "accDiscantFES") + draw_discant_reg(1, 0, 1, 0, 1, 0); +fet_endchar; + +fet_beginchar("accDiscantFEhS", "accDiscantFEhS", "accDiscantFEhS") + draw_discant_reg(1, 1, 0, 0, 1, 0); +fet_endchar; + +fet_beginchar("accDiscantEES", "accDiscantEES", "accDiscantEES") + draw_discant_reg(0, 1, 0, 1, 1, 0); +fet_endchar; + +fet_beginchar("accDiscantFEES", "accDiscantFEES", "accDiscantFEES") + draw_discant_reg(1, 1, 0, 1, 1, 0); +fet_endchar; + +fet_beginchar("accDiscantEEES", "accDiscantEEES", "accDiscantEEES") + draw_discant_reg(0, 1, 1, 1, 1, 0); +fet_endchar; + +fet_beginchar("accDiscantFEEES", "accDiscantFEEES", "accDiscantFEEES") + draw_discant_reg(1, 1, 1, 1, 1, 0); +fet_endchar; + +fet_beginchar("accDiscantSS", "accDiscantSS", "accDiscantSS") + draw_discant_reg(0, 0, 0, 0, 0, 1); +fet_endchar; + +fet_beginchar("accDiscantESS", "accDiscantESS", "accDiscantESS") + draw_discant_reg(0, 0, 1, 0, 0, 1); +fet_endchar; + +fet_beginchar("accDiscantEESS", "accDiscantEESS", "accDiscantEESS") + draw_discant_reg(0, 1, 0, 1, 0, 1); +fet_endchar; + +fet_beginchar("accDiscantEEESS", "accDiscantEEESS", "accDiscantEEESS") + draw_discant_reg(0, 1, 1, 1, 0, 1); +fet_endchar; + +fet_beginchar("accFreebass", "accFreebass", "accFreebass") + draw_freebass_reg(0, 0); +fet_endchar; + +fet_beginchar("accFreebassF", "accFreebassF", "accFreebassF") + draw_freebass_reg(1, 0); +fet_endchar; + +fet_beginchar("accFreebassE", "accFreebassE", "accFreebassE") + draw_freebass_reg(0, 1); +fet_endchar; + +fet_beginchar("accFreebassFE", "accFreebassFE", "accFreebassFE") + draw_freebass_reg(1, 1); +fet_endchar; + +fet_beginchar("accStdbass", "accStdbass", "accStdbass") + draw_stdbass_reg(0, 0, 0, 0, 0); +fet_endchar; + +fet_beginchar("accStdbassM", "accStdbassM", "accStdbassM") + draw_stdbass_reg(1, 1, 1, 1, 1); +fet_endchar; + +fet_beginchar("accStdbassBp", "accStdbassBp", "accStdbassBp") + draw_stdbass_reg(1, 1, 0, 0, 1); +fet_endchar; + +fet_beginchar("accStdbassT", "accStdbassT", "accStdbassT") + draw_stdbass_reg(0, 1, 1, 1, 0); +fet_endchar; + +fet_beginchar("accStdbassTp", "accStdbassTp", "accStdbassTp") + draw_stdbass_reg(0, 1, 1, 0, 0); +fet_endchar; + +fet_beginchar("accBayanbass", "accBayanbass", "accBayanbass") + draw_bayanbass_reg_sign(1, 0); +fet_endchar; + +fet_beginchar("accBayanbassT", "accBayanbassT", "accBayanbassT") + draw_bayanbass_reg_sign(1, 0); +fet_endchar; + +fet_beginchar("accBayanbassE", "accBayanbassE", "accBayanbassE") + draw_bayanbass_reg_sign(0, 1); +fet_endchar; + +fet_beginchar("accBayanbassTE", "accBayanbassTE", "accBayanbassTE") + draw_bayanbass_reg_sign(1, 1); +fet_endchar; + +fet_beginchar("accBayanbassEE", "accBayanbassEE", "accBayanbassEE") + draw_bayanbass_reg_sign(0, 2); +fet_endchar; + +fet_beginchar("accBayanbassTEE", "accBayanbassTEE", "accBayanbassTEE") + draw_bayanbass_reg_sign(1, 2); +fet_endchar; + +def def_B(expr w, h) = + pickup pencircle scaled 0.1pt; + penpos10(thin, -90); + penpos11(thin, -90); + penpos12(thick, 0); + penpos13(thin, 90); + penpos14(thin, 90); + penpos15(thick, 180); + penpos16(thin, -90); + penpos17(thin, -90); + penpos18(thick, 0); + penpos19(thick, 0); + z10 = (0, 0); + z11 = (cOne*w, 0); + z12 = (w, .5mb*h); + z13 = (cTwo*w, mb*h); + z14 = (2thick, mb*h); + z15 = (.94w, h-.5mt*h); + z16 = z13 + (0, mt*h); + z17 = (0, h); + z18 = (1.5thick, 0); + z19 = (1.5thick, h); +enddef; + +def def_S(expr w, h) = + pickup pencircle scaled 0.02pt; + penpos1(thin, 180); + penpos2(thin, -90); + penpos3(thick, 0); + penpos4(.5thick, 90); + penpos5(thick, 0); + penpos6(thin, -90); + penpos7(thin, 180); + penpos8(thin, 180); + penpos9(thin, 0); + z1 = (0, hs); + z2 = (w/2, 0); + z3 = (w-.5thick, .5mb*h); + z4 = (w/2, mb*h); + z5 = (.5thick, h-.5mt*h); + z6 = (w/2, h); + z7 = (w, h-hs); + z8 = (0, y2r); + z9 = (w, y6l); + path bue, bueoverst; + bue=z2{left}..z1{up}; + numeric t; + t:=xpart(bue intersectiontimes(z8l--z7l)); + show t; + bueoverst=z6{right}..z7{down}; +enddef; + +def def_some_vars = + save hs, mb, mt, thin, thick, height, width, cOne, cTwo; + width = .8staffsize; + height = 2.4interline; + thin = 0.05interline; + thick = 0.2interline; + hs = 0.4interline; + mb = .53; + mt = .47; + cOne = 0.65; + cTwo = 0.60; +enddef; + +fet_beginchar("accSB", "accSB", "accSB") + set_char_box(.4staffsize#, .4staffsize#, 0, 2.4interline#); + def_some_vars; + def_B(.35width, .7height); + penstroke z10e--z11e{right}..z12e{up}..z13e{left}--z14e; + penstroke z13e{right}..z15e{up}..z16e{left}--z17e; + penstroke z18e--z19e; + pickup pencircle scaled .5thick; + drawdot (.37width, .10thick); + currentpicture := currentpicture shifted(.40width, 0); + + def_S(.35width, .7height); +% penlabels(1, 2, 3, 4, 5, 6, 7, 8, 9); + filldraw z1r--z8r--z8l--subpath(t, 1) of bue--cycle; + filldraw subpath(t, 1) of bueoverst--z7l--z9r--z9l--cycle; + penstroke z1e{down}..z2e{right}..z3e + ..z4e + ..z5e..z6e{right}...z7e{down}; + pickup pencircle scaled .5thick; + drawdot (.37width, .10thick); + currentpicture := currentpicture shifted (-.40width, -.85height); + draw (-.5width, 0)--(.5width, 0)--(.5width, -height) + --(-.5width, -height)--(-.5width, 0); + currentpicture := currentpicture shifted (0, 2.4interline); +fet_endchar; + +fet_beginchar("accBB", "accBB", "accBB") + set_char_box(.4staffsize#, .4staffsize#, 0, 2.4interline#); + def_some_vars; + def_B(.35width, .7height); + penstroke z10e--z11e{right}..z12e{up}..z13e{left}--z14e; + penstroke z13e{right}..z15e{up}..z16e{left}--z17e; + penstroke z18e--z19e; + pickup pencircle scaled .5thick; + drawdot(.37width, .10thick); + currentpicture := currentpicture shifted (.40width, 0); + penstroke z10e--z11e{right}..z12e{up}..z13e{left}--z14e; + penstroke z13e{right}..z15e{up}..z16e{left}--z17e; + penstroke z18e--z19e; + drawdot(.37width, .10thick); + currentpicture := currentpicture shifted(-.40width, -.85height); + draw (-.5width, 0)--(.5width, 0)--(.5width, -height) + --(-.5width, -height)--(-.5width, 0); + currentpicture := currentpicture shifted (0, 2.4interline); +fet_endchar; + + +fet_beginchar("accOldEE", "accOldEE", "accOldEE") + set_char_box(interline#, interline#, 0, 2interline#); + show w; + show h; + r = interline; + lr = .3interline; + ir = .6interline; + pickup accreg_pen; + draw fullcircle scaled 2r; + pickup penrazor; + filldraw fullcircle scaled lr; + z1 = (ir, 0); + z2 = (0, 0) + ir*(dir 45); + z3 = (0, ir); + numeric pp; + for pp := 0 step 45 until 360: + filldraw fullcircle scaled lr shifted (ir*(dir pp)); + endfor; + for pp := 0 step 45 until 360: + filldraw ((0, 0)--(.2lr, ir)--(-.2lr, ir)--cycle) rotated pp; + endfor + currentpicture := currentpicture shifted (0, r); +fet_endchar; + +fet_beginchar("accOldEES", "accOldEES", "accOldEES") + set_char_box(interline#, interline#, 0, 2interline#); + save r, shy; + r = interline; + shy = .3; + pickup accreg_pen; + draw fullcircle scaled 2r; + currentpicture := currentpicture shifted (w/2, shy*h); + save thin, thick, sw, ch, cw, mb, mt; + ch = .6h; + cw = .8w; + thin = .05cw; + thick = .17w; + mb = .53; mt = .47; + sw = .8thick; + z1 = (0, ch-.5thin); penpos1 (thin, -90); + z2 = (.7cw, y1); penpos2 (thin, -90); + z3 = (cw, (mb+.5mt)*ch); penpos3(thick, -180); + z4 = (.65cw, mb*ch); penpos4(thin, 90); + z5 = (sw+thick, mb*ch); penpos5(thin, 90); + z6 = (.9cw, .5mb*ch); penpos6(thick, 0); + z7 = (1.2cw, 0); penpos7(thin, 90); + z8 = (1.3cw, .2mb*ch); penpos8(thin, 180); + penlabels(1, 2, 3, 4, 5, 6, 7, 8); + pickup pencircle scaled 0.001pt; + filldraw (0, 0)--(0, thin)--(sw, thin)--(sw, ch-thin) + --(sw+thick, ch-thin)--(sw+thick, thin) + --(2sw+thick, thin)--(2sw+thick, 0)--cycle; + penstroke z1e--z2e{right}..z3e..z4e{left}--z5e; + penstroke z4e{right}..z6e{down}..z7e{right}..z8e{up}; + currentpicture := currentpicture shifted (-w/2, -shy*h); + currentpicture := currentpicture shifted (0, r); +fet_endchar; diff --git a/mf/feta-schrift.mf b/mf/feta-schrift.mf index 2c314efb6e..794208902e 100644 --- a/mf/feta-schrift.mf +++ b/mf/feta-schrift.mf @@ -590,6 +590,7 @@ fet_beginchar("Flageolet", "flageolet", "flageolet") fet_endchar; input feta-slag; +input feta-accordion; fet_endgroup("scripts"); diff --git a/scripts/mudela-book.py b/scripts/mudela-book.py index 3faa60d238..50241e5bdd 100644 --- a/scripts/mudela-book.py +++ b/scripts/mudela-book.py @@ -2,21 +2,17 @@ # All non-english comments are NOT in swedish, they are norwegian! # TODO: center option (??) +# * One empty, not two line after a mudela{floating} should be enough +# to get a new paragraph. # * clean up handling of filename of inputfile -# * steal Props class from ly2dvi? -# * \onecolumn, \twocolumn -# * fontsize change with commandline parameters # * the verbatim option should not be visible in the created latex file # * what the h.. does castingalgorithm do/mean??? -# * compile all regular expressions # * the following fails because mudelabook doesn't care that the # last } after \end{mudela} finishes the marginpar: # \marginpar{ # \begin{mudela}[fragment] # c d e f g # \end{mudela}} -# * Command line parameter that force all inline mudela to be verbatim, and -# one that forces all to be printed # log: # 0.3: @@ -39,9 +35,27 @@ default_paper_size_global = 'a4' default_mudela_fontsize = '16pt' force_mudela_fontsize_b = 0 +EXPERIMENTAL = 0 +out_files = [] + fontsize_i2a = {11:'eleven', 13:'thirteen', 16:'sixteen', 20:'twenty', 26:'twentysix'} fontsize_pt2i = {'11pt':11, '13pt':13, '16pt':16, '20pt':20, '26pt':26} +begin_mudela_re = re.compile ('^ *\\\\begin{mudela}') +begin_mudela_opts_re = re.compile('\[[^\]]*\]') +end_mudela_re = re.compile ('^ *\\\\end{mudela}') +section_re = re.compile ('\\\\section') +chapter_re = re.compile ('\\\\chapter') +input_re = re.compile ('^\\\\input{([^}]*)') +include_re = re.compile ('^\\\\include{([^}]*)') +begin_document_re = re.compile ('^ *\\\\begin{document}') +documentclass_re = re.compile('\\\\documentclass') +twocolumn_re = re.compile('\\\\twocolumn') +onecolumn_re = re.compile('\\\\onecolumn') +preMudelaExample_re = re.compile('\\\\def\\\\preMudelaExample') +postMudelaExample_re = re.compile('\\\\def\\\\postMudelaExample') +boundingBox_re = re.compile('%%BoundingBox: ([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*)') + def file_exist_b(name): try: f = open(name) @@ -53,9 +67,8 @@ def file_exist_b(name): def ps_dimention(fname): fd = open(fname) lines = fd.readlines() - reg = re.compile('%%BoundingBox: ([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*)') for line in lines: - s = reg.search(line) + s = boundingBox_re.search(line) if s: break return (int(s.groups()[2])-int(s.groups()[0]), @@ -67,6 +80,16 @@ class CompileStatus: def file_mtime (name): return os.stat (name)[8] #mod time + +def need_recompile_b(infile, outfile): + indate = file_mtime (infile) + try: + outdate = file_mtime (outfile) + return indate > outdate + except os.error: + return 1 + + # # executes os.system(command) if infile is newer than # outfile or outfile don't exist @@ -74,7 +97,7 @@ def file_mtime (name): def compile (command, workingdir, infile, outfile): indate = file_mtime (workingdir+infile) try: - outdate = file_mtime (outfile) + outdate = file_mtime (workingdir+outfile) recompile = indate > outdate except os.error: @@ -121,14 +144,14 @@ class PaperDef: self.__papersize = default_paper_size_global else: self.__papersize = p - def set_fontsize(self, pt): + def set_latex_fontsize(self, pt): self.__fontsize = pt def get_linewidth (self): if self.__numcolumn == 1: return self.__onecolumn_linewidth[self.__papersize][self.__fontsize] else: return self.__twocolumn_linewidth[self.__papersize][self.__fontsize] - def onecolumn (slef): + def onecolumn (self): self.__numcolumn = 1 def twocolumn (self): self.__numcolumn = 2 @@ -152,6 +175,7 @@ class Mudela_output: else: self.file.write (line) def scan_begin_statement(self, line): + global force_mudela_fontsize_b; r = begin_mudela_opts_re.search(line) if r: o = r.group()[1:][:-1] @@ -168,7 +192,10 @@ class Mudela_output: self.fragment = 0 for pt in fontsize_pt2i.keys(): if pt in optlist: - self.feta_pt_size = fontsize_pt2i[pt] + if force_mudela_fontsize_b: + self.feta_pt_size = fontsize_pt2i[default_mudela_fontsize] + else: + self.feta_pt_size = fontsize_pt2i[pt] def write_red_tape(self): self.file.write ('\\include \"paper%d.ly\"\n' % self.feta_pt_size) s = fontsize_i2a[self.feta_pt_size] @@ -176,7 +203,7 @@ class Mudela_output: self.file.write("default_paper = \\paper {" + "\\paper_%s\n linewidth = -1.\\pt;" % s + "castingalgorithm = \Wordwrap; indent = 2.\cm; \n}") - self.file.write("\\score{\n\\notes") #HACK + self.file.write("\\score{\n\\notes{") #HACK else: self.file.write ("default_paper = \\paper {" + "\\paper_%s\n linewidth = %i.\\pt;" % \ @@ -184,26 +211,30 @@ class Mudela_output: + "castingalgorithm = \Wordwrap; indent = 2.\cm;\n}") def close (self): if self.fragment: - self.file.write ('\\paper { \\default_paper; } }\n') + self.file.write ('}\\paper { \\default_paper; } }\n') self.file.close () inf = self.basename + '.ly' - outf = self.basename + '.tex' + outf = self.basename + '.tex' if not file_exist_b (inf): status = 1 else: status = os.system ('diff -q %s %s' % (self.temp_filename, inf)) - if status: os.rename (self.temp_filename, inf) - compile ('lilypond -o %s %s;'% (self.basename, inf), '', inf, outf) - if self.graphic_type == 'eps': - bname = self.basename[string.rfind(self.basename, '/')+1:] - tex_name = bname+'.tex' - dvi_name = bname+'.dvi' - eps_name = bname+'.eps' - compile ('tex %s' % tex_name, outdir, tex_name, dvi_name) - compile ('dvips -E -o %s %s' % (eps_name, dvi_name), outdir, dvi_name, eps_name) + if EXPERIMENTAL: + if need_recompile_b(inf, outf): + print "Need recompile" + out_files.append((self.graphic_type, inf)) + else: + compile ('lilypond -o %s %s;'% (self.basename, inf), '', inf, outf) + if self.graphic_type == 'eps': + bname = self.basename[string.rfind(self.basename, '/')+1:] + tex_name = bname+'.tex' + dvi_name = bname+'.dvi' + eps_name = bname+'.eps' + compile ('tex %s' % tex_name, outdir, tex_name, dvi_name) + compile ('dvips -E -o %s %s' % (eps_name, dvi_name), outdir, dvi_name, eps_name) def insert_me_string(self): "Returns a string that can be used directly in latex." if self.graphic_type == 'tex': @@ -228,26 +259,22 @@ class Tex_output: def write (self, s): self.file.write (s) -begin_mudela_re = re.compile ('^ *\\\\begin{mudela}') -begin_mudela_opts_re = re.compile('\[[^\]]*\]') -end_mudela_re = re.compile ('^ *\\\\end{mudela}') -section_re = re.compile ('\\\\section') -chapter_re = re.compile ('\\\\chapter') -input_re = re.compile ('^\\\\input{([^}]*)') -include_re = re.compile ('^\\\\include{([^}]*)') -begin_document_re = re.compile ('^ *\\\\begin{document}') -documentclass_re = re.compile('\\\\documentclass') -twocolumn_re = re.compile('\\\\twocolumn') -onecolumn_re = re.compile('\\\\onecolumn') - class Tex_input: def __init__ (self,name): # HACK - if (name[-4:] != '.tex') and (name[-4:] != '.doc'): - name = name + '.tex' + print "name=", name + try: + self.infile = open (name) + except IOError: + if (name[-4:] != '.tex') and (name[-4:] != '.doc'): + try: + name = name + '.doc' + self.infile = open (name) + except IOError: + name = name + '.tex' + self.infile = open(name) self.filename = name - self.infile = open (name) - + def get_lines (self): lines = self.infile.readlines () (retlines, retdeps) = ([],[self.filename]) @@ -255,17 +282,28 @@ class Tex_input: r = input_re.search (line) ri = include_re.search (line) if r: - t = Tex_input (r.groups()[0]) - ls =t.get_lines () + try: + t = Tex_input (r.groups()[0]) + ls =t.get_lines () + except IOError: + # HACK should not warn about files like lilyponddefs, only + # files we think is a part of the document and include + # mudela that need parsing + print "warning: can't find file " % r.grops()[0] + ls = [[line], []] retlines = retlines + ls[0] retdeps = retdeps + ls[1] elif ri: - t = Tex_input (ri.groups()[0]) - ls =t.get_lines () - ls[0].insert(0, '\\newpage') - ls[0].append('\\newpage') + try: + t = Tex_input (ri.groups()[0]) + ls =t.get_lines () + ls[0].insert(0, '\\newpage') + ls[0].append('\\newpage') + except IOError: + print "warning: can't find include file:", ri.groups()[0] + ls = [[line], []]; retlines = retlines + ls[0] - retdeps = retdeps + ls[1] + retdeps = retdeps + ls[1] else: retlines.append (line) return (retlines, retdeps) @@ -309,18 +347,25 @@ class Main_tex_input(Tex_input): return r.groups()[0] return '10pt' def do_it(self): + preMudelaDef = postMudelaDef = 0 (lines, self.deps) = self.get_lines () for line in lines: if documentclass_re.search (line): Paper.set_papersize (self.extract_papersize_from_documentclass (line) ) - Paper.set_fontsize (self.extract_fontsize_from_documentclass (line) ) + Paper.set_latex_fontsize (self.extract_fontsize_from_documentclass (line) ) elif twocolumn_re.search (line): Paper.twocolumn () elif onecolumn_re.search (line): Paper.onecolumn () + elif preMudelaExample_re.search (line): + preMudelaDef = 1 + elif postMudelaExample_re.search (line): + postMudelaDef = 1 elif begin_document_re.search (line): - self.mudtex.write ('\\def\\preMudelaExample{}\n') - self.mudtex.write ('\\def\\postMudelaExample{}\n') + if not preMudelaDef: + self.mudtex.write ('\\def\\preMudelaExample{}\n') + if not postMudelaDef: + self.mudtex.write ('\\def\\postMudelaExample{}\n') elif begin_mudela_re.search (line): if __debug__: if self.mode == 'mudela': @@ -390,7 +435,7 @@ def identify(): sys.stderr.write ('This is %s version %s\n' % ('mudela-book', program_version)) def main(): - global default_mudela_fontsize, outdir + global default_mudela_fontsize, force_mudela_fontsize_b, outdir outname = '' try: (options, files) = getopt.getopt( @@ -446,3 +491,7 @@ def main(): identify() Paper = PaperDef() main() +if EXPERIMENTAL: + print "outfile:", out_files + for i in out_files: + print "skal gjøre", i -- 2.39.5