diff options
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/polyglossia/arabicnumbers.sty')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/polyglossia/arabicnumbers.sty | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/xelatex/polyglossia/arabicnumbers.sty b/Master/texmf-dist/tex/xelatex/polyglossia/arabicnumbers.sty new file mode 100644 index 00000000000..c45aa22a654 --- /dev/null +++ b/Master/texmf-dist/tex/xelatex/polyglossia/arabicnumbers.sty @@ -0,0 +1,66 @@ +\ProvidesPackage{arabicnumbers} + [2010/03/18 v0.2 % + Formatting of Arabic and Farsi digits and of Arabic abjad numerals] + +\def\arabicdigits#1{\expandafter\@arabic@digits #1@} +\def\@arabic@digits#1{% + \ifx @#1% then terminate + \else + \ifx0#1٠\else\ifx1#1١\else\ifx2#1٢\else\ifx3#1٣\else\ifx4#1٤\else\ifx5#1٥\else\ifx6#1٦\else\ifx7#1٧\else\ifx8#1٨\else\ifx9#1٩\else#1\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \expandafter\@arabic@digits + \fi +} + +\def\farsidigits#1{\expandafter\@farsi@digits #1@} +\def\@farsi@digits#1{% + \ifx @#1% then terminate + \else + \ifx0#1۰\else\ifx1#1۱\else\ifx2#1۲\else\ifx3#1۳\else\ifx4#1۴\else\ifx5#1۵\else\ifx6#1۶\else\ifx7#1۷\else\ifx8#1۸\else\ifx9#1۹\else#1\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \expandafter\@farsi@digits + \fi +} + +\newif\ifabjad@jim@notail +\abjad@jim@notailfalse + +\def\abjad#1{% +\ifnum#1>1999\xpg@ill@value{#1}{abjad numeral}% +\else +\ifnum#1<\z@\space\xpg@ill@value{#1}{abjad numeral}% + \else + \ifnum#1<10\expandafter\abj@num@i@iso\number#1% + \else + \ifnum#1<100\expandafter\abj@num@ii\number#1% + \else + \ifnum#1<\@m\expandafter\abj@num@iii\number#1% + \else + \ifnum#1<\@M\expandafter\abj@num@iv\number#1%since #1<2000, we must have 1000 + \fi + \fi + \fi + \fi + \fi +\fi +} +\def\abjad@zero{} +\def\abjad@three{ج\ifabjad@jim@notail\char"200D\fi} +\def\abj@num@i@iso#1{% + \ifcase#1\or ا\or ب\or\abjad@three\or د% + \or ه\char"200D\or و\or ز\or ح\or ط\fi% + \ifnum#1=\z@\abjad@zero\fi} +\def\abj@num@i#1{% + \ifcase#1\or ا\or ب\or\abjad@three\or د% + \or ه\or و\or ز\or ح\or ط\fi% + \ifnum#1=\z@\abjad@zero\fi} +\def\abj@num@ii#1{% + \ifcase#1\or ي\or ك\or ل\or م\or ن% + \or س\or ع\or ف\or ص\fi% + \ifnum#1=\z@\fi\abj@num@i} +\def\abj@num@iii#1{% + \ifcase#1\or ق\or ر\or ش\or ت\or ث% + \or خ\or ذ\or ض\or ظ\fi% + \ifnum#1=\z@\fi\abj@num@ii} +\def\abj@num@iv#1{% + \ifcase#1\or غ\fi + \ifnum#1=\z@\fi\abj@num@iii} +\endinput |