One problem is that new text entered in RTL order appears LTR (in disconnected Arabic letters) in the preview area.
Another issue is that the text only appears in the preview area when the text box is moved to the right, bringing the Arabic text (which is outside and to the left of the text box) into view. Changing “Horizontal fit” does not affect this.
I may have a fix for this, but unfortunately I cannot find a way to test it. Perhaps you would like to try it and let me know if it works. You need to edit a file. On the Windows operating system it is:
If that doesn’t fix the problem try adding the following line after “LayoutMirroring” line:
Please post to let us know if this fixes the problem or not. If it doesn’t then just revert to the original file (delete the line or copy the backup file). If it does work I’m sure Dan (@shotcut) will include the fix in the next version.
My system is Windows 10.
I tried using Notepad, but like in XML Editor the addition was not saved. Then I tried Notepad++ and the addition was saved…but it didn’t fix the problem. I added the second line after the first, and that didn’t work either.
I’m glad that at least the Arabic font is recognized, but the string is being assembled LTR.
Any other ideas?
Thanks for your help!
Here I was trying to use LayoutMirroring, but I could not get it to work for that. In any case, that is about the Qt Quick API for the GUI, which is reported as working fine here, but we are not using that to render the text. We are using QPainterPath::addText() for Text: Simple, and it is not yet clear to me how to affect text direction. I suspect it is supposed to follow locale. https://doc.qt.io/qt-5/qpainterpath.html#addText
@Brian I was able to work on this on Linux by adding the ar_AE.UTF-8 locale and running with some environment variables set to use it like LANG and LC_ALL.
I wonder if Mlt::Controller::resetLocale() is the culprit. On Linux, this is using LC_NUMERIC only whereas macOS and Windows using LC_ALL. As I recall, when Qt initializes, it snapshots the system locale. After, when MLT initializes, it sets the process locale to the system locale. Next, we reset the process locale to prevent MLT from reading and writing numeric values in XML with locale-dependent decimal separators (resetLocale()). The reason we use LC_ALL is because that is what mlt_factory_init() is using, and these locale environment variables are not normally used on Windows. Thus, I had to add Windows-specific code in mlt_factory_init() to read the environment variable to operate in a consistent manner. So, I suspect the ::setlocale(MLT_LC_CATEGORY, "C"); in resetLocale() is affecting this. I will look into this.
“The filter ‘Overlay HTML’ allows you to load an HTML file as a ‘text’ filter over a video. If you know how to create an HTML file and load your font in that, then it should be compatible with Shotcut using Overlay HTML.”
Please advise on how you installed Arabic font. (Again, even though an Arabic-based font is already installed on my PC, I still have the LTR problem.)
There are fonts, and then there are fonts.
In my limited experience with Hebrew fonts, I found that some were merely an artistic expression, substituting one glyph for another. Many of these font creators seem unaware that the font languages such as TrueType have a script capability in addition to the storing of images, and that these scripts can be used to encode even complex interactions between characters.
It may be that your “Arabic-based font” does not have the hidden scripts which tell it not only to assemble the characters right-to-left, but also encode the subtle interactions between adjacent characters.
What version of Shotcut are you using? You mention the Overlay HTML filter, but this was removed from Shotcut last year, it no longer exists and the version that @shotcut was using that works is 21.05.01. If you are using an old version, that could be your problem.