[XeTeX] RTL hyperlink problems

Khaled Hosny khaledhosny at eglug.org
Fri Aug 20 16:00:17 CEST 2010


On Fri, Aug 20, 2010 at 04:51:45PM +0300, Ron Aaron wrote:
> On Friday 20 August 2010 16:15:22 Khaled Hosny wrote:
> > On Fri, Aug 20, 2010 at 03:11:15PM +0200, Ulrike Fischer wrote:
> > > Am Fri, 20 Aug 2010 13:57:46 +0300 schrieb Ron Aaron:
> > > > Yes, well that is exactly the problem I am trying to find a way to
> > > > work-around! 
> > > 
> > > I did understand this ;-). But if the author of bidi didn't find a
> > > solution to the problem  perhaps there isn't one. 
> > 
> > Right, IIRC, that was the conclusion we reached while ago, it can't but
> > be fixed in the engine itself.
> 
> Hmm.  Well, I've almost got what I want by modifying my \hr macro like so:
> 
> \def\hr#1#2{%
> \ifrtl\endR\fi
> \special{pdf:bann <</Subtype/Link/BS
> 	<</Type/Border/W 0.0 /S/S>> 
> 	/A << /S/URI/URI (#1)>> >>}
> \special{pdf: bc [ 0 0 1 ]}{\bgroup #2 \egroup}\special{pdf: ec}
> \special{pdf:eann}
> \ifrtl\beginR\fi}
> 
> 
> Note the '\ifrtl', which is a new conditional which must be set to indicate LTR vs RTL.  So I stop the RTL before doing the special, and resume it when I'm done with the specials.  That works /almost/ as I want. 
> 
> The remaining problem is that the link text (#2 in the macro) is reversed, e.g. LTR.  Do you know of a TeX way to reverse the characters?   I could shell out to 'rev', but that would be a pretty severe hit since I have a lot of links in my document.  I suppose I could also just reverse the text in the document so it shows in the correct direction, but that's not likely to be easy to remember to do.
> 
> Unlike in Arabic,  Hebrew has no connecting forms to worrry about -- so simply printing the 'link text' should look ok (that text also has no vowel points to complicate matters).

ArabTeX does text reordering on its own, all at macro level, so it is
doable, but I can't tell how hard is that, I'd never try to read that
code as I care about my mental sanity.

Regards,
 Khaled

-- 
 Khaled Hosny
 Arabic localiser and member of Arabeyes.org team
 Free font developer


More information about the XeTeX mailing list