W3C home > Mailing lists > Public > www-style@w3.org > November 2006

RE: rlo text should not be automatically right-aligned

From: Paul Nelson (ATC) <paulnel@winse.microsoft.com>
Date: Wed, 1 Nov 2006 13:58:07 -0800
Message-ID: <49C257E2C13F584790B2E302E021B6F911AADD89@winse-msg-01.segroup.winse.corp.microsoft.com>
To: Richard Ishida <ishida@w3.org>, <www-international@w3.org>, <www-style@w3.org>, <w3c-css-wg@w3.org>
CC: Steven Pemberton <steven.pemberton@cwi.nl>

Richard,

Your assertion that "rlo" and "lro" should not set the text direction is flawed because you are putting two properties together. 'direction' sets initial block level text-align. The 'unicode-bidi' is a second property that does not set the block direction. ****Please do not override the 'dir' property to contain two properties**** It only causes confusion.

The <bdo> is an inline element and never sets the block text-align. In your example, the block level direction is set by the <blockquote> element. If you do the following your blockquote will also be left aligned because the 'direction' property is ltr. 

<p>The text is stored in logical order, so the order of characters in memory would  be:</p> <blockquote style="direction: ltr; unicode-bidi: bidi-override;">םואניבה תוליעפ, W3C</blockquote>


In your exampe given below you have explicitly set the block level direction to rtl and therefore the text should be initially right aligned...whether or not the bidi-override is applied. That is consistent with behavior for bidi text. 
<div style="direction: rtl; unicode-bidi: bidi-override;">Some inline text
and more inline text on another line
<p>A paragraph of text</p>
Some more <em>inline</em> text
</div>

Now lets have some fun. Please don't confuse 'text-align' (a content property) with block align. Put some width on the <div> like the following:
<hr>
<div style="width: 250px; background-color: tan; direction: rtl; unicode-bidi:  bidi-override;">Some inline text
and more inline text on another line
<p>A paragraph of text</p>
Some more <em>inline</em> text
</div>

In this case the block level alignment is still left with the text-align right. You will see that both Opera and IE render the page the same (correctly from my interpretation), while FireFox has treated block alignment the same a the text-align property. Perhaps this is the source of confusion.


UTR #9 states that explicit directional overrides allow the bidirectional types to be overriden when required for special cases, such as for part numbers.

1. Hebrew text is a RTL processed language. Thus, to reverse Hebrew script one needs to say to override the unicode-bidi in the direction of ltr. We are saying that the Hebrew text needs to be treated as if it were ltr text.

<p>םילש is peace typed backwards<span style="direction: ltr; unicode-bidi: bidi- override;">םילש peace is seen correctly when treated as ltr with bidi- override</span></p>

2. When reversing left to right text we need to treat it as if it were right to left reading.
<p>Mirror <span style="direction: rlo; unicode-bidi: bidi-override;">Mirror</span></p>

With the above in mind I see that the override is affecting the character ordering and not layout.



The following looks to render as I would expect when I look at it in IE7 and Opera. Only one problem in FireFox by deriving block alignment from text-align.

<html>
<body>
<p>Mirror<span style="direction: rtl; unicode-bidi: bidi- override;">Mirror</span></p>
<p>שלים<span style="direction: ltr; unicode-bidi: bidi-override;">שלים</span></p>

<hr>
<p>םילש is peace typed backwards<span style="direction: ltr; unicode-bidi: bidi- override;">םילש peace is seen correctly when treated as ltr with bidi- override</span></p>

<hr>
<p>The text is stored in logical order, so the order of characters in memory would  be:</p> <blockquote style="direction: ltr; unicode-bidi: bidi-override;">םואניבה תוליעפ,  W3C</blockquote>

<hr>
<div style="direction: rtl; unicode-bidi: bidi-override;">Some inline text
and more inline text on another line
<p>A paragraph of text</p>
Some more <em>inline</em> text
</div>

<hr>
<div style="width: 250px; background-color: tan; direction: rtl; unicode-bidi:  bidi-override;">Some inline text
and more inline text on another line
<p>A paragraph of text</p>
Some more <em>inline</em> text
</div>

</body>
</html>


Don't you just love the way that bidirectional issues can mess with your mind?

Regards,

Paul


-----Original Message-----
From: www-style-request@w3.org [mailto:www-style-request@w3.org] On Behalf Of Richard Ishida
Sent: Thursday, November 02, 2006 12:59 AM
To: www-international@w3.org; www-style@w3.org
Cc: 'Steven Pemberton'
Subject: rlo text should not be automatically right-aligned


See http://www.w3.org/International/notes/notes-rlo-blocks-css.php


Background (repeated)

These notes relate to the handling of right-to-left and left-to-right overrides in CSS and to some extent in HTML and xHTML.
They draw on information in the following mail threads:
  * [18]bidi-override scope in CSS2 and CSS 2.1

[18] http://www.w3.org/Search/Mail/Public/search?type-index=www-style&index-type=t&keywords=bidi-override+scope+in+CSS2+and+CSS+2.1&search=Search

Suppose we have the following code in an XML application such as XHTML2, embedded in content with a base direction of ltr:
<div dir="rlo">Some inline text
and more inline text on another line
<p>A paragraph of text</p>
Some more <em>inline</em> text
</div>

and the following CSS style in the same document:
*[dir="lro"] { unicode-bidi: bidi-override; direction: ltr} *[dir="rlo"] { unicode-bidi: bidi-override; direction: rtl}




rlo text should not be automatically right-aligned

Given the CSS and markup above, the div when displayed would currently be right aligned. This is due to the presence of the [20]direction property, the value of which affects the initial setting of [21]text-align.

[20] http://www.w3.org/TR/CSS21/visuren.html#propdef-direction
[21] http://www.w3.org/TR/CSS21/text.html#propdef-text-align

I think that the alignment of the text should be independent of the application of an override.

For example, if I have some English text that is discussing the order of characters in memory, and I add an example in a blockquote, I would not expect the example text to be right-aligned. In the absence of an inherited text-align property, the following markup:
<p>The text is stored in logical order, so the order of characters in memory would be:</p> <blockquote>פעילות הבינאום, W3C</blockquote>

would result in the blockquote content being displayed
right-aligned:

To make the blockquote left-aligned, I would currently have to add the CSS text-align: left to the blockquote, or an enclosing element.

This perhaps means that, rather than unicode-bidi: bidi-override, we should have unicode-bidi: rlo/lro. The user could then apply the direction property if they wanted to change the default alignment.
This seems to be a more constent use of the direction property, which is currently fulfilling two roles when used with
unicode-bidi:override: a. setting the base direction of the block, b. indicating the desired direction of the override.

This approach would also provide consistency with the expectations of HTML users, who use the <bdo> inline element for directional overrides. The code:
<p>The text is stored in logical order, so the order of characters in memory would be:</p> <blockquote><bdo dir="ltr">פעילות הבינאום, W3C</bdo></blockquote>

would produce a blockquote with text that is left-aligned.



============
Richard Ishida
Internationalization Lead
W3C (World Wide Web Consortium)

http://www.w3.org/People/Ishida/
http://www.w3.org/International/
http://people.w3.org/rishida/blog/
http://www.flickr.com/photos/ishida/
Received on Wednesday, 1 November 2006 21:57:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:47 GMT