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 \newdimen\vlnnotehdimbase%
106 \newcount\vlnlastfinger%
107 \newcount\vlnlastposbase%
108 \newcount\vlnlastposunit%
110 \vlnnotevskip=0pt\relax%
111 \vlnnotevskipbase=0pt\relax%
112 \vlnnotehskip=0pt\relax%
113 \vlnnotehskipbase=0pt\relax%
114 \vlnnotevdim=\vlnhalftonelinevdim%
115 \vlnnotevdimmore=1pt\relax%
116 \vlnnotehdimbase=2cm\relax%
117 \advance\vlnnotevdim by \vlnnotevdimmore%
118 \advance\vlnnotevdim by \vlnnotevdimmore%
121 \def\vlnlasttimenum{}%
122 \def\vlnlasttimeden{}%
123 \def\vlnnotehdimmodetim{1}%
124 \def\vlnnotehdimmodetxt{}%
125 \parindent=0pt\relax%
127 \parfillskip=0pt\relax%
128 \def\vlnlastfingerpos{%
129 \csname vlnlastfingerpos\romannumeral\vlnlastfinger\endcsname%
131 \def\vlntimefrac#1/#2{%
134 \kern-.4ex\lower.3ex\hbox{\bfseries\tiny /}%
135 \kern-.3ex\lower.6ex\hbox{#2}%
137 \def\vlndoatnote#1#2#3#4{%
139 \vlnnotevskip\vlnhalftonelineskip%
140 \advance\vlnnotevskip by \vlnhalftonelinevdim\relax%
141 \multiply\vlnnotevskip by #1\relax%
142 \advance\vlnnotevskip by -\vlnnotevdimmore\relax%
143 \vskip\vlnnotevskip\relax%
144 \vskip-\vlnnotevskip\relax%
145 \vskip\vlnnotevskip\relax%
146 \vrule depth 0pt height 0pt width \vlnnotehskip\relax%
148 \advance\vlnnotevskip by \ht0\relax%
152 \vskip-\vlnnotevskip\relax%
156 \advance\vlnnotehskip by \vlnnotehdim\relax%
158 \def\vlnnote crd#1pos#2fgr#3bow#4tim#5#6{%
160 \ifthenelse{\equal{#5/#6}{\vlnlasttimenum/\vlnlasttimeden}}%
162 {\ifthenelse{\equal{#5/#6}{./.}}%
166 {\ifthenelse{\equal{#5}{.}}%
168 {\def\vlnlasttimenum{#5}}%
169 \ifthenelse{\equal{#6}{.}}%
171 {\def\vlnlasttimeden{#6}}%
172 \vlnnotehdim\vlnnotehdimbase%
173 \ifthenelse{\equal{}{\vlnnotehdimmodetim}}%
175 {\multiply\vlnnotehdim by\vlnlasttimeden\relax%
176 \divide\vlnnotehdim by\vlnlasttimenum\relax%
178 \ifthenelse{\equal{}{\vlnnotehdimmodetxt}}%
182 \ifthenelse{\equal{\vlnlasttimeden}{1}}%
183 {{\vlntimefont{\vlnlasttimenum}}}%
184 {\vlntimefrac{\vlntimefont{\vlnlasttimenum}}/{\vlntimefont{\vlnlasttimeden}}}%
186 \vskip\vlnnotevdim\relax%
196 \ifthenelse{\equal{#4}{C}}%
197 {\ifthenelse{\equal{U}{\vlnlastbow}}%
198 {\def\vlnlastbow{D}}%
199 {\def\vlnlastbow{U}}}%
200 {\ifthenelse{\equal{#4}{.}}%
202 {\def\vlnlastbow{#4}}}%
204 {\begingroup\expandafter\color{colVlnBow\vlnlastbow}}%
207 \vrule depth 0pt height \vlnnotevdim width \vlnnotehdim\relax%
212 \ifthenelse{\equal{#3}{.}}%
214 {\vlnlastfinger#3\relax}%
215 \ifthenelse{\equal{#2}{\vlnlastfingerpos}}%
218 \expandafter\def\csname vlnlastfingerpos\romannumeral\vlnlastfinger\endcsname{#2}\relax%
222 \setbox0=\hbox{{\vlnfingerfont{\the\vlnlastfinger}}}%
226 \dp0=0pt\relax% NOTE: to prevent fonts like pnc to mess up the vertical alignment
227 \hskip\vlnnotehdim\relax%
233 \ifthenelse{\equal{#1}{\vlnlastcord}}%
235 {\ifthenelse{\equal{#1}{.}}%
237 {\def\vlnlastcord{#1}%
242 \advance\count@ by 1\relax%
243 \setbox0=\hbox{{\vlncordfont{\@Roman\count@}}}%
244 \vskip\vlnnotevdim\relax%
246 \hskip\vlnnotehdim\relax%
255 \def\n#1#2#3#4#5#6#7{%
256 \ifthenelse{\equal{#1}{+}}%
257 {\advance\vlnlastposbase by 1\relax}%
258 {\ifthenelse{\equal{#1}{-}}%
259 {\advance\vlnlastposbase by -1\relax}
260 {\ifthenelse{\equal{#1}{.}}%
262 {\vlnlastposbase#1\relax}}}%
263 \ifthenelse{\equal{#2}{+}}%
264 {\advance\vlnlastposunit by 1\relax}%
265 {\ifthenelse{\equal{#2}{-}}%
266 {\advance\vlnlastposunit by -1\relax}%
267 {\ifthenelse{\equal{#2}{.}}%
269 {\vlnlastposunit#2\relax}}}%
270 \count@\vlnlastposbase\relax%
271 \multiply\count@ by5\relax%
272 \advance\count@ by\vlnlastposunit\relax%
273 \vlnnote crd{\csname vlncordposof#3\endcsname}%
274 pos{\the\count@}fgr{#4}bow{#5}tim{#6}{#7}%