ALIGN attribute default

Anoosh Hosseini (anoosh@gorgan.mti.sgi.com)
Sun, 16 Apr 95 12:44:23 EDT

> The default value of the ALIGN attribute for paragraph like elements should
> not be specified as LEFT. Rather, the default should be determined by the
> bidirectional context. In the case that a paragraph contains only text from
> right-to-left scripts (Arabic & Hebrew), the default alignment should be
> RIGHT; otherwise, the default alignment should be LEFT. In the case that
> a paragraph mixes left-to-right and right-to-left scripts, the default base
> direction (and thus the alignment) should be determined according to the
> directionality of the first strongly directional character. Thus if an Arabic
> character preceded a Latin letter, then the default base directionality would
> be right-to-left and the default alignment would be RIGHT.
>
> Regards,
> Glenn Adams
>

While adding Arabic/Persian support to Mosaic, I came up with a similar
rule, but applied it globally to all elements in the document.
What you have described above, I call "dynamic alignment". In my
implementation all elements of HTML including images have an implied
alignment, even though some have "ALIGN=" attributes. All Elements with
text use dynamic aligment algorithm to determine their implied alignment,
(left-to-right or right-to-left) unless that element has an "ALIGN"
attribute which overrides the dynamic alignment. The interesting case
is lists:

<UL>
<LI> Arabic text..
<LI> English Arabic...
<LI> Arabic English
<LI> English text...
</UL>

Here based on a modified "dynamic alignment" algorithm one sets the
directory of the whole list. Even more fun is if this was Unicode
encoded HTML with Unicode direction hints.

Images are also an interesting case because they have no "text"
to provide hint of direction. I use the surrounding text direction
as a guide and also the "document primary direction". The latter is
computed using the same dynamic alignment algorithm, but over
the whole document.

-anoosh