summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-07-07 22:16:24 +0000
committerKarl Berry <karl@freefriends.org>2015-07-07 22:16:24 +0000
commit736a3b87f3334f7693f8bcae8177084e3e9d5dec (patch)
treeb7efbb43117d544a81f1e2c74a2a40d7136de829 /Master/texmf-dist/tex/xelatex
parentf9261e1ad3983ad9cd7e29dc77c49eb245c2e724 (diff)
bidihl (7jul15)
git-svn-id: svn://tug.org/texlive/trunk@37795 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex')
-rw-r--r--Master/texmf-dist/tex/xelatex/bidihl/bidihl.sty37
1 files changed, 25 insertions, 12 deletions
diff --git a/Master/texmf-dist/tex/xelatex/bidihl/bidihl.sty b/Master/texmf-dist/tex/xelatex/bidihl/bidihl.sty
index 1aaff637a8d..ec3f12afa94 100644
--- a/Master/texmf-dist/tex/xelatex/bidihl/bidihl.sty
+++ b/Master/texmf-dist/tex/xelatex/bidihl/bidihl.sty
@@ -13,7 +13,7 @@
%%
%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{bidihl}[2015/07/04 v0.1b Experimental bidi-aware text highlighting]
+\ProvidesPackage{bidihl}[2015/07/07 v0.1c Experimental bidi-aware text highlighting]
%% Load color package and define highlighting color
@@ -22,10 +22,7 @@
%% Register Declaration
-\newdimen\bidihl@highlight@depth \bidihl@highlight@depth-\maxdimen
-\newdimen\bidihl@highlight@thickness \bidihl@highlight@thickness.4pt
-
-\newdimen\bidihlboxheight \bidihlboxheight10pt
+\newdimen\bidihl@line@thickness \bidihl@line@thickness.4pt
\newdimen\bidihl@pixel \bidihl@pixel0.1pt
@@ -37,21 +34,32 @@
%% User Interface and Initialization
-\def\bidihl{\bidihl@highlight\bidihl@highlight@depth{-\bidihl@highlight@depth}{-\dp\strutbox}}
+\def\bidihl{\bidihl@highlight{\dp\strutbox}{\ht\strutbox}}
-\def\bidihl@highlight#1#2#3#4{\begingroup \let\\\bidihlnewline
+\def\bidihl@line#1#2#3#4{\begingroup \let\\\bidihlnewline
\ifdim#1<\z@ \bidihl@height#3\relax
\else \bidihl@height#2\relax \fi
\bidihl@depth-\bidihl@height
- \ifdim\bidihl@height<\z@ \advance\bidihl@depth\bidihl@highlight@thickness
- \else \advance\bidihl@height\bidihl@highlight@thickness \fi
+ \ifdim\bidihl@height<\z@ \advance\bidihl@depth\bidihl@line@thickness
+ \else \advance\bidihl@height\bidihl@line@thickness \fi
\bidihl@nospacetrue
\ifvmode\leavevmode\fi \bidihl@spacefactor\spacefactor
\def\@tempa{#4 }\edef\@tempb{\noexpand\@nil\space}%
\expandafter\expandafter\expandafter\bidihl@wordloop
\expandafter\@tempa\@tempb
\endgroup \bidihl@aftergroup}
+
+
+\def\bidihl@highlight#1#2#3{\begingroup \let\\\bidihlnewline
+ \bidihl@depth#1\relax
+ \bidihl@height#2\relax
+ \bidihl@nospacetrue
+ \ifvmode\leavevmode\fi \bidihl@spacefactor\spacefactor
+ \def\@tempa{#3 }\edef\@tempb{\noexpand\@nil\space}%
+ \expandafter\expandafter\expandafter\bidihl@wordloop
+ \expandafter\@tempa\@tempb
+ \endgroup \bidihl@aftergroup}
%% Processing Word Elements
@@ -127,14 +135,19 @@
\@tempdima\wd\@tempboxa
\if@RTL%
\box\@tempboxa
- {\color{bidihlcolor}\llap{\vrule\@height\bidihlboxheight\@depth\bidihl@depth\@width\@tempdima}}%
+ {\color{bidihlcolor}\llap{\vrule\@height\bidihl@height\@depth\bidihl@depth\@width\@tempdima}}%
\else
- {\color{bidihlcolor}\rlap{\vrule\@height\bidihlboxheight\@depth\bidihl@depth\@width\@tempdima}}%
+ {\color{bidihlcolor}\rlap{\vrule\@height\bidihl@height\@depth\bidihl@depth\@width\@tempdima}}%
\box\@tempboxa
\fi
\def\bidihl@theword{}}
\def\bidihl@skip#1{%
- \leaders\hb@xt@\bidihl@pixel{\hss{\color{bidihlcolor}\vrule\@height\bidihlboxheight\@depth\bidihl@depth}\hss}\hskip#1\relax}
+ \if@RTL%
+ \leaders\hb@xt@\bidihl@pixel{\hss{\color{bidihlcolor}\vrule\@height\bidihl@height\@depth\bidihl@depth}\hss}%
+ \hskip#1\relax%
+ \else%
+ {\color{bidihlcolor}\leaders\hrule\@height\bidihl@height\@depth\bidihl@depth\hskip#1\relax}%
+ \fi}