summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/polyglossia/gloss-hebrew.ldf
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-01-29 22:37:53 +0000
committerKarl Berry <karl@freefriends.org>2020-01-29 22:37:53 +0000
commit015c5f064b14e4a79f151b46a6dd46b150520c81 (patch)
treecc3434d0ae73900950b37bc952816286d4d76d5c /Master/texmf-dist/tex/latex/polyglossia/gloss-hebrew.ldf
parente9549ffe43d42fda4e5d3778e1d26fbd95e4ae9f (diff)
polyglossia (29jan20)
git-svn-id: svn://tug.org/texlive/trunk@53592 c570f23f-e606-0410-a88d-b1316a301751
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