jellyfin / jellyfin-roku

The Official Roku Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
449 stars 137 forks source link

Add support for Arabic subtitles #1387

Open sheyaln opened 1 year ago

sheyaln commented 1 year ago

Software Versions

Describe the bug

Arabic-language srt subtitles do not display properly on Roku, and instead appear as rectangles. It doesn't work regardless of whether I used subtitles with or without Pop directional formatting characters.

How To Reproduce

  1. Stream media with Arabic srt file on phone client and web to confirm that the subtitles are properly displayed in Arabic.
  2. Stream same media with Arabic srt file on Roku client.
  3. Try to read the rectangles on the screen.

Expected behavior

Proper subtitles are displayed. I wish I knew enough to provide more specific details.

Logs

Please let me know if there are any specific logs that would be helpful here.

Screenshots

PXL_20230921_192244901

Connection Information

cewert commented 1 year ago

Limited support was recently added for a custom CJK font to be used for subtitles. Could you try following the same instructions and see if you can get the arabic fonts working too? Not sure the best place to find fonts. Is this google font the right one?

  1. Download CJK font and put in a folder accessible to server
  2. Enable fallback fonts on server and point to folder with CJK font
  3. Enable custom subtitles in Jellyfin Roku user settings
  4. Play video and select CJK subtitle track

Edit: This is a known bug https://github.com/jellyfin/jellyfin-roku/issues/285 so I'm going to change this from a bug to a feature request.

sheyaln commented 1 year ago

@cewert First of all, thank you for the quick response!

You mentioned CJK fonts, not sure why. Arabic doesn't really fit the CJK category. I think Arabic might pose some different challenges.

But I did download the Arabic Noto Sans font and followed your instructions and I do see Arabic letters pop up! However, even though the individual Arabic letters are appearing on-screen, they're being displayed in reversed order, and disconnected.

Arabic (And languages that use the Arabic script like Farsi/Persian, Urdu, etc) are right to left languages, and are languages where the letters are supposed to conjoin. I added screenshots below to show the difference.

Web:

Screenshot 2023-09-21 at 8 47 35 PM

Compact, conjoined, 𝓯𝓪𝓷𝓬𝔂.

Roku: PXL_20230922_000444274 Separated, cringe, and still contain rectangles =(

Lastly, I'm not sure if this is helpful, but I saw some discourse in the bug report you linked about the size of fonts and the limitation of . The most commonly used font for Arabic (far as I know) is Arial, coming in at 1MB, and the lightest font I could find is Omid Light sitting at a pretty 102kb.

cewert commented 1 year ago

You mentioned CJK fonts, not sure why. Arabic doesn't really fit the CJK category. I think Arabic might pose some different challenges.

Because I'm pretty ignorant when it comes to langues besides English 😆. I was hoping it would work the same way or at least be close enough to give someone a head start. Based on your feedback I think that might be true still?

The codebase assumes the font you are using is CJK but I assume there is a way we can programmatically tell which falback font was given to us by the server. Then it would just be a matter of copy and pasting the custom CJK subtitle parts and modifying them to work for the arabic fonts. Then calling the correct functions after we parse the fallback font from the server.

I don't see me working on this issue but if you or someone else would like to give it a try I'll help where I can. Thank you for making a ticket and trying the custom fonts.

1hitsong commented 1 year ago

Just a few notes for future devs.

Roku does not natively support RTF fonts. So you will need to somehow identify the fallback font is RTF, create a function to reverse the subtitle text prior to display, and adjust the label styles as needed to make it look correctly.