Re: about P1 part of BIDI alogrithm

From: Philippe Verdy <>
Date: Thu, 13 Oct 2011 15:56:06 +0200

2011/10/11 Eli Zaretskii <>:
>> From: Philippe Verdy <>
>> This means that you need to break lines in two separate steps: first
>> between paragraphs or forced line breaks, then a second after
>> determining the the direction of all characters and then remplacing
>> their possible mirroring to infer the position of inserted linewraps
>> (i.e. the virtual position where there could be a LINE SEPARATOR
>> producing the same effect; most often where there are whitespaces or
>> SHY). Reordering will still occur only after this step, and remains
>> limited to a line not to a full paragraph.
> This would mean to run the reordering twice, since you don't know
> where to wrap a line until you lay out all of its grapheme clusters,
> and you cannot do the layout until you reorder the characters.  That's
> because the dimensions of each character are generally different, and
> so without knowing which character will be the 1st on the line, which
> the second, etc. _in_the_visual_order_, you cannot compute their
> summary width, and without that you cannot decide where to break the
> line.

You've certainly not understood something. Reordering (of glyph ids,
but *not* of characters) needs to be applied only ***onc1e***, only as
the final step where you have already determined all linebreaks. You
don't need any reordering for determining where to wrap lines.

You absolutely ***don't need*** to use the "visual order" to compute
widths of glyphs (generated after mirroring and substitions), all you
need to know is where runs of text is changing its resolved direction
between RTL and LTR. Then the fact that a run by itself is RTL or LTR
plays absolutely no role in the computed widths. Such reordering
occurs only at the finel step where all line wraps, are already
dtermined as well as all glyph ids, and their relative positioning
adjustments (kerning, alignment, centering...) when actually drawing
the glyphs in a constistant order to transform their relative
positions (from glyph to glyph) into absolute positions (relative to
the computed margins).
Received on Thu Oct 13 2011 - 09:03:44 CDT

This archive was generated by hypermail 2.2.0 : Thu Oct 13 2011 - 09:03:46 CDT