From ccb5824f85e167b32b20ce1d22558b58515094e6 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Sun, 8 Nov 2009 06:28:35 +0100 Subject: [PATCH 1/1] Premier commit. --- violon.sty | 263 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 263 insertions(+) create mode 100644 violon.sty diff --git a/violon.sty b/violon.sty new file mode 100644 index 0000000..8c3dae8 --- /dev/null +++ b/violon.sty @@ -0,0 +1,263 @@ +% This file is part of Violon, a violin score engine. +% Copyright (C) 2009 Julien Moutinho +% +% This program is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published +% by the Free Software Foundation, either version 3 of the License, +% or any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty +% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +% See the GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program. If not, see . + +% Any comment or contribution is welcome +% at julm arobase julm dot meeee dot eu. + +% Déclaration + \def\fileversion{1.0}% + \def\filedate{2009/10/11}% + \NeedsTeXFormat{LaTeX2e}% + \ProvidesPackage{violon}[\filedate\space\fileversion\space% + Violin score library (Julien Moutinho)]% +% Bibliothèques + \usepackage{ifthen}% + \usepackage{color}% +% Polices + \gdef\ssssmall{% + \@setfontsize\sssmall{5pt}{5pt}}% + \gdef\sssmall{% + \@setfontsize\sssmall{6pt}{6pt}}% + \gdef\ssmall{% + \@setfontsize\ssmall\@viiipt\@ixpt}% + \gdef\vlnfingerfont{% + \fontfamily{pnc}\bfseries\sssmall}% + \gdef\vlncordfont{% + \fontfamily{pnc}\scshape\ssssmall}% + \gdef\vlntimefont{% + \fontfamily{pnc}\bfseries\ssssmall}% +% Moteur + % Constantes + % Couleurs + \definecolor{colVlnBowUp}{rgb}{0.24,0.92,0.24}% + \definecolor{colVlnBowDn}{rgb}{1,0,0}% + \definecolor{colVlnBowU}{rgb}{0.24,0.92,0.24}% + \definecolor{colVlnBowD}{rgb}{1,0,0}% + \definecolor{colVlnLineHalfTone}{gray}{0.75}% + \definecolor{colVlnLineHalfToneBase}{gray}{0.25}% + % Cordes + \def\vlncordposofE{0}% + \def\vlncordposofA{1}% + \def\vlncordposofD{2}% + \def\vlncordposofG{3}% + \expandafter\def\csname vlncordposof.\endcsname{.}% + % Portée + % Déclarations + \newdimen\vlnhalftonelinevdim + \newskip\vlnhalftonelineskip% + \newskip\vlntonesskip% + % Initialisations + \vlnhalftonelinevdim=0.5pt% + \vlntonesskip=0pt\relax% + \vlnhalftonelineskip=5pt\relax% + \advance\vlnhalftonelineskip by -\vlnhalftonelinevdim% + \def\vlnhalftoneline{% + {\color{colVlnLineHalfTone}\hrule depth 0pt height \vlnhalftonelinevdim width \hsize }}% + \def\vlnbasehalftoneline{% + {\color{colVlnLineHalfToneBase}\hrule depth 0pt height \vlnhalftonelinevdim width \hsize }}% + \def\toneskip{% + \advance\vlntonesskip by\vlnhalftonelineskip% + \advance\vlntonesskip by\vlnhalftonelinevdim% + \vskip\vlnhalftonelineskip% + }% + \def\vlnfivehalftonelines{% + \toneskip\vlnhalftoneline% + \toneskip\vlnhalftoneline% + \toneskip\vlnhalftoneline% + \toneskip\vlnhalftoneline% + \toneskip\vlnbasehalftoneline% + }% + \def\allhalftonelines{% + \vlnfivehalftonelines% + \vlnfivehalftonelines% + \vlnfivehalftonelines% + \vlnfivehalftonelines% + }% + \gdef\vlnlines{% + \vlnbasehalftoneline% + \allhalftonelines% + \advance\vlntonesskip by\vlnhalftonelinevdim% + \vskip-\vlntonesskip% + }% + % Notes + % Déclarations + % Variables + \newskip\vlnnotevskip% + \newskip\vlnnotevskipbase% + \newskip\vlnnotehskip% + \newskip\vlnnotehskipbase% + \newdimen\vlnnotevdim% + \newdimen\vlnnotevdimmore% + \newdimen\vlnnotehdim% + \newcount\vlnlastfinger% + % Initialisations + \vlnnotevskip=0pt\relax% + \vlnnotevskipbase=0pt\relax% + \vlnnotehskip=0pt\relax% + \vlnnotehskipbase=0pt\relax% + \vlnnotevdim=\vlnhalftonelinevdim% + \vlnnotevdimmore=1pt\relax% + \vlnnotehdim=1em\relax% + \advance\vlnnotevdim by \vlnnotevdimmore% + \advance\vlnnotevdim by \vlnnotevdimmore% + \def\vlnlastbow{}% + \def\vlnlastcord{}% + \def\vlnlasttimenum{}% + \def\vlnlasttimeden{}% + \newcount\vlnlastposbase% + \newcount\vlnlastposunit% + \parindent=0pt\relax% + \parskip=0pt\relax% + \parfillskip=0pt\relax% + \def\vlnlastfingerpos{% + \csname vlnlastfingerpos\romannumeral\vlnlastfinger\endcsname% + }% + \def\vlntimefrac#1/#2{% + \leavevmode% + \hbox{#1}% + \kern-.4ex\lower.3ex\hbox{\bfseries\tiny /}% + \kern-.3ex\lower.6ex\hbox{#2}% + }% + \def\vlndoatnote#1#2#3#4{% + \nointerlineskip% + \vlnnotevskip\vlnhalftonelineskip% + \advance\vlnnotevskip by \vlnhalftonelinevdim\relax% + \multiply\vlnnotevskip by #1\relax% + \advance\vlnnotevskip by -\vlnnotevdimmore\relax% + \vskip\vlnnotevskip\relax% + \vskip-\vlnnotevskip\relax% + \vskip\vlnnotevskip\relax% + \vrule depth 0pt height 0pt width \vlnnotehskip\relax% + \setbox0=#3% + \advance\vlnnotevskip by \ht0\relax% + #2% + \box0% + #4% + \vskip-\vlnnotevskip\relax% + \nointerlineskip% + }% + \def\vlnnextnote{% + \advance\vlnnotehskip by \vlnnotehdim\relax% + }% + \def\vlnnote crd#1pos#2fgr#3bow#4tim#5#6{% + % Archet + \ifthenelse{\equal{#4}{C}}% + {\ifthenelse{\equal{U}{\vlnlastbow}}% + {\def\vlnlastbow{D}}% + {\def\vlnlastbow{U}}}% + {\ifthenelse{\equal{#4}{.}}% + {}% + {\def\vlnlastbow{#4}}}% + \vlndoatnote{#2}% + {\begingroup\expandafter\color{colVlnBow\vlnlastbow}}% + {% + \hbox{% + \vrule depth 0pt height \vlnnotevdim width \vlnnotehdim\relax% + }% + }% + {\endgroup}% + % Doigts + \ifthenelse{\equal{#3}{.}}% + {}% + {\vlnlastfinger#3\relax}% + \ifthenelse{\equal{#2}{\vlnlastfingerpos}}% + {}% + {% + \expandafter\def\csname vlnlastfingerpos\romannumeral\vlnlastfinger\endcsname{#2}\relax% + \vlndoatnote{#2}% + {}% + {\vbox to0pt{% + \setbox0=\hbox{{\vlnfingerfont{\the\vlnlastfinger}}}% + \vskip-0.2mm\relax% + \vskip-\ht0\relax% + %\vskip-\dp0\relax% + \dp0=0pt\relax% NOTE: to prevent fonts like pnc to mess up the vertical alignment + \hskip\vlnnotehdim\relax% + \hskip-\wd0\relax% + \box0}}% + {}% + }% + % Cordes + \ifthenelse{\equal{#1}{\vlnlastcord}}% + {}% + {\ifthenelse{\equal{#1}{.}}% + {}% + {\def\vlnlastcord{#1}% + \vlndoatnote{#2}% + {}% + {\vbox to0pt{% + \count@#1\relax% + \advance\count@ by 1\relax% + \setbox0=\hbox{{\vlncordfont{\@Roman\count@}}}% + \vskip\vlnnotevdim\relax% + \vskip0.2mm\relax% + \hskip\vlnnotehdim\relax% + \hskip-\wd0\relax% + \box0}}% + {}% + }% + }% + % Durée + \ifthenelse{\equal{#5/#6}{\vlnlasttimenum/\vlnlasttimeden}}% + {}% + {\ifthenelse{\equal{#5/#6}{./.}}% + {}% + {\vlndoatnote{#2}% + {}% + {\ifthenelse{\equal{#5}{.}}% + {}% + {\def\vlnlasttimenum{#5}}% + \ifthenelse{\equal{#6}{.}}% + {}% + {\def\vlnlasttimeden{#6}}% + \vbox to0pt{% + \setbox0=\hbox{% + \ifthenelse{\equal{\vlnlasttimeden}{1}}% + {{\vlntimefont{\vlnlasttimenum}}}% + {\vlntimefrac{\vlntimefont{\vlnlasttimenum}}/{\vlntimefont{\vlnlasttimeden}}}% + }% + \vskip\vlnnotevdim\relax% + \vskip0.2mm\relax% + \dp0=0pt\relax% + \box0}}% + {}% + }% + }% + \vlnnextnote% + \nointerlineskip% + }% + \def\n#1#2#3#4#5#6#7{% + \ifthenelse{\equal{#1}{+}}% + {\advance\vlnlastposbase by 1\relax}% + {\ifthenelse{\equal{#1}{-}}% + {\advance\vlnlastposbase by -1\relax} + {\ifthenelse{\equal{#1}{.}}% + {}% + {\vlnlastposbase#1\relax}}}% + \ifthenelse{\equal{#2}{+}}% + {\advance\vlnlastposunit by 1\relax}% + {\ifthenelse{\equal{#2}{-}}% + {\advance\vlnlastposunit by -1\relax}% + {\ifthenelse{\equal{#2}{.}}% + {}% + {\vlnlastposunit#2\relax}}}% + \count@\vlnlastposbase\relax% + \multiply\count@ by5\relax% + \advance\count@ by\vlnlastposunit\relax% + \vlnnote crd{\csname vlncordposof#3\endcsname}% + pos{\the\count@}fgr{#4}bow{#5}tim{#6}{#7}% + }% + -- 2.47.0