Debian Codegraph @

texmf-dist/tex/latex/polyglossia/gloss-syriac.ldf

raw
1 % Language definition file (part of polyglossia v2.10 -- 2026/04/18)
2 %
3 \ProvidesFile{gloss-syriac.ldf}[polyglossia: module for Syriac]
4
5 \RequireBidi
6 \RequirePackage{arabicnumbers}
7
8 \PolyglossiaSetup{syriac}{
9 bcp47=syr,
10 bcp47-language=syr,
11 bcp47-script=Syrc,
12 script=Syriac,
13 scripttag=syrc,
14 langtag=SYR,
15 direction=RL,
16 hyphennames={syriac,nohyphenation},
17 localnumeral=syriacnumerals,
18 Localnumeral=syriacnumerals
19 }
20
21 % BCP-47 compliant aliases
22 \setlanguagealias*{syriac}{syr}
23
24 \def\syriacnumber#1{\@syriacnumber{#1}}
25
26 \newif\if@eastern@numerals
27 \newif\ifsyriac@customsep\syriac@customsepfalse
28 \def\xpg@sepmark{}
29
30 \DeclareKeys[polyglossia/gloss/syriac]
31 {
32 sectionsep.code = \gdef\xpg@sepmark{#1}\syriac@customseptrue,
33 sectionsep.default:n = .,
34 numerals.choice:,
35 numerals / eastern.code =
36 {%
37 \@eastern@numeralstrue
38 \SetLanguageKeys{syriac}{bcp47-extension-u=nu-syrc}%
39 },
40 numerals / western.code =
41 {%
42 \@eastern@numeralsfalse
43 \SetLanguageKeys{syriac}{bcp47-extension-u=nu-latn}%
44 },
45 numerals / abjad.code =
46 {%
47 \let\syriacnumber\abjadsyriac
48 },
49 numerals.default:n = eastern,
50 numerals/unknown.code = \xpg@warning{Unknown Syriac numerals option `#1'}
51 }
52
53 % Register default options
54 \InitializeGlossOptions{syriac}{numerals=western}
55
56 %\define@key{polyglossia}{syriaclocale}[default]{%
57 % \def\@syriac@locale{#1}}
58 %
59 %\def\captionssyriac{%
60 %\def\prefacename{\@ensure@RTL{}}%
61 %\def\refname{\@ensure@RTL{}}
62 %\def\abstractname{\@ensure@RTL{}}%
63 %\def\bibname{\@ensure@RTL{}}%
64 %\def\chaptername{\@ensure@RTL{}}%
65 %\def\appendixname{\@ensure@RTL{}}%
66 %\def\contentsname{\@ensure@RTL{}}
67 %\def\listfigurename{\@ensure@RTL{}}%
68 %\def\listtablename{\@ensure@RTL{}}%
69 %\def\indexname{\@ensure@RTL{}}%
70 %\def\figurename{\@ensure@RTL{}}%
71 %\def\tablename{\@ensure@RTL{}}%
72 %\def\partname{\@ensure@RTL{}}%
73 %\def\enclname{\@ensure@RTL{}}%
74 %\def\ccname{\@ensure@RTL{}}%
75 %\def\headtoname{\@ensure@RTL{}}%
76 %\def\pagename{\@ensure@RTL{}}%
77 %\def\seename{\@ensure@RTL{}}%
78 %\def\alsoname{\@ensure@RTL{}}%
79 %\def\proofname{\@ensure@RTL{}}%
80 %\def\glossaryname{\@ensure@RTL{}}%
81 %}
82
83 \def\datesyriac{%
84 \def\syriac@month##1{\ifcase##1%
85 \or ܟܢܘܢ ܐܚܪܝ\or ܫܒܛ\or ܐܕܪ\or ܢܝܣܢ\or ܐܝܪ\or ܚܙܝܪܢ\or ܬܡܘܙ\or ܐܒ\or ܐܝܠܘܠ% ܐܠܘܠ
86 \or ܬܫܪܝܢ ܩܕܡ% ܬܫܪܝܢ ܩܕܝܡ
87 \or ܬܫܪܝܢ ܐܚܪܝ\or ܟܢܘܢ ܩܕܡ% ܟܢܘܢ ܩܕܝܡ
88 \fi}%
89 \def\today{\@ensure@RTL{\syriacnumber\day{\space}%
90 \syriac@month{\month}{\space}\syriacnumber\year}}%
91 }
92
93 \def\syriac@zero{}
94
95 \def\abjadsyriac#1{%
96 \ifnum#1>9999\xpg@ill@value{#1}{abjadsyriac}%
97 \else%
98 \ifnum#1<\z@\space\xpg@ill@value{#1}{abjadsyriac}%
99 \else%
100 \ifnum#1<10\expandafter\abj@syr@num@i\number#1%
101 \else%
102 \ifnum#1<100\expandafter\abj@syr@num@ii\number#1%
103 \else%
104 \ifnum#1<1000\expandafter\abj@syr@num@iii\number#1%
105 \else%
106 \expandafter\abj@syr@num@iv\number#1%
107 \fi%
108 \fi%
109 \fi%
110 \fi%
111 \fi%
112 }
113 \def\abj@syr@num@i#1{%
114 \ifcase#1\or\char"0710\or\char"0712\or\char"0713\or\char"0715%
115 \or\char"0717\or\char"0718\or\char"0719\or\char"071A\or\char"071B\fi
116 \ifnum#1=\z@\syriac@zero\fi}
117 \def\abj@syr@num@ii#1{%
118 \ifcase#1\or\char"071D\or\char"071F\or\char"0720\or\char"0721\or\char"0722%
119 \or\char"0723\or\char"0725\or\char"0726\or\char"0728\fi
120 \ifnum#1=\z@\fi\abj@syr@num@i}
121 \def\abj@syr@num@iii#1{%
122 \ifcase#1\or\char"0729\or\char"072A\or\char"072B\or\char"072C%
123 \or\char"0722\char"0307\or\char"0723\char"0307\or\char"0725\char"0307%
124 \or\char"0726\char"0307\or\char"0728\char"0307\fi
125 \ifnum#1=\z@\fi\abj@syr@num@ii}
126 \def\abj@syr@num@iv#1{%
127 \ifcase#1\or\char"0710\char"0748\or\char"0712\char"0748%
128 \or\char"0713\char"0748\or\char"0715\char"0748%
129 \or\char"0717\char"0748\or\char"0718\char"0748%
130 \or\char"0719\char"0748\or\char"071A\char"0748\or\char"071B\char"0748\fi
131 \ifnum#1=\z@\fi\abj@syr@num@iii}
132
133 \def\@syriacnumber#1{%
134 \if@eastern@numerals
135 %%% we test for the presence of one of ١٢٣٤٥٦٧٨٩٠ in the Syriac font,
136 %%% else we try \arabicfont if defined (and give a warning),
137 %%% else we fall back to the Western numerals.
138 \IfCharIsAvailableTF{0661}%
139 {\@ensure@LTR{\protect\arabicdigits{\number#1}}}%
140 {\@ensure@LTR{\arabicdigits{\number#1}}
141 \@ifundefined{arabicfont}%
142 {\number#1%%% <---changed from \RL{\protect\reset@font\protect\number#1}%
143 \xpg@warning{You have specified the option numerals=eastern for Syriac, but the Syriac font does not contain the appropriate glyphs:
144 since \string\arabicfont is not defined, we'll use Western numerals instead}}%
145 {\@ensure@LTR{\protect\arabicdigits{\number#1}}%
146 \xpg@warning{You have specified the option numerals=eastern for Syriac, but the Syriac font does not contain the appropriate glyphs:
147 I am using \string\arabicfont instead}}%
148 }%
149 \else
150 %%\RL{\protect\reset@font\number#1}%
151 \number#1%
152 \fi%
153 }
154
155 \def\syriac@numbers{%
156 \let\@alph\abjadsyriac%
157 \let\@Alph\abjadsyriac%
158 }
159
160 \def\nosyriac@numbers{%
161 \let\@alph\latin@alph%
162 \let\@Alph\latin@Alph%
163 }
164
165 \newcommand{\syriacnumerals}[2]{\syriacnumber{#2}}
166
167 % Store original definition
168 \let\xpg@save@arabic\@arabic
169
170 \def\syriac@globalnumbers{%
171 \let\@arabic\syriacnumber%
172 \renewcommand\thefootnote{\localnumeral*{footnote}}%
173 }
174
175 \def\nosyriac@globalnumbers{%
176 \let\@arabic\xpg@save@arabic%
177 }
178
179 \def\syriac@xetex@capsformat{%
180 \let\xpg@save@sepmark\@SepMark%
181 \SepMark{\xpg@sepmark}
182 }
183
184 \def\nosyriac@xetex@capsformat{%
185 \ifcsname xpg@save@sepmark\endcsname%
186 \SepMark{\xpg@save@sepmark}
187 \fi%
188 }
189
190 \def\syriac@luatex@capsformat{%
191 %
192 % change chapter and part headings
193 \ifsyriac@customsep
194 \ifcsname chapter\endcsname%
195 \let\xpg@save@thesection\thesection%
196 \renewcommand*\thesection{\thechapter\xpg@sepmark\@arabic\c@section}
197 \let\xpg@save@theequation\theequation%
198 \renewcommand*\theequation{%
199 \ifnum \c@chapter>\z@ \thechapter\xpg@sepmark\fi\@arabic\c@equation}
200 \let\xpg@save@thefigure\thefigure%
201 \renewcommand*\thefigure{%
202 \ifnum\c@chapter>\z@\thechapter\xpg@sepmark\fi\@arabic\c@figure}
203 \let\xpg@save@thetable\thetable%
204 \renewcommand*\thetable{%
205 \ifnum\c@chapter>\z@\thechapter\xpg@sepmark\fi\@arabic\c@table}
206 \fi%
207 \let\xpg@save@thesubsection\thesubsection%
208 \renewcommand\thesubsection
209 {\thesection\xpg@sepmark\@arabic\c@subsection}
210 \let\xpg@save@thesubsubsection\thesubsubsection%
211 \renewcommand\thesubsubsection{\thesubsection\xpg@sepmark\@arabic\c@subsubsection}
212 \let\xpg@save@theparagraph\theparagraph%
213 \renewcommand\theparagraph
214 {\thesubsubsection\xpg@sepmark\@arabic\c@paragraph}
215 \let\xpg@save@thesubparagraph\thesubparagraph%
216 \renewcommand\thesubparagraph{\theparagraph\xpg@sepmark\@arabic\c@subparagraph}
217 \fi% (end \ifsyriac@customsep)
218 }
219
220 \def\nosyriac@luatex@capsformat{%
221 \ifcsname xpg@save@thesection\endcsname%
222 \let\thesection\xpg@save@thesection%
223 \fi%
224 \ifcsname xpg@save@theequation\endcsname%
225 \let\theequation\xpg@save@theequation%
226 \fi%
227 \ifcsname xpg@save@thefigure\endcsname%
228 \let\thefigure\xpg@save@thefigure%
229 \fi%
230 \ifcsname xpg@save@thetable\endcsname%
231 \let\thetable\xpg@save@thetable%
232 \fi%
233 \ifcsname xpg@save@thesubsection\endcsname%
234 \let\thesubsection\xpg@save@thesubsection%
235 \ifcsname xpg@save@thesubsubsection\endcsname%
236 \let\thesubsubsection\xpg@save@thesubsubsection%
237 \fi%
238 \fi%
239 \ifcsname xpg@save@theparagraph\endcsname%
240 \let\theparagraph\xpg@save@theparagraph%
241 \fi%
242 \ifcsname xpg@save@thesubparagraph\endcsname%
243 \let\thesubparagraph\xpg@save@thesubparagraph%
244 \fi%
245 }
246
247 \def\blockextras@syriac{%
248 \ifsyriac@customsep
249 \ifxetex
250 \syriac@xetex@capsformat
251 \else
252 \syriac@luatex@capsformat
253 \fi
254 \fi
255 }
256 %
257 \def\noextras@syriac{%
258 \ifsyriac@customsep
259 \ifxetex
260 \nosyriac@xetex@capsformat
261 \else
262 \nosyriac@luatex@capsformat
263 \fi
264 \fi
265 }
266
267 \endinput