Debian Codegraph @

texk/gregorio/gregorio-src/tex/gregoriotex-symbols.tex

raw
1 %GregorioTeX file.
2 %
3 % Copyright (C) 2007-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 definitions of the symbols
21
22 \ifcsname gregoriotex@symbols@loaded\endcsname\endinput\fi%
23 \def\gregoriotex@symbols@loaded{}%
24
25 \gre@declarefileversion{gregoriotex-symbols.tex}{6.1.0}% GREGORIO_VERSION
26
27 \RequireLuaModule{gregoriotex}%
28
29 \def\gre@symbolfontsize{\f@size}%
30
31 % Defines a symbol which automatically scales with \f@size
32 % #1 = control sequence name
33 % #2 = font name
34 % #3 = glyph name or code point
35 \def\gredefsymbol#1#2#3{%
36 \directlua{gregoriotex.init_variant_font([[#2]],false)}%
37 \directlua{gregoriotex.def_symbol([[#1]],[[#2]],[[#3]],false)}%
38 }%
39
40 % Defines a symbol which takes a point size as argument
41 % #1 = control sequence name
42 % #2 = font name
43 % #3 = glyph name or code point
44 \def\gredefsizedsymbol#1#2#3{%
45 \directlua{gregoriotex.init_variant_font([[#2]],false)}%
46 \directlua{gregoriotex.def_symbol([[#1]],[[#2]],[[#3]],true)}%
47 }%
48
49 %%%%%%%%%%%%%
50 %% symbols %%
51 %%%%%%%%%%%%%
52
53 \gredefsizedsymbol{greABar}{greextra}{ABar}
54 \gredefsizedsymbol{greRBar}{greextra}{RBar}
55 \gredefsizedsymbol{greVBar}{greextra}{VBar}
56 \gredefsizedsymbol{greABarSlant}{greextra}{ABarSlant}
57 \gredefsizedsymbol{greRBarSlant}{greextra}{RBarSlant}
58 \gredefsizedsymbol{greVBarSlant}{greextra}{VBarSlant}
59 \gredefsizedsymbol{greABarSC}{greextra}{ABarSC}
60 \gredefsizedsymbol{greRBarSC}{greextra}{RBarSC}
61 \gredefsizedsymbol{greVBarSC}{greextra}{VBarSC}
62 \gredefsizedsymbol{greABarSmall}{greextra}{ABarSmall}
63 \gredefsizedsymbol{greRBarSmall}{greextra}{RBarSmall}
64 \gredefsizedsymbol{greVBarSmall}{greextra}{VBarSmall}
65 \gredefsizedsymbol{greABarSmallSlant}{greextra}{ABarSmallSlant}
66 \gredefsizedsymbol{greRBarSmallSlant}{greextra}{RBarSmallSlant}
67 \gredefsizedsymbol{greVBarSmallSlant}{greextra}{VBarSmallSlant}
68 \gredefsizedsymbol{greABarSmallSC}{greextra}{ABarSmallSC}
69 \gredefsizedsymbol{greRBarSmallSC}{greextra}{RBarSmallSC}
70 \gredefsizedsymbol{greVBarSmallSC}{greextra}{VBarSmallSC}
71 \gredefsizedsymbol{greABarCaption}{greextra}{ABarCaption}
72 \gredefsizedsymbol{greRBarCaption}{greextra}{RBarCaption}
73 \gredefsizedsymbol{greVBarCaption}{greextra}{VBarCaption}
74 \gredefsizedsymbol{greABarCaptionSlant}{greextra}{ABarCaptionSlant}
75 \gredefsizedsymbol{greRBarCaptionSlant}{greextra}{RBarCaptionSlant}
76 \gredefsizedsymbol{greVBarCaptionSlant}{greextra}{VBarCaptionSlant}
77 \gredefsizedsymbol{greABarCaptionSC}{greextra}{ABarCaptionSC}
78 \gredefsizedsymbol{greRBarCaptionSC}{greextra}{RBarCaptionSC}
79 \gredefsizedsymbol{greVBarCaptionSC}{greextra}{VBarCaptionSC}
80 \gredefsizedsymbol{greABarAlt}{greextra}{RBar.alt}
81 \gredefsizedsymbol{greRBarAlt}{greextra}{RBar.alt}
82 \gredefsizedsymbol{greVBarAlt}{greextra}{VBar.alt}
83
84 \def\grebarredsymbol#1#2#3#4#5{%
85 \leavevmode\hbox to 0pt{}\kern #4\lower#5%
86 \hbox{\csname #2\endcsname{#3}}\kern -#4\relax #1%
87 }%
88
89 %% Intermediate version or barred glyph definition
90 %% #1: the csname you want to define
91 %% #2: the letter you'll typeset (you can use bold, italic, etc.)
92 %% #3: the symbol corresponding to the glyph in greextra. Must be defined with \gredefsizedsymbol
93 %% #4: the size of greextra
94 %% #5: the kern of the bar from the beggining of the glyph
95 %% #6: greextra glyph lowering
96 \def\gredefbarredsymbol#1#2#3#4#5#6{%
97 \expandafter\gdef\csname #1\endcsname {%
98 \grebarredsymbol{#2}{#3}{#4}{#5}{#6}%
99 }%
100 }%
101
102 %% Most simple version or barred glyph definition
103 %% #1: A, R or V
104 %% #2: the negative kern
105 \def\gresimpledefbarredsymbol#1#2{%
106 \gredefbarredsymbol{#1bar}{#1}{gre#1Bar}{\f@size}{#2}{0pt}%
107 }%
108
109 % defining \ABar, \VBar and \RBar for libertine font, define yours for your font
110 \gresimpledefbarredsymbol{A}{.30em}%
111 \gresimpledefbarredsymbol{R}{.35em}%
112 \gresimpledefbarredsymbol{V}{.10em}%
113
114 \gre@iflatex{%
115 \def\gre@latex@barredsymbol#1#2#3#4{%
116 \gre@trace{gre@latex@barredsymbol{#1}{#2}{#3}{#4}}%
117 \IfStrEq{\f@series/\f@shape}{#1}{\grebarredsymbol{#2}{#3}{\f@size}{#4}{0pt}}%
118 \gre@trace@end%
119 }%
120
121 %% define a barred symbol that handles italic, slanted, and small cap shapes
122 %% simply (LaTeX-only)
123 %% Most simple version or barred glyph definition
124 %% #1: A, R or V
125 %% #2: the negative kern for upright shape
126 %% #3: idem, for italic/slanted shape
127 %% #4: idem, for bold shape
128 %% #5: idem, for bold and italic/slanted shape
129 \def\grelatexsimpledefbarredsymbol#1#2#3#4#5{%
130 \expandafter\gdef\csname #1bar\endcsname {%
131 \gre@latex@barredsymbol{m/n}{#1}{gre#1Bar}{#2}{%
132 \gre@latex@barredsymbol{m/it}{#1}{gre#1BarSlant}{#3}{%
133 \gre@latex@barredsymbol{m/sl}{#1}{gre#1BarSlant}{#3}{%
134 \gre@latex@barredsymbol{bx/n}{#1}{gre#1Bar}{#4}{%
135 \gre@latex@barredsymbol{bx/it}{#1}{gre#1BarSlant}{#5}{%
136 \gre@latex@barredsymbol{bx/sl}{#1}{gre#1BarSlant}{#5}{%
137 \gre@latex@barredsymbol{b/n}{#1}{gre#1Bar}{#4}{%
138 \gre@latex@barredsymbol{b/it}{#1}{gre#1BarSlant}{#5}{%
139 \gre@latex@barredsymbol{b/sl}{#1}{gre#1BarSlant}{#5}{%
140 }%
141 }%
142 }%
143 }%
144 }%
145 }%
146 }%
147 }%
148 }%
149 }%
150 }%
151
152 \grelatexsimpledefbarredsymbol{A}{.30em}{.35em}{.30em}{.33em}%
153 \grelatexsimpledefbarredsymbol{R}{.35em}{.38em}{.45em}{.48em}%
154 \grelatexsimpledefbarredsymbol{V}{.10em}{.12em}{.14em}{.18em}%
155 }%
156
157 % the gothic R and V
158 \gredefsymbol{gothRbar}{greextra}{RWithBarGoth}%
159 \gredefsymbol{gothVbar}{greextra}{VWithBarGoth}%
160
161 % the macro to typeset a dagger
162 \gredefsymbol{GreDagger}{greextra}{Dagger}%
163
164 % macro to typeset a (malt) cross
165 \gredefsymbol{grecross}{greextra}{Cross}%
166 \gredefsymbol{grealtcross}{greextra}{Cross.alt}%
167
168 %stars
169 \gredefsymbol{greheightstar}{greextra}{StarHeight}%
170 \gredefsymbol{gresixstar}{greextra}{StarSix}%
171 \let\GreStar\gresixstar%
172
173 %%%%%%%%%%%%
174 %% Lines %%
175 %%%%%%%%%%%%
176 %Unlike the character symbols above, we require that the font size be specified when using the lines.
177
178 \gredefsizedsymbol{greLineOne}{greextra}{Line1}%
179 \gredefsizedsymbol{greLineTwo}{greextra}{Line2}%
180 \gredefsizedsymbol{greLineThree}{greextra}{Line3}%
181 \gredefsizedsymbol{greLineFour}{greextra}{Line4}%
182 \gredefsizedsymbol{greLineFive}{greextra}{Line5}%
183
184 %lines
185 %#1 is the type of line (1-5)
186 %#2 is the number of pt of the font it will use
187 \def\greseparator#1#2{%
188 \ifcase#1\relax %
189 \or\greLineOne{#2}%
190 \or\greLineTwo{#2}%
191 \or\greLineThree{#2}%
192 \or\greLineFour{#2}%
193 \or\greLineFive{#2}%
194 \fi%
195 }%
196
197
198 %%%%%%%%%%%
199 %% Ornamentation
200 %%%%%%%%%%%
201
202 \gredefsizedsymbol{greOrnamentOne}{greextra}{Drawing1}%
203 \gredefsizedsymbol{greOrnamentTwo}{greextra}{Drawing2}%
204
205 \def\greornamentation#1#2{%
206 \ifcase#1\relax%
207 \or\greOrnamentOne{#2}%
208 \or\greOrnamentTwo{#2}%
209 \fi%
210 }%
211
212 %% Specials
213
214 \def\gresetspecial#1{\directlua{gregoriotex.define_special_character("#1")}}%
215 \def\greunsetspecial#1{\directlua{gregoriotex.undefine_special_character("#1")}}%
216 \def\GreSpecial#1{\directlua{gregoriotex.special_character("#1")}}%
217
218 \gresetspecial{A/}{\Abar{}}%
219 \gresetspecial{\string\037}{\%{}}%
220 \gresetspecial{R/}{\Rbar{}}%
221 \gresetspecial{V/}{\Vbar{}}%
222 \gresetspecial{'ae}{\'\ae{}}%
223 \gresetspecial{'oe}{\'\oe{}}%
224 \gresetspecial{ae}{\ae{}}%
225 \gresetspecial{oe}{\oe{}}%
226 \gresetspecial{*}{\GreStar{}}%
227 \gresetspecial{+}{\GreDagger{}}%
228 \gresetspecial{-}{\gre@char@zerohyph{}}%
229 \gresetspecial{\string\092}{\textbackslash{}}%
230 \gresetspecial{\string\038}{\&{}}%
231 \gresetspecial{\string\035}{\#{}}%
232 \gresetspecial{\string\095}{\_{}}%
233 \gresetspecial{\string\126}{\gretilde{}}%
234 \gre@iflatex{%
235 \@ifpackageloaded{luainputenc}{}{%
236 \gresetspecial{'æ}{\'\ae{}}%
237 \gresetspecial{'œ}{\'\oe{}}%
238 }%
239 }%
240 \gre@ifnotlatex{%
241 \gresetspecial{'æ}{\'\ae{}}%
242 \gresetspecial{'œ}{\'\oe{}}%
243 }%