W3C home > Mailing lists > Public > public-css-archive@w3.org > June 2017

Re: [csswg-drafts] [css-text] letter-spacing and word-spacing applied to which side?

From: aharon-lanin via GitHub <sysbot+gh@w3.org>
Date: Mon, 12 Jun 2017 07:28:38 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-307710925-1497252517-sysbot+gh@w3.org>
As far as I can see, what the spec says for letter-spacing is this:
"This property specifies additional spacing between adjacent characters (commonly called tracking). Letter-spacing is applied after bidi reordering and is in addition to any ‘word-spacing’. Letter-spacing must not be applied at the beginning or at the end of a line."

Thus, if uppercase letters represent RTL characters and lowercase represents LTR, and we have a direction:ltr block with the content "ABcdEF", the bidi reordering is "BAcdFE", and the letter-spacing should be applied between B and A, A and c, c and d, d and F, and F and E. It should not be applied at the beginning or end of the block.

That Gecko and Blink apply the spacing to the left of the ג in http://jsbin.com/botezog/edit?html,output is incorrect. As the spec says, "It should not be applied at the beginning or end of the block."

Worse, putting the spacing at "the end side of the bidi resolved direction", results in Gecko and Blink putting no spacing between A and c, and double spacing between d and F in the example above, which one can see at http://jsbin.com/cajanimahu/edit?html,output. The spacing should be even throughout.

If Edge and WebKit put the spacing at "the end side of CSS direction property" (which I currently have no easy way of verifying), their behavior isn't correct either. That is, they will do better than Gecko and Blink for http://jsbin.com/cajanimahu/edit?html,output, but will make the same mistake once the direction for the middle run is indicated explicitly in markup, as in http://jsbin.com/hiqesujaga/edit?html,output.

IMHO, letter-spacing is pretty much unusable in Gecko and Blink when applied to a mixture of LTR and RTL characters. Edge and WebKit should do better, but that too breaks down once the content contains explicit direction markup.

As for word spacing, the spec says "Additional spacing is applied to each word separator left in the text after the white space processing rules have been applied, and should be applied half on each side of the character". As far as I can tell, this definition is completely bidi-transparent.

And as far as I can tell from http://jsbin.com/jukudaxewa/edit?html,output, Gecko and Blink seem to get it pretty much right - except that Blink also seems to put word spacing after the trailing character in the last line; I have no idea why.

GitHub Notification of comment by aharon-lanin
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1517#issuecomment-307710925 using your GitHub account
Received on Monday, 12 June 2017 07:28:47 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:30:34 UTC