summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/gregoriotex/gregoriotex.tex
blob: 43d1cc7b9a09de1244b5439c8c6ee56bd95ffb0e (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
% GregorioTeX boostrap file for Plain TeX
%
% Copyright (C) 2015-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 definitions for lines, initial, fonts, etc.


% This file needs to be marked with the version number.  For now I've done this with the following comment, but we should check to see if PlainTeX has something similar to the version declaration of LaTeX and use that if it does.
% 		[2017/04/16 v5.0.1 GregorioTeX system.]% PARSE_VERSION_DATE_LTX


\edef\greoldcatcode{\the\catcode`@}
\catcode`\@=11

\input ifluatex.sty%
\input luatexbase.sty%
\input luamplib.sty%
\input luaotfload.sty%
\input xstring.tex%
\input color.tex%
\input graphicx.tex % for \resizebox

\def\gre@error#1{\begingroup%
\def\MessageBreak{^^J}%
\let\protect\string%
\errmessage{GregorioTeX error: #1}%
\endgroup}%

\def\gre@warning#1{\begingroup%
\def\MessageBreak{^^J}%
\let\protect\string%
\message{GregorioTeX warning: #1}%
\endgroup}%

\def\gre@bug#1{\begingroup%
\def\MessageBreak{^^J}%
\let\protect\string%
\errmessage{GregorioTeX bug: #1 !! This is a bug in Gregorio.  Please report it at https://github.com/gregorio-project/gregorio/issues}%
\endgroup}%

\def\gre@typeout#1{\begingroup%
\def\MessageBreak{^^J}%
\let\protect\string%
\message{#1}%
\endgroup}%

\ifcsname gre@debug\endcsname%
\else%
	\def\gre@debug{}%
\fi%

\ifcsname f@size\endcsname%
\else%
	\def\f@size{\directlua{gregoriotex.font_size()}}%
\fi%

\newif\ifgre@allowdeprecated%
\gre@allowdeprecatedtrue%

\long\def\gre@metapost#1{{%
	\gre@localleftbox{}%
	\gre@localrightbox{}%
	\mplibcode
	#1
	\endmplibcode%
}}%

%% This is \strip@pt from LaTeX
\begingroup%
	\catcode`P=12%
	\catcode`T=12%
	\lowercase{%
		\def\x{\def\gre@rem@pt##1.##2PT{##1\ifnum##2>\z@.##2\fi}}}%
	\expandafter\endgroup\x%
\def\gre@strip@pt{\expandafter\gre@rem@pt\the}%

\long\def\gre@iflatex#1{}%
\long\def\gre@ifnotlatex#1{#1}%
\input gregoriotex-main.tex


%%%%%%%%%
%% Color definitions
%%%%%%%%%

\definecolor{grebackgroundcolor}{RGB}{255,255,255}%
\definecolor{gregoriocolor}{RGB}{229,53,44}%

%%%%%%%%%
%% PlainTeX specific definitions for fonts
%%%%%%%%%

\def\GreBold#1{%
	{\bf #1}%
	\relax %
}%

\def\GreItalic#1{%
	{\it #1}%
	%\relax 
}%

% Since small caps in PlainTeX requires loading another font, it is not defined by default.  This command maintains compatibility by checking to see if \sc has been defined and raising a warning when it hasn’t
\def\GreSmallCaps#1{%
	\ifdefined\sc%
		{\sc #1}%
	\else%
		\gre@warning{Small caps (\protect\sc) is not defined}%
		{#1}%
	\fi%
	\relax %
}%

\def\GreTypewriter#1{%
	{\tt #1}%
	\relax %
}%

\def\GreColored#1{%
	{%
		\color{gregoriocolor}#1%
	}%
}%

\def\GreUnderline#1{%
	$\underline{\rm #1}$
	\relax %
}%

%%%%%%%%%%%%%%%
%% Line color
%%%%%%%%%%%%%%%

% Colors don't work in PlainTeX, but we need these functions for interoperability with LaTeX.

\def\gresetlinecolor#1{%
	\gre@changestyle{normalstafflines}{\color{#1}}[\relax]%
}


%%%%%%%%%%%%%%%%%%%%
%% Formatting environments
%%%%%%%%%%%%%%%%%%%%

\font\gre@font@initial=pncr at 40pt\relax%

\def\gre@style@initial{%
	\begingroup%
	\gre@font@initial%
	\relax %
}%
\def\endgre@style@initial{\endgroup}%

\def\gre@style@translation{%
	\begingroup%
	\it%
}%
\def\endgre@style@translation{\endgroup}%

\def\gre@style@abovelinestext{%
	\begingroup%
	\it%
}%
\def\endgre@style@abovelinestext{\endgroup}%

\def\gre@style@normalstafflines{%
	\begingroup%
	\relax%
}%
\def\endgre@style@normalstafflines{\endgroup}%

\def\gre@style@additionalstafflines{%
	\begingroup%
	\gre@style@normalstafflines%
}%
\def\endgre@style@additionalstafflines{%
	\endgre@style@normalstafflines%
	\endgroup%
}%

\def\gre@style@lowchoralsign{%
	\begingroup%
	\relax%
}%
\def\endgre@style@lowchoralsign{\endgroup}%

\def\gre@style@highchoralsign{%
	\begingroup%
	\relax%
}%
\def\endgre@style@highchoralsign{\endgroup}%

\def\gre@style@firstsyllableinitial{%
	\begingroup%
	\relax%
}%
\def\endgre@style@firstsyllableinitial{\endgroup}%

\def\gre@style@firstsyllable{%
	\begingroup%
	\relax%
}%
\def\endgre@style@firstsyllable{\endgroup}%

\def\gre@style@firstword{%
	\begingroup%
	\relax%
}%
\def\endgre@style@firstword{\endgroup}%

\def\gre@style@modeline{%
	\begingroup%
	\bf%
	\relax%
}%
\def\endgre@style@modeline{\endgroup}%

\def\gre@style@modemodifier{%
	\begingroup%
	\bf%
	\it%
	\relax%
}%
\def\endgre@style@modemodifier{\endgroup}%

\def\gre@style@modedifferentia{%
	\begingroup%
	\bf%
	\relax%
}%
\def\endgre@style@modedifferentia{\endgroup}%

\def\gre@style@commentary{%
	\begingroup%
	\it%
	% footnotesize in LaTeX, but nothing here since changing font size is so hard
	\relax%
}%
\def\endgre@style@commentary{\endgroup}%

\def\gre@style@elision{%
	\begingroup%
	\it%
	% small in LaTeX, but nothing here since changing font size is so hard
	\relax%
}%
\def\endgre@style@elision{\endgroup}%

\def\gre@style@annotation{%
	\begingroup%
	\relax%
}%
\def\endgre@style@annotation{\endgroup}%

\def\gre@style@nabc{%
	\begingroup%
	\color{gregoriocolor}%
}
\def\endgre@style@nabc{\endgroup}%

\def\gre@changestyle#1#2[#3]{%
	\expandafter\gdef\csname gre@style@#1\endcsname{\begingroup#2}%
	\expandafter\gdef\csname endgre@style@#1\endcsname{#3\endgroup}%
}%

%%%%%%%%%%%%%%%
%% Default Mode Numbering style
%%%%%%%%%%%%%%%

\gresetmodenumbersystem{roman-majuscule}%

\catcode`\@=\greoldcatcode