Letter spacing doesn't happen consistently for digits
Categories
(Core :: Layout: Text and Fonts, defect)
Tracking
()
People
(Reporter: ebrahim, Assigned: jfkthame, NeedInfo)
References
Details
Attachments
(1 file, 1 external file)
|
75.91 KB,
image/jpeg
|
Details |
Steps to reproduce
data:text/html;charset=utf8,<span style="letter-spacing:4px; font-family: Arial"><p>0123456789<p>٠١٢٣٤٥٦٧٨٩<p>۰۱۲۳۴۵۶۷۸۹<p>متن 0123456789<p>
Actual results
The first lines gets letter spacing but the second line (Arabic-Indic digits) and the third line (Extended Arabic-Indic digits) doesn't get it. The last line also doesn't get letter spacing because of Arabic letters
Expected results
The digits in all lines to get consistent letter spacing
Actually the situation with all the three browsers are broken, as can be seen in the attachment has got the all lines right but breaks Arabic text which shouldn't per https://www.w3.org/TR/css-text-3/#cursive-tracking Firefox renders the last line right but fails at having letter spacing at the second and third line. Chrome fails when a line has Arabic text even with non-ArabicIndic digits.
Also please consider things come with Arabic-Indic digits, like Arabic thousand separator (۲۰٬۰۰۰) and Arabic decimal point ٣٫١٤, they should be treated the same way as digits for a possible fix.
Chromium respective bug: https://issues.chromium.org/570417348
WebKit respective bug on not supporting letter space exception for some of the scripts at all: https://bugs.webkit.org/show_bug.cgi?id=195745
| Assignee | ||
Comment 2•1 month ago
|
||
What about things like punctuation? If letter-spacing is present, should something like "سلام، صاحب!" be rendered with letter-spacing applied to the punctuation, like "سلام ، صاحب !", even though the words themselves are unaffected?
Currently, our rule is that we suppress letter-spacing for characters where this IsCursiveScript() function returns true. Maybe we should also make this conditional on the character category being Letter, so that other categories (Numeral, Symbol, Punctuation) still get letter-spacing applied.
The same should probably apply to inter-character justification, which we suppress for cursive scripts in the same way. Does this sound reasonable to you?
To answer this question I like to first bring something that might feel a bit unrelated at first specially since there is some progress about text-justify: kashida in Chrome https://chromium-review.googlesource.com/c/chromium/src/+/7957320 which is unrelated to letter-spacing but I wish it some day happen but maybe not in my lifespan if not ever! 😅 Now about this question I think the ideal is not to skip letter spacing in joined words even also but instead turn it to Kashida as can be seen on screenshots on https://www.w3.org/TR/css-text-3/#cursive-tracking even in IE6 days there was text-justify: newspaper that could distribute Kashida in all connectors which was accompanying text-justify: kashida but that was less popular and more complex so retired sooner (at least I don't know how to have that using modern DirectWrite API unlike one point adding Kashida justification which still exists in DirectWrite) but interestingly text-justify: newspaper also could change letter-spacing according to https://web.archive.org/web/20030628024130/http://www.microsoft.com/middleeast/Arabicdev/IE6/KBase.asp#:~:text=Style:%20text%2Djustify%2C%20Value:%20newspaper and if the needed space is lesser than a full Kashida letter the rarely used JSTF table https://github.com/harfbuzz/harfbuzz/pull/6163 can be consulted for smaller Kashida glyphs...
Now back to your question, I think yes it should be applied to punctuations also as it's also applied in Latin script as I think if we look at the bigger picture, letter-spacing should be the same as Latin except when there is a connector which it should become a Kashida. I don't request Kashida one at this point (or ever) and I preferred and requested skipping spacing to Arabic words connector over breaking them (because for a multilingual CSS that sure not what the original designer wanted or the eventual viewer expect) but having all these in mind at least can give a more definitive answer on what should be done here for a smaller change (which I sure understand they all are hard to do things I appreciate what you do at the end).
Just to clarify filing this bug was unrelated to my multiyear (or decade) wish for Kashida, the context here I just wanted to use negative letter-space for a website that was using a poorly designed tnum for its digits and turned browsers are skipping letter-space for Arabic-Indic digits inconsistently with Arabic digits.
| Assignee | ||
Comment 4•1 month ago
|
||
Thanks for the added background. I agree that mapping letter-spacing (and inter-character justification) to kashida for Arabic script would be great, but that is a considerably bigger and more complex problem than the more narrowly-defined issue here. (About justification, we have bug 185600 that has been on file for >20 years ☹️.)
I'll post a patch to make the limited change suggested here, as that seems straightforward and should at least help cases like yours.
| Assignee | ||
Comment 5•1 month ago
|
||
Hmmm.... it seems that according to the current spec text, it would actually be non-conformant to apply letter-spacing to Arabic-script numerals. See https://drafts.csswg.org/css-text-3/#cursive-tracking, which says that we:
must not apply spacing between any pair of that script’s typographic letter units at all
and https://drafts.csswg.org/css-text-3/#typographic-letter-unit includes Number as well as Letter codepoints in the typographic letter unit definition:
A typographic letter unit (or letter for the purpose of this specification) is a typographic character unit belonging to one of the Letter or Number general categories.
I'm not sure what the history of this definition is, but as it stands, it looks like only the punctuation chars in Arabic would get letter-spacing, not numbers. This should probably be raised as a CSS Text spec issue.
| Assignee | ||
Comment 6•1 month ago
|
||
I've opened https://github.com/w3c/csswg-drafts/issues/14570 to see what the CSSWG has to say.
| Assignee | ||
Comment 7•1 month ago
|
||
I'm posting a patch to implement something I think seems reasonable, but we may want to see what people think in the CSSWG issue before actually making a change here.
| Assignee | ||
Comment 8•1 month ago
|
||
Updated•1 month ago
|
| Assignee | ||
Updated•1 month ago
|
Comment 9•27 days ago
|
||
There is an r+ patch which didn't land and no activity in this bug for 1 week.
:jfkthame, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.
Description
•