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}%
53 \newdimen\vlnhalftonelinevdim
54 \newskip\vlnhalftonelineskip%
55 \newskip\vlntonesskip%
57 \vlnhalftonelinevdim=0.5pt%
58 \vlntonesskip=0pt\relax%
59 \vlnhalftonelineskip=5pt\relax%
60 \advance\vlnhalftonelineskip by -\vlnhalftonelinevdim%
61 \def\vlnhalftoneline{%
62 {\color{colVlnLineHalfTone}\hrule depth 0pt height \vlnhalftonelinevdim width \hsize }}%
63 \def\vlnbasehalftoneline{%
64 {\color{colVlnLineHalfToneBase}\hrule depth 0pt height \vlnhalftonelinevdim width \hsize }}%
66 \advance\vlntonesskip by\vlnhalftonelineskip%
67 \advance\vlntonesskip by\vlnhalftonelinevdim%
68 \vskip\vlnhalftonelineskip%
70 \def\vlnfivehalftonelines{%
71 \toneskip\vlnhalftoneline%
72 \toneskip\vlnhalftoneline%
73 \toneskip\vlnhalftoneline%
74 \toneskip\vlnhalftoneline%
75 \toneskip\vlnbasehalftoneline%
77 \def\allhalftonelines{%
78 \vlnfivehalftonelines%
79 \vlnfivehalftonelines%
80 \vlnfivehalftonelines%
81 \vlnfivehalftonelines%
86 \advance\vlntonesskip by\vlnhalftonelinevdim%
92 \newskip\vlnnotevskip%
93 \newskip\vlnnotevskipbase%
94 \newskip\vlnnotehskip%
95 \newskip\vlnnotehskipbase%
96 \newdimen\vlnnotevdim%
97 \newdimen\vlnnotevdimmore%
98 \newdimen\vlnnotehdim%
99 \newdimen\vlnnotehdimbase%
100 \newcount\vlnlastfinger%
101 \newcount\vlnlastposbase%
102 \newcount\vlnlastposunit%
104 \vlnnotevskip=0pt\relax%
105 \vlnnotevskipbase=0pt\relax%
106 \vlnnotehskip=0pt\relax%
107 \vlnnotehskipbase=0pt\relax%
108 \vlnnotevdim=\vlnhalftonelinevdim%
109 \vlnnotevdimmore=1pt\relax%
110 \vlnnotehdimbase=2cm\relax%
111 \advance\vlnnotevdim by \vlnnotevdimmore%
112 \advance\vlnnotevdim by \vlnnotevdimmore%
115 \def\vlnlasttimenum{}%
116 \def\vlnlasttimeden{}%
117 \def\vlnnotehdimmodetim{1}%
118 \def\vlnnotehdimmodetxt{}%
119 \parindent=0pt\relax%
121 \parfillskip=0pt\relax%
122 \def\vlnlastfingerpos{%
123 \csname vlnlastfingerpos\romannumeral\vlnlastfinger\endcsname%
125 \def\vlntimefrac#1/#2{%
128 \kern-.4ex\lower.3ex\hbox{\bfseries\tiny /}%
129 \kern-.3ex\lower.6ex\hbox{#2}%
131 \def\vlndoatnote#1#2#3#4{%
133 \vlnnotevskip\vlnhalftonelineskip%
134 \advance\vlnnotevskip by \vlnhalftonelinevdim\relax%
135 \multiply\vlnnotevskip by #1\relax%
136 \advance\vlnnotevskip by -\vlnnotevdimmore\relax%
137 \vskip\vlnnotevskip\relax%
138 \vskip-\vlnnotevskip\relax%
139 \vskip\vlnnotevskip\relax%
140 \vrule depth 0pt height 0pt width \vlnnotehskip\relax%
142 \advance\vlnnotevskip by \ht0\relax%
146 \vskip-\vlnnotevskip\relax%
150 \advance\vlnnotehskip by \vlnnotehdim\relax%
152 \def\vlnnote crd#1pos#2fgr#3bow#4tim#5#6{%
154 \ifthenelse{\equal{#5/#6}{\vlnlasttimenum/\vlnlasttimeden}}%
156 {\ifthenelse{\equal{#5/#6}{./.}}%
160 {\ifthenelse{\equal{#5}{.}}%
162 {\def\vlnlasttimenum{#5}}%
163 \ifthenelse{\equal{#6}{.}}%
165 {\def\vlnlasttimeden{#6}}%
166 \vlnnotehdim\vlnnotehdimbase%
167 \ifthenelse{\equal{}{\vlnnotehdimmodetim}}%
169 {\multiply\vlnnotehdim by\vlnlasttimenum\relax%
170 \divide\vlnnotehdim by\vlnlasttimeden\relax%
172 \ifthenelse{\equal{}{\vlnnotehdimmodetxt}}%
176 \ifthenelse{\equal{\vlnlasttimeden}{1}}%
177 {{\vlntimefont{\vlnlasttimenum}}}%
178 {\vlntimefrac{\vlntimefont{\vlnlasttimenum}}/{\vlntimefont{\vlnlasttimeden}}}%
180 \vskip\vlnnotevdim\relax%
190 \ifthenelse{\equal{#4}{C}}%
191 {\ifthenelse{\equal{U}{\vlnlastbow}}%
192 {\def\vlnlastbow{D}}%
193 {\def\vlnlastbow{U}}}%
194 {\ifthenelse{\equal{#4}{.}}%
196 {\def\vlnlastbow{#4}}}%
198 {\begingroup\expandafter\color{colVlnBow\vlnlastbow}}%
201 \vrule depth 0pt height \vlnnotevdim width \vlnnotehdim\relax%
206 \ifthenelse{\equal{#3}{.}}%
208 {\vlnlastfinger#3\relax}%
209 \ifthenelse{\equal{#2}{\vlnlastfingerpos}}%
212 \expandafter\edef\csname vlnlastfingerpos\romannumeral\vlnlastfinger\endcsname{#2}\relax%
216 \setbox0=\hbox{{\vlnfingerfont{\the\vlnlastfinger}}}%
220 \dp0=0pt\relax% NOTE: to prevent fonts like pnc to mess up the vertical alignment
221 \hskip\vlnnotehdim\relax%
227 \ifthenelse{\equal{#1}{\vlnlastcord}}%
229 {\ifthenelse{\equal{#1}{.}}%
231 {\def\vlnlastcord{#1}%
236 \setbox0=\hbox{{\vlncordfont{\@Roman\count@}}}%
237 \vskip\vlnnotevdim\relax%
239 \hskip\vlnnotehdim\relax%
248 \def\n#1#2#3#4#5#6#7{%
249 \ifthenelse{\equal{#1}{+}}%
250 {\advance\vlnlastposbase by 1\relax}%
251 {\ifthenelse{\equal{#1}{-}}%
252 {\advance\vlnlastposbase by -1\relax}
253 {\ifthenelse{\equal{#1}{.}}%
255 {\vlnlastposbase#1\relax}}}%
256 \ifthenelse{\equal{#2}{+}}%
257 {\advance\vlnlastposunit by 1\relax}%
258 {\ifthenelse{\equal{#2}{-}}%
259 {\advance\vlnlastposunit by -1\relax}%
260 {\ifthenelse{\equal{#2}{.}}%
262 {\vlnlastposunit#2\relax}}}%
263 \count@\vlnlastposbase\relax%
264 \multiply\count@ by5\relax%
265 \advance\count@ by\vlnlastposunit\relax%
266 \vlnnote crd{#3}pos{\the\count@}fgr{#4}bow{#5}tim{#6}{#7}%