Reverse a font's direction with Graphite

Dear SIL community,

I’m not sure which category to put this request under as it touches several fields:

We are in the process of creating a dictionary with the DAB. Sadly the language/script we are working with has only very recenty been approved by the Unicode consortium and therefore only recently found it’s way into the Android eco system (Android 10 and above). The app though needs to work with lower Android versions as well, though.

The script is Rohingya Hanifi (U10D00 to U10D3F). It is Right-to-Left.
The problem I’m having now that it actually shows up in LTR (reversed) direction on older Android versions.

To compensate I tried using Crosswalk but since there’s no Graphite font for Hanifi Rohingya it’s not helping.

So my short question: How can I add Graphite support to our font (attached) so it always shows in RTL direction (using DAB/Crosswalk on Android)?
Rohingya Solluk.zip (337.9 KB)

Assuming that all the text is this one script, or at least the RTL text is in one stye, there are some CSS options that you can set in Styles.

If everything is just the RTL script then in Styles double click the body style. Click on the CSS tab and add in this line before the }:

direction: rtl;

If there are mixed scripts then you would need to add the direction to all paragraphs that have the rtl script.

As you can see from the screenhots sadly the solution to this problem is not that easy:

  1. Screenshot (RTL but no extra css tags, NO Crosswalk):

As you can see Android 10 and 11 show everything correctly, while Android 6 has the letter for the RTL Hanifi in reverse order. Despite all 3 versions showing the RTL Arabic correctly.

RTL-1

  1. Screenshot (RTL plus RTL CSS tags for all Hanifi fields, NO Crosswalk):

Adding specific direction: rtl; tags to all fields containing Rohingya script doesn’t change the situation. Android 10 and 11 still show everything correctly, while Android 6 still has the letter for the RTL Hanifi in reverse order despite the tags. All 3 versions showing the RTL Arabic correctly.

  1. Screenshot:

Activating (RTL plus RTL CSS tags for all Hanifi fields, WITH Crosswalk):

Activating Crosswalk actually makes things worse. Now RTL Hanifi script shows in the wrong (reverse) order on all versions of Android. RTL Arabic is still correct though.

So it’s definitely not a general RTL problem as Arabic is displayed nicely.
I guess the problems with the Hanifi script go up to Android version 9 as official native support for the Rohingya Hanifi Unicode Plane (10D00-10D3F) was only added in Android Version 10 or later which supports Unicode 11.0 and higher.

Since most users of this dictionary are Rohingya refugees with limited financial capabilities ist would be great to find a solution that still would make this work on older versions.

Update: Also tried to set everything to RTL by adding direction: rtl; to the body tag. This didn’t change anything.

1 Like

Information about Graphite is at https://graphite.sil.org. To get started with adding Graphite read the GDL tutorial on that page. You would need to write, at a minimum, Graphite rules to display final or medial forms of the letters, depending on the context. While the letters are written RTL, the digits are written LTR (as in Arabic script).

For Arabic script, Android has a text shaper (Harfbuzz) that selects which form of a letter is displayed (isolated, initial, medial, or final) and a bidi algorithm to handle the mixed RTL and LTR layout issues. Graphite can handle the text shaping issues, but older version of Android are not going to know about Hanifi Rohingya characters to apply bidi correctly. Maybe the bidi issues can be handled with manually specifying the text direction with CSS.

So it would be a interesting test to see if adding Graphite resolves the issues. I suggest adding a few Graphite rules to the font, and testing in Android to see if the RTL and shaping issues are resolved. RTL issues might also be able to be addressed with using characters such as U+200F RIGHT-TO-LEFT MARK and U+202E RIGHT-TO-LEFT OVERRIDE.