1 % This file is part of Violon, a violin score engine.
2 % Copyright (C) 2009 Julien Moutinho
4 % This program is free software: you can redistribute it and/or modify
5 % it under the terms of the GNU General Public License as published
6 % by the Free Software Foundation, either version 3 of the License,
7 % or any later version.
9 % This program is distributed in the hope that it will be useful,
10 % but WITHOUT ANY WARRANTY; without even the implied warranty
11 % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 % See the GNU General Public License for more details.
14 % You should have received a copy of the GNU General Public License
15 % along with this program. If not, see <http://www.gnu.org/licenses/>.
17 % Any comment or contribution is welcome
18 % at julm arobase julm dot meeee dot eu.
21 \def\fileversion{1.0}%
22 \def\filedate{2009/10/11}%
23 \NeedsTeXFormat{LaTeX2e}%
24 \ProvidesPackage{violon}[\filedate\space\fileversion\space%
25 Violin score library (Julien Moutinho)]%
31 \@setfontsize\sssmall{5pt}{5pt}}%
33 \@setfontsize\sssmall{6pt}{6pt}}%
35 \@setfontsize\ssmall\@viiipt\@ixpt}%
37 \fontfamily{pnc}\bfseries\sssmall}%
39 \fontfamily{pnc}\scshape\ssssmall}%
41 \fontfamily{pnc}\bfseries\ssssmall}%
45 \definecolor{colVlnBowUp}{rgb}{0.24,0.92,0.24}%
46 \definecolor{colVlnBowDn}{rgb}{1,0,0}%
47 \definecolor{colVlnBowU}{rgb}{0.24,0.92,0.24}%
48 \definecolor{colVlnBowD}{rgb}{1,0,0}%
49 \definecolor{colVlnLineHalfTone}{gray}{0.75}%
50 \definecolor{colVlnLineHalfToneBase}{gray}{0.25}%
52 \def\vlncordposofE{0}%
53 \def\vlncordposofA{1}%
54 \def\vlncordposofD{2}%
55 \def\vlncordposofG{3}%
56 \expandafter\def\csname vlncordposof.\endcsname{.}%
59 \newdimen\vlnhalftonelinevdim
60 \newskip\vlnhalftonelineskip%
61 \newskip\vlntonesskip%
63 \vlnhalftonelinevdim=0.5pt%
64 \vlntonesskip=0pt\relax%
65 \vlnhalftonelineskip=5pt\relax%
66 \advance\vlnhalftonelineskip by -\vlnhalftonelinevdim%
67 \def\vlnhalftoneline{%
68 {\color{colVlnLineHalfTone}\hrule depth 0pt height \vlnhalftonelinevdim width \hsize }}%
69 \def\vlnbasehalftoneline{%
70 {\color{colVlnLineHalfToneBase}\hrule depth 0pt height \vlnhalftonelinevdim width \hsize }}%
72 \advance\vlntonesskip by\vlnhalftonelineskip%
73 \advance\vlntonesskip by\vlnhalftonelinevdim%
74 \vskip\vlnhalftonelineskip%
76 \def\vlnfivehalftonelines{%
77 \toneskip\vlnhalftoneline%
78 \toneskip\vlnhalftoneline%
79 \toneskip\vlnhalftoneline%
80 \toneskip\vlnhalftoneline%
81 \toneskip\vlnbasehalftoneline%
83 \def\allhalftonelines{%
84 \vlnfivehalftonelines%
85 \vlnfivehalftonelines%
86 \vlnfivehalftonelines%
87 \vlnfivehalftonelines%
92 \advance\vlntonesskip by\vlnhalftonelinevdim%
98 \newskip\vlnnotevskip%
99 \newskip\vlnnotevskipbase%
100 \newskip\vlnnotehskip%
101 \newskip\vlnnotehskipbase%
102 \newdimen\vlnnotevdim%
103 \newdimen\vlnnotevdimmore%
104 \newdimen\vlnnotehdim%
105 \newcount\vlnlastfinger%
107 \vlnnotevskip=0pt\relax%
108 \vlnnotevskipbase=0pt\relax%
109 \vlnnotehskip=0pt\relax%
110 \vlnnotehskipbase=0pt\relax%
111 \vlnnotevdim=\vlnhalftonelinevdim%
112 \vlnnotevdimmore=1pt\relax%
113 \vlnnotehdim=1em\relax%
114 \advance\vlnnotevdim by \vlnnotevdimmore%
115 \advance\vlnnotevdim by \vlnnotevdimmore%
118 \def\vlnlasttimenum{}%
119 \def\vlnlasttimeden{}%
120 \newcount\vlnlastposbase%
121 \newcount\vlnlastposunit%
122 \parindent=0pt\relax%
124 \parfillskip=0pt\relax%
125 \def\vlnlastfingerpos{%
126 \csname vlnlastfingerpos\romannumeral\vlnlastfinger\endcsname%
128 \def\vlntimefrac#1/#2{%
131 \kern-.4ex\lower.3ex\hbox{\bfseries\tiny /}%
132 \kern-.3ex\lower.6ex\hbox{#2}%
134 \def\vlndoatnote#1#2#3#4{%
136 \vlnnotevskip\vlnhalftonelineskip%
137 \advance\vlnnotevskip by \vlnhalftonelinevdim\relax%
138 \multiply\vlnnotevskip by #1\relax%
139 \advance\vlnnotevskip by -\vlnnotevdimmore\relax%
140 \vskip\vlnnotevskip\relax%
141 \vskip-\vlnnotevskip\relax%
142 \vskip\vlnnotevskip\relax%
143 \vrule depth 0pt height 0pt width \vlnnotehskip\relax%
145 \advance\vlnnotevskip by \ht0\relax%
149 \vskip-\vlnnotevskip\relax%
153 \advance\vlnnotehskip by \vlnnotehdim\relax%
155 \def\vlnnote crd#1pos#2fgr#3bow#4tim#5#6{%
157 \ifthenelse{\equal{#4}{C}}%
158 {\ifthenelse{\equal{U}{\vlnlastbow}}%
159 {\def\vlnlastbow{D}}%
160 {\def\vlnlastbow{U}}}%
161 {\ifthenelse{\equal{#4}{.}}%
163 {\def\vlnlastbow{#4}}}%
165 {\begingroup\expandafter\color{colVlnBow\vlnlastbow}}%
168 \vrule depth 0pt height \vlnnotevdim width \vlnnotehdim\relax%
173 \ifthenelse{\equal{#3}{.}}%
175 {\vlnlastfinger#3\relax}%
176 \ifthenelse{\equal{#2}{\vlnlastfingerpos}}%
179 \expandafter\def\csname vlnlastfingerpos\romannumeral\vlnlastfinger\endcsname{#2}\relax%
183 \setbox0=\hbox{{\vlnfingerfont{\the\vlnlastfinger}}}%
187 \dp0=0pt\relax% NOTE: to prevent fonts like pnc to mess up the vertical alignment
188 \hskip\vlnnotehdim\relax%
194 \ifthenelse{\equal{#1}{\vlnlastcord}}%
196 {\ifthenelse{\equal{#1}{.}}%
198 {\def\vlnlastcord{#1}%
203 \advance\count@ by 1\relax%
204 \setbox0=\hbox{{\vlncordfont{\@Roman\count@}}}%
205 \vskip\vlnnotevdim\relax%
207 \hskip\vlnnotehdim\relax%
214 \ifthenelse{\equal{#5/#6}{\vlnlasttimenum/\vlnlasttimeden}}%
216 {\ifthenelse{\equal{#5/#6}{./.}}%
220 {\ifthenelse{\equal{#5}{.}}%
222 {\def\vlnlasttimenum{#5}}%
223 \ifthenelse{\equal{#6}{.}}%
225 {\def\vlnlasttimeden{#6}}%
228 \ifthenelse{\equal{\vlnlasttimeden}{1}}%
229 {{\vlntimefont{\vlnlasttimenum}}}%
230 {\vlntimefrac{\vlntimefont{\vlnlasttimenum}}/{\vlntimefont{\vlnlasttimeden}}}%
232 \vskip\vlnnotevdim\relax%
242 \def\n#1#2#3#4#5#6#7{%
243 \ifthenelse{\equal{#1}{+}}%
244 {\advance\vlnlastposbase by 1\relax}%
245 {\ifthenelse{\equal{#1}{-}}%
246 {\advance\vlnlastposbase by -1\relax}
247 {\ifthenelse{\equal{#1}{.}}%
249 {\vlnlastposbase#1\relax}}}%
250 \ifthenelse{\equal{#2}{+}}%
251 {\advance\vlnlastposunit by 1\relax}%
252 {\ifthenelse{\equal{#2}{-}}%
253 {\advance\vlnlastposunit by -1\relax}%
254 {\ifthenelse{\equal{#2}{.}}%
256 {\vlnlastposunit#2\relax}}}%
257 \count@\vlnlastposbase\relax%
258 \multiply\count@ by5\relax%
259 \advance\count@ by\vlnlastposunit\relax%
260 \vlnnote crd{\csname vlncordposof#3\endcsname}%
261 pos{\the\count@}fgr{#4}bow{#5}tim{#6}{#7}%