summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex-nabc.tex
blob: 6d0cae8d7d60ba0442ac24e27d7d40d42d54147c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
%GregorioTeX file.
%
% Copyright (C) 2014-2017 The Gregorio Project (see CONTRIBUTORS.md)
%
% This file is part of Gregorio.
%
% Gregorio 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
% (at your option) any later version.
%
% Gregorio 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 Gregorio.  If not, see <http://www.gnu.org/licenses/>.

% this file contains macros for St. Gall ancient neume support

\gre@declarefileversion{gregoriotex-nabc.tex}{5.0.2}% GREGORIO_VERSION


\xdef\gre@nabcfontname{gregall}%
\xdef\gre@nabcfontsize{8}%

\def\gresetnabcfont#1#2{%
	\xdef\gre@nabcfontname{#1}%
	\xdef\gre@nabcfontsize{#2}%
	\global\font\gre@font@nabc={name:#1} at #2 pt\relax %
	{%
		\gre@font@nabc %
		\directlua{gregoriotex.init_nabc_font("\luatexluaescapestring{#1}")}%
	}%
	\gre@nabcfontloadedtrue%
}

\def\gre@nabccharno#1#2#3{%
	\gre@trace{gre@nabccharno{#1}{#2}{#3}}%
	{\directlua{gregoriotex.print_nabc(gregoriotex.parse_nabc("#1", "\luatexluaescapestring{#2}", #3))}}%
	\gre@trace@end%
}

\def\GreNABCChar#1{{%
	%\catcode`\~=12{}%
	%\catcode`\@=11{}%
	\gre@font@nabc %
	\gre@style@nabc %
	\gre@nabccharno{#1}{\gre@nabcfontname}{1}%
	\endgre@style@nabc%
}}

\newif\ifgre@nabcvoice@i@visible
\gre@nabcvoice@i@visibletrue
% define more of these when more voices are supported

\def\gresetnabc#1#2{%
	\IfStrEqCase{#2}{%
		{visible}%
			{\csname gre@nabcvoice@\romannumeral#1@visibletrue\endcsname}%
		{invisible}%
			{\csname gre@nabcvoice@\romannumeral#1@visiblefalse\endcsname}%
		}[% all other cases
			\gre@error{Unrecognized option "#2" for \protect\gresetnabc\MessageBreak Possible options are: 'visible' and 'invisible'}%
		]%
}

\def\GreNABCNeumes#1#2#3#4{%
	\csname ifgre@nabcvoice@\romannumeral#1@visible\endcsname %
		\GreSetNabcAboveLines{\GreNABCChar{#2}}%
	\fi %
}

\newif\ifgre@nabcfontloaded%
\gre@nabcfontloadedfalse%

\def\GreScoreNABCLines#1{%
	\ifgre@nabcfontloaded\else%
		\gresetnabcfont{\gre@nabcfontname}{\gre@nabcfontsize}%
	\fi %
}