New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 813414 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

Automatic hyphenation doesn’t work on Android

Reported by jim...@chapalpanoz.com, Feb 18 2018

Issue description

Chrome Version       : Chrome 64.0.3282.137
OS Version: Android 6.0.1
Other browsers tested:
    Firefox Android: FAIL
    Edge Android: FAIL
    Samsung Internet Browser: FAIL

What steps will reproduce the problem?
1. add "hyphens: auto" to any web page
2. hyphenation won’t happen in Chrome on Android
3. hyphenation won’t happen in the Android Webview

What is the expected result?

Automatic hyphenation is enabled and works as Chrome MacOS.

What happens instead of that?

According to  issue #605840  (https://bugs.chromium.org/p/chromium/issues/detail?id=605840), automatic hyphenation should be enabled on Android. However, we first witnessed it wasn’t the case in the Android Webview. 

After checking apps we know are using the Webview and automatic hyphenation, on various devices – including Nexus ones –, we could confirm something was wrong since automatic hyphenation just would not happen in those apps.

We consequently checked Chrome and got the same results: no automatic hyphenation.

We even checked the link which was tested when automatic hyphenation shipped (https://media.kulturbanause.de/2012/02/silbentrennung.html), and automatic hyphenation failed (see attached file), as any test we’ve made so far.
 
36344110-bb18c846-1415-11e8-9944-2c50345fe5ad.png
210 KB View Download

Comment 1 by ajha@chromium.org, Feb 20 2018

Labels: -OS-Mac OS-Android
Cc: kojii@chromium.org pnangunoori@chromium.org
Components: Blink>Layout
Labels: Needs-triage-Mobile Triaged-Mobile Needs-Feedback
jiminy@ -- Thanks for reporting this issue. Could you also please share the expected screenshot. It would be helpful for us to reproduce and triage accordingly.

kojii@ -- Could you please take a look into this issue, as you were the owner of the  Issue 605840 .

Thanks in advance!

Comment 3 by kojii@chromium.org, Feb 20 2018

Could you please try on Android 7.x devices?

As in the "intent to Ship":
https://groups.google.com/a/chromium.org/d/msg/blink-dev/LsnvY7FFrY0/iVl1FcAFAgAJ

Chrome and WebView relies on hyphenation dictionaries on Android. M MR1 (6.0.1) has only 7 dictionaries while N (7.0) has 23. I don't have 6.0.1 to verify, but if I remember correctly, M MR1 did not have dictionaries for DE.

If you have access to its file system, you can browse /system/usr/hyphen-data/ to list all available hyphenation dictionaries.
So we tried with a Nexus phone using Android 8.1.0 and got the same result.

Sorry if unclear in the original report but we can’t even get it to work with English – I checked to make sure the devices had an hyphen dict for at least English. 

We tried different things, from declaring lang="en" to lang="en-US", from moving the CSS hyphens declaration from the root (html) selector to body, switching portrait to landscape, etc., and then we checked Chrome Mac and everything was working as expected in the desktop version.

Adding screenshots of the expected results for both German (de) and English (en).
android-8.1.0.png
220 KB View Download
bug-chrome.png
257 KB View Download
expected-de.png
81.7 KB View Download
expected-en.png
66.2 KB View Download
Project Member

Comment 5 by sheriffbot@chromium.org, Feb 20 2018

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 6 by kojii@chromium.org, Feb 20 2018

Do you have links to your English test pages?

Attaching a screenshot of:
https://drafts.csswg.org/css-text-3/
on Nexus 6P, running Anrdoid 8.1. I hope you can find "docu-ment" is hyphenated.

For DE, Android 8.1 has dictionaries for:
 - de-1901
 - de-1996
 - de-ch-1901
https://android.googlesource.com/platform/external/hyphenation-patterns/+/master/de/

and have two aliases for DE:
  {"de", "de-1996"},
  {"de-LI-1901", "de-CH-1901"},
https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/text/Hyphenator.java
drafts.csswg.org-css-text-3-android-8-1.png
452 KB View Download

Comment 7 by kojii@chromium.org, Feb 20 2018

Status: Available (was: Unconfirmed)
Confirmed your German page:
https://media.kulturbanause.de/2012/02/silbentrennung.html
doesn't hyphenate, even with lang="de".
Just tried https://drafts.csswg.org/css-text-3/ and didn’t get the same result, but it’s quite hard to tell whether 3 letters can fit at the end of the line as they do in your screenshot, using two different devices (6.0.1 and 8.1). So I checked the entire spec, but found none in both portrait and landscape orientation, and even tried the desktop version. 

You can find the english text there: https://readium.github.io/r2-glue-js/examples/base/ 

Hyphens are declared for body, as in the css-text-3 spec. I can do a simpler sample if needed, in order to eliminate factors the below link may introduce. 

I first we thought it could be about multi-columns being used, but it is working as expected in Chrome Mac, as you can see in the attached screenshot. 


36343482-2c2ad62c-140d-11e8-984a-43036b0ee289.png
311 KB View Download

Comment 9 by kojii@chromium.org, Feb 21 2018

Cc: nona@chromium.org
Sounds like a lot of different issues are mixed and it's not easy, though I understand, Android hyphenation engine hyphenates, less or none, in specific cases. The hard parts are, "less or none" is hard to determine, and "in what specific case" is also hard.

> Just tried https://drafts.csswg.org/css-text-3/ and didn’t get the same result ... I checked the entire spec, but found none in both portrait and landscape orientation, and even tried the desktop version.

The "desktop version" do you mean you didn't get any hyphenation on Mac? If so, that's weird. I can't tell why you're seeing different from my Mac.

I built a unit test to check lang="de-1996" engine gives the proper hyphenation points for "konsonantien" and "Bächlein" (thank you for your samples), and it looks like the hyphenation engine is fine ("8, 5, 3" for "konsonantien", "4" for "Bächlein") when ran on Android 8.1 and on Mac 10.13.3.

Above the hyphenation engine, I believe our code is the same for Mac and Android, I'm thinking if we can test that somehow.

Note that my feeling has been, it looks like Android hyphenation engine hyphenates less than the Mac hyphenation engine does, and I personally like it. When reading the csswg.org, too much hyphenations often troubles me to read. But if "none is hyphenated", or "far too less from the common sense", that's a problem, and your samples indicates the possibility. At this point, it's hard to draw the line for me.

Comment 10 by kojii@chromium.org, Feb 21 2018

Labels: -Pri-3 Pri-2
Status: Assigned (was: Available)
I think I found a possible cause of "far too less" on Android. I can't reproduce the issue on Mac though, if you can't get it on your Mac, it'd be more helpful if you can file another issue.
Sorry, to clarify, tried forcing the “desktop version” in Chrome Android to check whether it could somehow make a difference. I can confirm it’s working totally fine in Chrome Mac. 

And BTW, thanks for your concern and reactivity, it is greatly appreciate. 

Comment 12 by kojii@chromium.org, Feb 21 2018

#11: Oh, thank you for the clarification.

And thank you from me for reporting this to us and explaining in this much details, it helped so much to investigate where the problem lies. One fix is going on its way, I hope this fixes the problem.

https://chromium-review.googlesource.com/c/chromium/src/+/927931

Comment 13 by kojii@chromium.org, Feb 21 2018

Cc: -kojii@chromium.org
Owner: kojii@chromium.org
Project Member

Comment 14 by bugdroid1@chromium.org, Feb 21 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/7921afe5aaa58509b9ed9f38e35e7e19efc29181

commit 7921afe5aaa58509b9ed9f38e35e7e19efc29181
Author: Koji Ishii <kojii@chromium.org>
Date: Wed Feb 21 13:57:06 2018

Add tests for the hyphenation engine itself

We had tests to test the logic in Blink, but did not test the
hyphenation engines itself.

This patch adds tests to check some real words from samples
in  crbug.com/813414 :
  en-us:
    "hyphenation"
  de-1996:
    "konsonantien"
    "Bächlein"

Bug:  813414 
Change-Id: I646cb74a31282771709a3272716b4d9b7ee82589
Reviewed-on: https://chromium-review.googlesource.com/927421
Reviewed-by: Dominik Röttsches <drott@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#538089}
[modify] https://crrev.com/7921afe5aaa58509b9ed9f38e35e7e19efc29181/third_party/WebKit/Source/platform/text/HyphenationTest.cpp

Project Member

Comment 15 by bugdroid1@chromium.org, Feb 21 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/33a8e5aeb9d2119a77363bcd2e025ae0efe6665e

commit 33a8e5aeb9d2119a77363bcd2e025ae0efe6665e
Author: Koji Ishii <kojii@chromium.org>
Date: Wed Feb 21 16:18:20 2018

Fix Android hyphenation when input text has leading spaces

When the input text to the Hyphenation class has leading spaces,
OS X Core Foundation implementation (HyphenationCF) handles
such inputs, while Android implementation (HyphenationMinikin)
consider there is no hyphenation points in such a word.

This patch fixes the Android implementation to handle leading
spaces in a word given from the line breaker.

Bug:  813414 
Change-Id: I4fc103809c5f1b1083300b261a675348ceccf2f0
Reviewed-on: https://chromium-review.googlesource.com/927931
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: Dominik Röttsches <drott@chromium.org>
Cr-Commit-Position: refs/heads/master@{#538124}
[modify] https://crrev.com/33a8e5aeb9d2119a77363bcd2e025ae0efe6665e/third_party/WebKit/Source/platform/text/HyphenationTest.cpp
[modify] https://crrev.com/33a8e5aeb9d2119a77363bcd2e025ae0efe6665e/third_party/WebKit/Source/platform/text/hyphenation/HyphenationMinikin.cpp

Comment 16 by nona@google.com, Feb 22 2018

Just FYI, not only leading spaces, Android also skips some punctuations before applying hyphenator.

https://android.googlesource.com/platform/frameworks/minikin/+/master/libs/minikin/WordBreaker.cpp#221

Comment 17 by kojii@chromium.org, Feb 22 2018

#16: Thank you nona for the input, I'll take care of it in separate CL. I also found it has much better i18n hyphenation support now, I'd put it in my queue.

Comment 18 by kojii@chromium.org, Feb 23 2018

Status: Fixed (was: Assigned)
Now the fix is in Canary, I'm seeing a bit mixed results.

* I see more hyphenated lines in English pages:
  https://readium.github.io/r2-glue-js/examples/base/
  https://drafts.csswg.org/css-text-3/
* I see hyphenated lines in German pages with lang="de":
  https://codepen.io/kojiishi/pen/ddmgbL
* but not in German pages with lang="de-DE":
  https://media.kulturbanause.de/2012/02/silbentrennung.html

Filed the last issue as issue 815059. I hope other cases are we hyphenated well-enough, but if you feel Android is still not doing good enough, please let us know.

Thank you again for reporting this issue to us.

Comment 19 by kojii@chromium.org, Feb 23 2018

And the comment #16 is copied to issue 815061.
Sorry for the long delay. 

We could confirm the problem is fixed in Oreo (8.1) using Chrome Canary. We couldn’t for Marshmallow (6.0.1) though, but it could simply be that it could not find any opportunity to hyphenate, we can’t tell for sure.

Thanks again for your responsiveness and commitment to fix this issue :)
Screenshot_20180416-164030.png
491 KB View Download
Screenshot_20180416-164037.png
280 KB View Download

Sign in to add a comment