summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/polyglossia/gloss-hebrew.ldf
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/polyglossia/gloss-hebrew.ldf')
-rw-r--r--Master/texmf-dist/tex/latex/polyglossia/gloss-hebrew.ldf33
1 files changed, 33 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/polyglossia/gloss-hebrew.ldf b/Master/texmf-dist/tex/latex/polyglossia/gloss-hebrew.ldf
index 1f366a0f551..a21d5909cba 100644
--- a/Master/texmf-dist/tex/latex/polyglossia/gloss-hebrew.ldf
+++ b/Master/texmf-dist/tex/latex/polyglossia/gloss-hebrew.ldf
@@ -9,6 +9,7 @@ and may look very wrong.}
\RequirePackage{hebrewcal}
\PolyglossiaSetup{hebrew}{
+ bcp47=he,
script=Hebrew,
direction=RL,
scripttag=hebr,
@@ -20,6 +21,9 @@ and may look very wrong.}
%digits = hebrewnumber
}
+% BCP-47 compliant aliases
+\setlanguagealias*{hebrew}{he}
+
\newif\if@calendar@hebrew
\def\tmp@hebrew{hebrew}
\define@key{hebrew}{calendar}[gregorian]{%
@@ -50,6 +54,9 @@ and may look very wrong.}
\setkeys{hebrew}{numerals}
+% Register default options
+\xpg@initialize@gloss@options{hebrew}{numerals=arabic,calendar=gregorian,marcheshvan=false}
+
\def\captionshebrew{%
\def\prefacename{מבוא}%
\def\refname{מקורות}%
@@ -104,19 +111,45 @@ and may look very wrong.}
\fi
}
+% Bidi inserts an RTL mark (0x200f) before any number, forcing numbers to
+% RTL. Hebrew uses LTR numbers, though. So we insert an LTR mark to revert
+% the directionality
+\ifxetex
+ \newcommand\xpg@hebrew@DigitsDotDashInterCharToks{\if@nonlatin\char"200E \fi}
+\fi
+
+\def\hebrew@ltr@numbers{%
+ \ifxetex
+ \XeTeXinterchartoks \bidi@sepmark@charclass \bidi@digits@charclass = {\xpg@hebrew@DigitsDotDashInterCharToks}
+ \fi%
+}
+
+\def\nohebrew@ltr@numbers{%
+ \ifxetex
+ % This is bidi's original intervention
+ \XeTeXinterchartoks \bidi@sepmark@charclass \bidi@digits@charclass = {\DigitsDotDashInterCharToks}
+ \fi%
+}
+
\def\hebrew@numbers{%
\let\@alph\hebrewnumeral%
\let\@Alph\Hebrewnumeral%
+ % Prevent bidi from setting the numbers RTL
+ \hebrew@ltr@numbers%
}
\def\nohebrew@numbers{%
\let\@alph\latin@alph%
\let\@Alph\latin@Alph%
+ % Restore previous bidi numbers definition
+ \nohebrew@ltr@numbers
}
\def\hebrew@globalnumbers{%
\let\@arabic\hebrewnumber%
\renewcommand\thefootnote{\localnumeral*{footnote}}%
+ % Prevent bidi from setting the numbers RTL
+ \hebrew@ltr@numbers%
}
% Store original definition