blob: 6ef01edb1df10267f5e107a014f801b52e83c993 (
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
|
\ProvidesFile{gloss-farsi.ldf}[polyglossia: module for farsi]
\RequirePackage{bidi}
\RequirePackage{arabicnumbers}
\RequirePackage{farsical}
\RequirePackage{hijrical}
\makeatletter
\ifx\l@farsi\@undefined
%\xpg@nopatterns{Farsi}%
\adddialect\l@farsi\l@nohyphenation
\fi
\def\farsi@RL{\relax}
\newif\if@western@numerals
\def\tmp@western{western}
\define@key{farsi}{numerals}[eastern]{%
\def\@tmpa{#1}%
\ifx\@tmpa\tmp@western\@western@numeralstrue\else%
\@western@numeralsfalse%
\fi}
%this is needed for \abjad in arabicnumbers.sty
\def\tmp@true{true}
\define@key{farsi}{abjadjimnotail}[true]{%
\def\@tmpa{#1}%
\ifx\@tmpa\tmp@true\abjad@jim@notailtrue%
\else
\abjad@jim@notailfalse
\fi}
% NOT YET USED
\define@key{farsi}{locale}[default]{%
\def\@farsi@locale{#1}}
%TODO add option for CALENDAR
\setkeys{farsi}{locale,numerals}
\def\farsigregmonth#1{\ifcase#1%
\or ژانویه\or فوریه\or مارس\or آوریل\or مه\or ژوئن\or ژوئیه\or اوت\or سپتامبر\or اکتبر\or نوامبر\or دسامبر\fi}
\def\farsimonth#1{\ifcase#1%
\or کانون ثانی\or شباط\or اذار%%or ادار
\or نیسان\or ایار\or حزیران\or تموز\or آب\or ایلول\or تشرین اول\or تشرین ثانی\or کانون اول\fi}
%\Hijritoday is now locale-aware and will format the date with this macro:
\DefineFormatHijriDate{farsi}{\@ensure@RTL{%
\farsinumber{\value{Hijriday}}\space\HijriMonthArabic{\value{Hijrimonth}}\space\farsinumber{\value{Hijriyear}}}}
\def\captionsfarsi{%
\def\prefacename{\@ensure@RTL{پیشگفتار}}%
\def\refname{\@ensure@RTL{مراجع}}%
\def\abstractname{\@ensure@RTL{چکیده}}%
\def\bibname{\@ensure@RTL{کتابنامه}}%
\def\chaptername{\@ensure@RTL{فصل}}%
\def\appendixname{\@ensure@RTL{پیوست}}%
\def\contentsname{\@ensure@RTL{فهرست مطالب}}%
\def\listfigurename{\@ensure@RTL{لیست تصاویر}}%
\def\listtablename{\@ensure@RTL{لیست جداول}}%
\def\indexname{\@ensure@RTL{نمایه}}%
\def\figurename{\@ensure@RTL{شكل}}%
\def\tablename{\@ensure@RTL{جدول}}%
\def\partname{\@ensure@RTL{بخش}}%
\def\enclname{\@ensure@RTL{پیوست}}%
\def\ccname{\@ensure@RTL{رونوشت}}%
\def\headtoname{\@ensure@RTL{به}}%
\def\pagename{\@ensure@RTL{صفحة}}%
\def\seename{\@ensure@RTL{ببینید}}%
\def\alsoname{\@ensure@RTL{نیز ببینید}}%
\def\proofname{\@ensure@RTL{برهان}}%
\def\glossaryname{\@ensure@RTL{دانشنامه}}%
}
\def\datefarsi{%
\def\today{\@ensure@RTL{\farsinumber\day\space\farsigregmonth{\month}\space\farsinumber\year}}%
}
\def\farsinumber#1{%
\if@western@numerals
\number#1%
\else
\ifnum\XeTeXcharglyph"06F0 > 0%
\farsidigits{\number#1}%
%%{\protect\addfontfeature{Mapping=farsidigits}\number#1}%
\else%
\arabicdigits{\number#1}%
%%{\protect\addfontfeature{Mapping=arabicdigits}\number#1}%
\fi
\fi}
%\def\farsinum#1{\expandafter\farsinumber\csname c@#1\endcsname}
%\def\farsibracenum#1{(\expandafter\farsinumber\csname c@#1\endcsname)}
%\def\farsiornatebracenum#1{\char"FD3E\expandafter\farsinumber\csname c@#1\endcsname\char"FD3F}
%\def\farsialph#1{\expandafter\@farsialph\csname c@#1\endcsname}
\def\farsi@numbers{%
\let\@latinalph\@alph%
\let\@latinAlph\@Alph%
\let\@alph\abjad%
\let\@Alph\abjad%
}
\def\nofarsi@numbers{%
\let\@alph\@latinalph%
\let\@Alph\@latinAlph%
}
\def\farsi@globalnumbers{%
\let\orig@arabic\@arabic%
\let\@arabic\farsinumber%
% For some reason \thefootnote needs to be set separately:
\renewcommand\thefootnote{\protect\farsinumber{\c@footnote}}%
}
\def\nofarsi@globalnumbers{
\let\@arabic\orig@arabic%
\renewcommand\thefootnote{\protect\number{\c@footnote}}%
}
\def\farsi@language{\language=\l@farsi}
\def\farsi@font{%
\@ifundefined{farsifont}{%
\@ifundefined{arabicfont}{%
\normalfontlatin%
\font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname" at \f@size pt
\zf@check@ot@script{arab}%
\if@tempswa
\addfontfeature{Script=Arabic}%
\else
\PackageError{polyglossia}{^^J
The current font does not contain the Arabic script!^^J
Please define \string\arabicfont\space or \string\farsifont\space with \newfontfamily}%
\fi
\zf@check@ot@lang{FAR}%
\if@tempswa\addfontfeature{Language=Farsi}\fi}%
{\arabicfont%
\font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname" at \f@size pt
\zf@check@ot@lang{FAR}%
\if@tempswa\addfontfeature{Language=Farsi}\fi}%
}%
{\farsifont}%
}
% TODO add setup to define Sans and Mono Arabic fonts if desired
\def\farsi@font@sf{%
\@ifundefined{farsifontsf}{%
% \sffamily% FIXME
% \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname" at \f@size pt
% \zf@check@ot@script{arab}%
% \if@tempswa
% \addfontfeature{Script=Arabic}%
% \else
\farsi@font%
% \fi
}%
{\farsifontsf}%
}
\def\farsi@font@tt{%
\@ifundefined{farsifonttt}{%
% \ttfamily% FIXME
% \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname" at \f@size pt
% \zf@check@ot@script{arab}%
% \if@tempswa
% \addfontfeature{Script=Arabic}%
% \else
\farsi@font%
% \fi
}%
{\farsifonttt}%
}
\def\selectnormalfontfarsi{%
\let\normalfont=\farsi@font%
\let\rmfamily=\farsi@font%
\let\sffamily=\farsi@font@sf%
\let\ttfamily=\farsi@font@tt%
\def\reset@font{\normalfont}}
\def\blockextras@farsi{%
\let\@@MakeUppercase\MakeUppercase%
\def\MakeUppercase##1{##1}%
}
\def\noextras@farsi{%
\let\MakeUppercase\@@MakeUppercase%
}
\endinput
|