Bug 70029 (oldturkicrendererror) - Old Turkic characters behave as left-to-right instead of right-to-left, because they are encoded as surrogate pairs.
Summary: Old Turkic characters behave as left-to-right instead of right-to-left, becau...
Status: RESOLVED FIXED
Alias: oldturkicrendererror
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified All
: P2 Normal
Assignee: Darin Adler
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2011-10-13 08:59 PDT by bitigchi
Modified: 2015-05-22 11:48 PDT (History)
14 users (show)

See Also:


Attachments
Safari: Not rendered correctly (29.89 KB, image/png)
2011-10-13 09:04 PDT, bitigchi
no flags Details
Firefox: Rendered correctly (32.51 KB, image/png)
2011-10-13 09:05 PDT, bitigchi
no flags Details
Patch (13.38 KB, patch)
2014-09-21 16:35 PDT, Darin Adler
no flags Details | Formatted Diff | Diff
Patch (15.91 KB, patch)
2014-09-24 08:48 PDT, Darin Adler
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description bitigchi 2011-10-13 08:59:53 PDT
Hello,

In Webkit browsers, including Chrome, Old Turkic text does not render correctly. It should be rendered from Right-to-Left, but we see it as LTR as usual. 

Old Turkic block was introduced with Unicode 5.2, and Gecko based browsers render it correctly. 

Sample texts:

http://fankibiber.wordpress.com

You can download the required fonts from here: http://bitigchi.tumblr.com/downloads

You can see the difference in rendering when tried with Firefox and Safari.

Thank you.
Comment 1 bitigchi 2011-10-13 09:04:29 PDT
Created attachment 110854 [details]
Safari: Not rendered correctly
Comment 2 bitigchi 2011-10-13 09:05:48 PDT
Created attachment 110856 [details]
Firefox: Rendered correctly

Although the font is different here, it is clear that the letters of the Safari screenshot here are right aligned on the first line.
Comment 3 Radar WebKit Bug Importer 2011-10-13 12:22:08 PDT
<rdar://problem/10281541>
Comment 4 mitz 2011-10-16 22:13:29 PDT
InlineIterator operates on UTF-16 code units rather than on characters. Since Old Turkic is encoded using surrogate pairs, InlineIterator::direction() incorrectly returns LeftToRight (for each of the two surrogates) instead of RightToLeft.
Comment 5 bitigchi 2011-10-20 06:16:17 PDT
This is a very annoying bug. Is there any info on when this can be fixed?
Comment 6 bitigchi 2014-08-24 14:20:48 PDT
!Ping!
Comment 7 Darin Adler 2014-09-21 16:35:07 PDT
Created attachment 238440 [details]
Patch
Comment 8 Darin Adler 2014-09-21 16:35:45 PDT
Mitz asked me to look at this bug, so I did. Patch isn’t ready to land because we need some regression tests; we need to write tests that don’t require installing a font.
Comment 9 Darin Adler 2014-09-21 16:36:12 PDT
Also need to measure performance to see if I slowed things down.
Comment 10 Darin Adler 2014-09-21 16:37:11 PDT
Comment on attachment 238440 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=238440&action=review

> Source/WebCore/rendering/InlineIterator.h:436
> +        if (LIKELY(U16_IS_SINGLE(codeUnit)))
> +            return u_charDirection(codeUnit);

If this code path is really hot, then we should have a faster patch so we don't have to call into u_charDirection for common characters.
Comment 11 bitigchi 2014-09-24 01:45:44 PDT
(In reply to comment #8)
> Mitz asked me to look at this bug, so I did. Patch isn’t ready to land because we need some regression tests; we need to write tests that don’t require installing a font.

Great news anyway! Thank you very much!
Comment 12 Darin Adler 2014-09-24 08:48:41 PDT
Created attachment 238599 [details]
Patch
Comment 13 Darin Adler 2014-09-24 19:54:02 PDT
Committed r173943: <http://trac.webkit.org/changeset/173943>
Comment 14 bitigchi 2015-05-22 11:48:37 PDT
Just for info, has this landed on a Safari release yet? I don't have an OS X machine at the moment, just wanted to check. 

Thanks in advance.