Re: Issue with \definetextbackground in bidirectional text (English + Arabic)

Udi Fogiel via ntg-context <[email protected]> Sat, 13 Jun 2026 19:09:54 +0000
Newsgroups gmane.comp.tex.context
Message-ID <BdCcCu-iSkuK-LApqIZAAP29FtyLIhdMDU43T-WPf263cat8iJVyZ1Gy609CrlMBwvq99MnKr0hdPFc0Wx7HnE3vyzFxpf1rlpCS52dqnZI=@proton.me>
On Saturday, June 13th, 2026 at 8:45 PM, Bou Salim <[email protected]> wrote:

> Here's an example of mixed English and Arabic text. I defined the `HighlightText` command to highlight the text, but a problem arises in both cases:
>
> 1.  In case of right-to-left text, the command fails with English text (If it is not followed by English text).
> 2.  In case of left-to-right text, the command fails with Arabic text (If it is not followed by Arabic text).
>

The code of textbackground does not consider directions as far as I can tell.

In the file anch-pgr.lmt there is this comment:
 -- this is not yet r2l ready

Udi
On Saturday, June 13th, 2026 at 8:45 PM, Bou Salim <[email protected]> wrote:

> Here's an example of mixed English and Arabic text. I defined the `HighlightText` command to highlight the text, but a problem arises in both cases:
> 
> 1.  In case of right-to-left text, the command fails with English text (If it is not followed by English text).
> 2.  In case of left-to-right text, the command fails with Arabic text (If it is not followed by Arabic text).
> 
> ```
> \starttext
> \setupdirections[bidi=global,method=one]
> 
> \definefont[myfont][name:Amiri*arabic at 12pt]
> 
> \definetextbackground[HighlightText][backgroundcolor=yellow, frame=off]
> 
> \startmixedcolumns[n=2]
> \myfont
> 
> \righttoleft
> 
> first word
> \startHighlightText
> second word
> \stopHighlightText
> 
> كلمة أولى
> \startHighlightText
> كلمة ثانية
> \stopHighlightText
> 
> \column
> 
> \lefttoright
> 
> first word
> \startHighlightText
> second word
> \stopHighlightText
> 
> كلمة أولى
> \startHighlightText
> كلمة ثانية
> \stopHighlightText
> 
> \stopmixedcolumns
> 
> \stoptext
> ```
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________