RTL for Arabic font

This question was asked in May '20, but the fix offered in that post (to install Elusien’s WebVfx Framework) seems no longer to be an option. The new (May '20) javascript file referred to there is not found at http://www.elusien.co.uk/shotcut/webvfx/index.php, only an older version.

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.

Not sure if this screenshot is visible:

Thank you for any help you can give!

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:

C:\Program Files\Shotcut\share\shotcut\qml\modules\Shotcut\Controls\VuiBase.qml

First make a backup copy of this file, just in case.

Then add the following line as the 7th line:

  LayoutMirroring.enabled: true

so the beginning of the file is then:

import QtQuick 2.0

DropArea {
    Canvas {
        id: grid
        anchors.fill : parent
		LayoutMirroring.enabled: true
        opacity: 0.5

If that doesn’t fix the problem try adding the following line after “LayoutMirroring” line:

       LayoutMirroring.childrenInherit: true

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.

I used XML Copy Editor to open the file. Should I be using a different type of program?

Even after trying to save the two suggested lines (consecutively), there was no change in the .qml file itself, i.e. the lines were missing when I reopened the file.


Any text editor will do. I’m not au fait with XML Copy Editor, for Windows I would just use Notepad, or Notepad++. If you are Linux you could just use VIM, or EMACS or Notepadqq.

Don’t forget to make a copy first.

To save the edits you probably have to have Administrator/root permission.

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!

Ok, thanks for getting back to me. I’ll have another poke around and see if I can come up with something.

Can anyone give instructions on how I can reproduce this? Do I need special windows settings or a special keyboard? How do I make those letters?

Somewhat related:

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.

@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.

I tried to reproduce this on Windows 10 where I had another RTL language installed already - Hebrew - but I did not reproduce this.

And here after I installed Arabic, it seems to be working fine

I tried switching the system language to Arabic, but that didn’t change the content of my text box to RTL.

I note that in your screenshot the letters are ordered correctly, although there is not enough text to see whether they also connect correctly (some letters don’t take a following attached letter).

How would I reproduce this?

BTW, the language I’m working with is not Arabic but uses an Arabic-based script with some additional letters.


It looks like you solved the problem by installing Arabic font.

In one post (Can I Add External Fonts In Shotcut) I read that Shotcut uses the fonts already installed on the PC (I have an Arabic-based font installed).

In another post (How to include new fonts?) it says that an html file should be set up using a text editor:

“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.

It doesn’t work with even the MS Windows Arabic-based font (for Pashto language). The letters display correctly in the Filters area but are disconnected (and LTR) during playback.

1 Like

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.

1 Like

My version is updated: 21.05.01.

Anyone have any other suggestions?

I tried it out and sadly, it didn’t work. I added the two lines, no luck.

While the Arabic letters are showing yet it is not in the correct order or attached. Can you please help?

I’m also hoping someone will have a solution. My only idea is to create an image file (.jpg) in PowerPoint and import that into Shotcut.