| 1 |
%GregorioTeX file. |
| 2 |
% |
| 3 |
% Copyright (C) 2014-2025 The Gregorio Project (see CONTRIBUTORS.md) |
| 4 |
% |
| 5 |
% This file is part of Gregorio. |
| 6 |
% |
| 7 |
% Gregorio is free software: you can redistribute it and/or modify |
| 8 |
% it under the terms of the GNU General Public License as published by |
| 9 |
% the Free Software Foundation, either version 3 of the License, or |
| 10 |
% (at your option) any later version. |
| 11 |
% |
| 12 |
% Gregorio is distributed in the hope that it will be useful, |
| 13 |
% but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
% GNU General Public License for more details. |
| 16 |
% |
| 17 |
% You should have received a copy of the GNU General Public License |
| 18 |
% along with Gregorio. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
|
| 20 |
% this file contains macros for St. Gall ancient neume support |
| 21 |
|
| 22 |
\gre@declarefileversion{gregoriotex-nabc.tex}{6.1.0}% GREGORIO_VERSION |
| 23 |
|
| 24 |
|
| 25 |
\xdef\gre@nabcfontname{gregall}% |
| 26 |
\xdef\gre@nabcfontsize{8}% |
| 27 |
|
| 28 |
\def\gresetnabcfont#1#2{% |
| 29 |
\xdef\gre@nabcfontname{#1}% |
| 30 |
\xdef\gre@nabcfontsize{#2}% |
| 31 |
\global\font\gre@font@nabc={name:#1} at #2 pt\relax % |
| 32 |
{% |
| 33 |
\gre@font@nabc % |
| 34 |
\directlua{gregoriotex.init_nabc_font("\luatexluaescapestring{#1}")}% |
| 35 |
}% |
| 36 |
\gre@nabcfontloadedtrue% |
| 37 |
} |
| 38 |
|
| 39 |
\def\gre@nabccharno#1#2#3{% |
| 40 |
\gre@trace{gre@nabccharno{#1}{#2}{#3}}% |
| 41 |
{\directlua{gregoriotex.print_nabc(gregoriotex.parse_nabc("#1", "\luatexluaescapestring{#2}", #3))}}% |
| 42 |
\gre@trace@end% |
| 43 |
} |
| 44 |
|
| 45 |
\def\GreNABCChar#1{{% |
| 46 |
%\catcode`\~=12{}% |
| 47 |
%\catcode`\@=11{}% |
| 48 |
\gre@font@nabc % |
| 49 |
\gre@style@nabc % |
| 50 |
\gre@nabccharno{#1}{\gre@nabcfontname}{1}% |
| 51 |
\endgre@style@nabc% |
| 52 |
}} |
| 53 |
|
| 54 |
\newif\ifgre@nabcvoice@i@visible |
| 55 |
\gre@nabcvoice@i@visibletrue |
| 56 |
% define more of these when more voices are supported |
| 57 |
|
| 58 |
\def\gresetnabc#1#2{% |
| 59 |
\IfStrEqCase{#2}{% |
| 60 |
{visible}% |
| 61 |
{\csname gre@nabcvoice@\romannumeral#1@visibletrue\endcsname}% |
| 62 |
{invisible}% |
| 63 |
{\csname gre@nabcvoice@\romannumeral#1@visiblefalse\endcsname}% |
| 64 |
}[% all other cases |
| 65 |
\gre@error{Unrecognized option "#2" for \protect\gresetnabc\MessageBreak Possible options are: 'visible' and 'invisible'}% |
| 66 |
]% |
| 67 |
} |
| 68 |
|
| 69 |
\def\GreNABCNeumes#1#2#3#4{% |
| 70 |
\csname ifgre@nabcvoice@\romannumeral#1@visible\endcsname % |
| 71 |
\GreSetNabcAboveLines{\GreNABCChar{#2}}% |
| 72 |
\fi % |
| 73 |
} |
| 74 |
|
| 75 |
\newif\ifgre@nabcfontloaded% |
| 76 |
\gre@nabcfontloadedfalse% |
| 77 |
|
| 78 |
\def\GreScoreNABCLines#1{% |
| 79 |
\ifgre@nabcfontloaded\else% |
| 80 |
\gresetnabcfont{\gre@nabcfontname}{\gre@nabcfontsize}% |
| 81 |
\fi % |
| 82 |
} |