DirectWriteTypeface issue on Windows 10 for Devanagari script

Hi,

I am facing a problem on Windows 10, JUCE 6.0.8. A Unicode text is not displayed correctly in the JUCE app, while it displays fine on Notepad or on Mac OS X (TextEdit or JUCE app).

I am using a translation UTF8 file, with a line like this:

“Utpatti” = “उत्पत्ति”

It is displayed correctly on this web page, as well as on Notepad on Windows. However, in the JUCE app, it shows as:

Screenshot 2021-05-11 at 17.39.27

I am using the Poppins font that includes all Devanagari codes. That same font works perfectly on Mac OS X in JUCE.

I understand it’s not easy for you guys to debug something in a script you don’t understand, but any hint will be very much appreciated.

Thanks.

Mariano

After investigating this further, it seems this is due to JUCE using DirectWrite “limited” functions instead of the more developed, Complex Text compatible Uniscribe ones. Probably for performance reasons. Would be cool to have a Uniscribe implementation though, which could possibly be toggable per project, or even better, for specific Typefaces.

Whatever it is, I was able to fix the most important issue, that is the Devanagari short “i” (Unicode Decimal Code ि) being placed at the end of the syllable, by changing GlyphArrangement::addCurtailedLineOfText(). When this character is found in the line, I change the offsets of the characters involved so that the “i” is moved at the beginning of the syllable (can be more than one character).

It’s a dirty hack of which I’m not proud so will eagerly wait in case something nice and clean is developed for Complex Text on Windows. Fortunately, the web browser component displays Hindi perfectly, and that’s where I have most of my text.

As you noticed, Win32’s DirectWrite and JUCE’s integration doesn’t support non-Latin scripts all that well… From my experience, applying FreeType + Harfbuzz to all platforms is the best method for supporting Complex Text.

This is actually an old discussion, too! For context: Complex Text Support

Thanks, I saw that conversation too, but was under the impression nothing was finalised

Yep, that’s an accurate impression.