home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 2
Feature Requests
Adding support for Right-to-left languages (Hebrew, Arabic...)
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="velis" data-source="post: 1106357" data-attributes="member: 96429"><p>I found this <a href="http://rishida.net/docs/unicode-tutorial/part3" target="_blank">discouraging page</a> explaining the basics of character fusion. This needs lots of work still <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite7" alt=":p" title="Stick Out Tongue :p" loading="lazy" data-shortname=":p" /></p><p></p><p>I'm attaching the sample program. It's written in python 3.3 and seems to render text correctly. I say "seems" because the farsi characters seem to render differently depending on order of rendering (even though each is rendered separately). I believe this is tkinter-specific and should not show in MePo renderer.</p><p></p><p>I tried to comment the code a lot and also didn't use any of the nice Python stuff to make the code more understandable to a C# programmer. I hope it will do, especially because this implementation is really short (some 50 lines of code). It will however fail immediately when somebody makes a translation containing fused characters (well, this is actually also possible with western scripts and it fails with them as well).</p><p></p><p>What is done:</p><p>1. processes LTR / RTL text</p><p>2. properly handles direction changes within a string</p><p>3. Makes no attempt at character fusion / combining (I don't know the correct term)</p><p>4. Incorrectly handles whitespace characters as LTR (they should be direction-neutral) - this results in words being rendered in reverse order if main language setting is LTR and there are mutiple consecutive RTL words in a string.</p><p></p><p>Basically this takes care of RTL scripts without you having to worry about it. You could also not provide the language global RTL flag but then the strings would be left-aligned (but still rendered correctly) which doesn't look so nice in RTL languages.</p><p></p><p>If I may suggest two paths for a better solution:</p><p>1. Research the system renderer functions</p><p>2. Use one of the libraries to handle proper character fusion. I believe proper implementation requires a bit more code than provided here...</p></blockquote><p></p>
[QUOTE="velis, post: 1106357, member: 96429"] I found this [URL='http://rishida.net/docs/unicode-tutorial/part3']discouraging page[/URL] explaining the basics of character fusion. This needs lots of work still :p I'm attaching the sample program. It's written in python 3.3 and seems to render text correctly. I say "seems" because the farsi characters seem to render differently depending on order of rendering (even though each is rendered separately). I believe this is tkinter-specific and should not show in MePo renderer. I tried to comment the code a lot and also didn't use any of the nice Python stuff to make the code more understandable to a C# programmer. I hope it will do, especially because this implementation is really short (some 50 lines of code). It will however fail immediately when somebody makes a translation containing fused characters (well, this is actually also possible with western scripts and it fails with them as well). What is done: 1. processes LTR / RTL text 2. properly handles direction changes within a string 3. Makes no attempt at character fusion / combining (I don't know the correct term) 4. Incorrectly handles whitespace characters as LTR (they should be direction-neutral) - this results in words being rendered in reverse order if main language setting is LTR and there are mutiple consecutive RTL words in a string. Basically this takes care of RTL scripts without you having to worry about it. You could also not provide the language global RTL flag but then the strings would be left-aligned (but still rendered correctly) which doesn't look so nice in RTL languages. If I may suggest two paths for a better solution: 1. Research the system renderer functions 2. Use one of the libraries to handle proper character fusion. I believe proper implementation requires a bit more code than provided here... [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
Feature Requests
Adding support for Right-to-left languages (Hebrew, Arabic...)
Contact us
RSS
Top
Bottom