[luatex] Fribidi for LuaTeX

James Cloos cloos at jhcloos.com
Sun Jul 17 18:30:13 CEST 2011

>>>>> "TH" == Taco Hoekwater <taco at elvenkind.com> writes:

TH>   P1. Split the text into separate paragraphs. A paragraph separator is
TH>   kept with the previous paragraph. Within each paragraph, apply all
TH>   the other rules of this algorithm.

TH> Now, how does that apply to an \hbox ?  I simply do not know.

The basic idea, remembering that unicode's bidi algorithm is designed to
apply to plain text, is to treat things like \hbox, math boxes and the
like as a single character w/in their enclosing paragraphs, and as a
paragraph inside of the box.

Boxes of that sort probably should be treated as weak-l2r by default.

The inside paragraph probably should start with the direction used
immediately outside.  So, ABC\hbox{(4)}DEF probably should render
the same as ABC(45)DEF, which, visually, would be ordered FED)45(CBA
as characters and rendered with glyphs which look like FED(45)CBA.

(It is typical the use majuscules to represent r2l characters and
minisules to represent l2r characters when dicussing bidi.  The
digits do not reorder; chars like ( and ) take the same direction
as their surrounding chars, but the resulting glyphs are reversed.)

In the end, though, luatex will need an iterative process to get
bidi right.  Start with the low-hanging fruit and take direction
from the bidi users and their expectations.

So start by treating boxes as containing paragraphs, but being a
single character for the purposes of the text outside of the box.
And go from there based on user feedback.

James Cloos <cloos at jhcloos.com>         OpenPGP: 1024D/ED7DAEA6

More information about the luatex mailing list