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

Bou Salim <[email protected]> Sat, 13 Jun 2026 18:40:52 +0100
Newsgroups gmane.comp.tex.context
Message-ID <CAA9mf=de9H=3Sm_+Eu=7KhZdmiMoFXMGU-Bw9c2X=z-aeE2fQA@mail.gmail.com>
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
___________________________________________________________________________________