I know of the following problems with RTL subtitles (I've tested this with Hebrew on Windows & Linux):
- When a single subtitle spans multiple lines, the line order is reversed. E.g. when there are two lines, the second line is shown at the top, and the first line at the bottom.
- Some punctuation characters are displayed at the begining of the line (right hand side - it's RTL) instead of the end of the line (left hand side). For example, "well," is shown line this: ",well'.
- When a hyphen is used between a number and a Hebrew word (common in Hebrew syntax, not so common in Hebrew subtitles), the ordering of the number, hyphen and Hebrew word is not as expected.
- The line reordering problem seems to be a fribidi problem, but this might indeed be the official Unicode handling for multiline text. I changed the code in freetype.c to reorder each line, and not the whole subtitle text. This solved the line ordering problem.
- The punctuation ordering problem is solved by calling fribidi with LTR as the main direction. This is a work-around. Since most players (under Windows) don't perform bidi, but let the system do it, the subtitles are prepared in logical order (RTL), but with main order (LTR), since players don't support setting the main order of the subtitles. This makes authoring subtitles a little harder, but everyone's already doing it.
- The hyphen problem happens because Microsoft's bidi algorithm is not fully compatible with the Unicode bidi algorithm. Since most Hebrew subtitles are generated and viewed on Windows, the hyphen is authored so it would display properly using Microsoft's bidi algorithm. Fribidi is Unicode compatible, which means it orders the hyphen differently. I didn't fix this problem in freetype.c, but have solved this in the past (In a Java utility i once wrote).
My question is: What do I do to suggest my fix to the developer team of VLC? Also, I made the change on Linux (where it's much easier to setup a development environment for VLC), but I'd really like a Windows VLC version with this feature, and I don't know how to build a Windows version.
In the long run, full support for bidi in VLC would include adding two options in the subtitles preferences:
- Use RTL paragraph order for RTL subtitles - this would be set to false until more players really support RTL languages. BTW, I checked with a friend who speaks Arabic, and it seems that Arabic subtitles also assume LTR order.
- Fix Microsoft bidi problems - this would be set to true by default to handle hyphens properly.
One final thing - I have the "fixed" freebidi.c source, and would have published it here, but it doesn't look like I can add attachments to messages in this forum.
Barak