If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Arabic text is displayed incorrectly on Lenovo Vibe P1

RESOLVED FIXED in Firefox 53

Status

()

Firefox for Android
Locale switching and selection
RESOLVED FIXED
7 months ago
7 months ago

People

(Reporter: Adham Magdy, Assigned: jfkthame)

Tracking

51 Branch
Firefox 54
ARM
Android
Points:
---

Firefox Tracking Flags

(firefox53 fixed, firefox54 fixed)

Details

Attachments

(2 attachments)

(Reporter)

Description

7 months ago
Created attachment 8840310 [details]
A screenshot from www.wikipedia.com with most Arabic text displayed incorrectly.. Only the words "اللغة العربية" display correctly

User Agent: Mozilla/5.0 (Android 6.0.1; Mobile; rv:51.0) Gecko/51.0 Firefox/51.0
Build ID: 20170208135532

Steps to reproduce:

Install Firefox for Android latest version in Google play on Lenovo Vibe P1 with stock Android 6.0.1
Visit any website with Arabic text


Actual results:

Arabic text displays incorrectly and all characters are detached with default font
Although the gui of firefox has no problem with Arabic text.. And no other apps or browsers in the system have this issue


Expected results:

Arabic text displays correctly out of the box
(Reporter)

Updated

7 months ago
Severity: normal → critical
Keywords: fonts, mobile, rtl
OS: Unspecified → Android
Priority: -- → P1
Hardware: Unspecified → ARM
These sorts of issues tend to occur because of the specific fonts installed on the phone. You would need to download the Android platform tools for your operating system and share a copy of the installed fonts on the device. 

* adb can be found at https://developer.android.com/studio/releases/platform-tools.html
* Enable USB debugging in the developer settings. See https://developer.android.com/studio/run/device.html on how to enable developer settings.
* attach your phone to your computer with a USB cable
* open a command prompt and change the directory to where the android platform tools were extracted
* adb devices
* unlock your phone and accept the connection message
* the command prompt should return something like 
** List of devices attached 
** 0123456789abcdef      device

* once the phone is found please run the next set of commands to copy the phone's fonts to your computer
* mkdir fonts-from-android
* cd fonts-from-android
* adb pull /system/fonts/

You may be able to zip up the folder and attach it to this bug. The zipped file may be too big to attach. If it is then you would need to use a sharing service such as dropbox or mega.nz.
Severity: critical → normal
Keywords: fonts, mobile, rtl
Priority: P1 → --
Flags: needinfo?(Adhammagdy)
(Reporter)

Comment 2

7 months ago
Update 1-3-2017:

Linked a ZIP file containing the fonts on my Vibe P1

http://bit.ly/2lnzkrI
(Reporter)

Updated

7 months ago
Flags: needinfo?(Adhammagdy)
Johnathan do you have time to look at this font issue?
Flags: needinfo?(jfkthame)
(Reporter)

Comment 4

7 months ago
+1 Please anyone help me.. I've always used Firefox on my older phones and it's the best.. but with the new one it's become impossible to use because of this issue 
(Assignee)

Comment 5

7 months ago
The problem is caused by the ZawgyiOne.ttf font that is installed on that device. It contains Arabic characters -- and therefore is a candidate to be chosen during font fallback, when there is Arabic text that is not explicitly styled with some other available font -- but its OpenType layout tables (GSUB, GPOS) are largely garbage.

(My guess is that the device vendor decided to "subset" the font, removing glyphs they thought weren't useful/necessary, but did so without updating the tables, and so now the OpenType tables refer to totally incorrect glyph IDs, and most of the substitutions that would be needed for proper Arabic shaping simply don't happen.)

So this is the result of a Lenovo bug, and the problem should be reported to them. They should either fix the ZawgyiOne font so that its OpenType tables are correct, or (better) remove the Arabic characters from it completely.

Arabic text will work OK when a different font -- such as Noto Naskh Arabic -- is used, which is how *some* Arabic looks correct; but when no specific font is chosen via CSS styling, fallback comes into effect and if it happens to pick ZawgyiOne, it'll be broken.

To work around the problem, I think it may help if you specify Noto Naskh Arabic in the Firefox font options, so that it is chosen in preference to a "random" fallback:

    Go to about:config
    Tap the big "+" to create a new setting
    Enter the name "font.name.sans-serif.ar" (without the quotes around it)
    Tap the word "boolean" on the right (I'm assuming the English interface) and change the type to "string"
    Enter the value "Noto Naskh Arabic"

Repeat to create "font.name.serif.ar" and "font.name.monospace.ar" as well, setting each of them to the string "Noto Naskh Arabic". (The device doesn't have different Arabic fonts for each of these styles, so we'll make them all the same.)

This should fix the display of Arabic text in most cases, I believe. (Please confirm whether this works for you.)

And we should add those prefs to the defaults we ship on Android, as I suspect most modern devices include the Noto fonts. I'll post a patch for that, so that in a future release we'll avoid this problem.
Flags: needinfo?(jfkthame)
(Assignee)

Comment 6

7 months ago
Created attachment 8842786 [details] [diff] [review]
Add default font prefs for Arabic on Android, to try and avoid fallback finding broken fonts

This should help in general, assuming most devices ship Noto fonts, and shouldn't hurt in cases that don't (as we currently just don't ship any Arabic font prefs, and end up taking whatever default fallback gives us - usually there's only one on the device anyway).
Attachment #8842786 - Flags: review?(m_kato)

Comment 7

7 months ago
Comment on attachment 8842786 [details] [diff] [review]
Add default font prefs for Arabic on Android, to try and avoid fallback finding broken fonts

Review of attachment 8842786 [details] [diff] [review]:
-----------------------------------------------------------------

Since this setting was failure on Android 2.3's reftest, I backed out it.  But since our support is API 15+, it will work better.
Attachment #8842786 - Flags: review?(m_kato) → review+
(Assignee)

Comment 8

7 months ago
I've pushed a try job to double-check whether this breaks any tests: https://treeherder.mozilla.org/#/jobs?repo=try&revision=610f8d30e1203d0e7f83242898f423a6752df6cc; will land after those results are in.
(Assignee)

Comment 9

7 months ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/f89a27e84f5e2daa606d23d0721977afb4e0cb77
Bug 1341986 - Add default font prefs for Arabic on Android, to try and avoid fallback finding broken fonts. r=m_kato
(Reporter)

Comment 10

7 months ago
(In reply to Jonathan Kew (:jfkthame) from comment #5)


This workaround actually worked..
Thanks a million.
(Assignee)

Comment 11

7 months ago
Comment on attachment 8842786 [details] [diff] [review]
Add default font prefs for Arabic on Android, to try and avoid fallback finding broken fonts

Approval Request Comment
[Feature/Bug causing the regression]: buggy font shipped on Lenovo device

[User impact if declined]: unreadable Arabic text

[Is this code covered by automated tests?]: it's exercised by existing test cases that involve Arabic text, but no actual change is visible except on specific devices (depending on installed fonts)

[Has the fix been verified in Nightly?]: verified by affected user manually setting prefs on his device

[Needs manual test from QE? If yes, steps to reproduce]: no

[List of other uplifts needed for the feature/fix]: none

[Is the change risky?]: no

[Why is the change risky/not risky?]: just adds font prefs for a language where we're currently not specifying them

[String changes made/needed]: none
Attachment #8842786 - Flags: approval-mozilla-aurora?

Comment 12

7 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/f89a27e84f5e
Status: UNCONFIRMED → RESOLVED
Last Resolved: 7 months ago
status-firefox54: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 54
status-firefox53: --- → affected
Comment on attachment 8842786 [details] [diff] [review]
Add default font prefs for Arabic on Android, to try and avoid fallback finding broken fonts

Minor pref fix for Arabic font, let's uplift to 53 aurora.
Attachment #8842786 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Assignee: nobody → jfkthame

Comment 14

7 months ago
bugherderuplift
https://hg.mozilla.org/releases/mozilla-aurora/rev/5fd05d2d9809
status-firefox53: affected → fixed

Updated

7 months ago
Duplicate of this bug: 1119627
You need to log in before you can comment on or make changes to this bug.