|
Multi language charts and Hebrew |
Posted by Guus on Feb-22-2011 18:31 |
|
Hi,
we are using ChartDirector .NET for customers with multiple languages.
I occurred to me that the charts with hebrew texts got their texts (the legend for instance) reversed.
Beforehand I do not kwow if a text is hebrew, arabic, chinese or european.
The text I pass comes from the database and I assume the hebrew texts are already reversed.
Is there a way to let each text being printed just left to right?
Regards,
Guus Mathijssen
|
Re: Multi language charts and Hebrew |
Posted by Peter Kwan on Feb-23-2011 10:09 |
|
Hi Guus,
When you pass text strings to ChartDirector, they are characters in memory. There is no such thing as left or right in a computer memory (or in a hard disk). They are just a sequence of characters.
When ChartDirector receives the sequence of charaters from your code, it has to render them. ChartDirector for .NET renders characters according to the Unicode standard, which can be left to right, right to left, or both (if the text contains both left to right languages and right to left languages). The rendering direction is necessary in order to perform glyph shaping (for Arabic glyphs).
If you enter Hebrew text using a text editor that supports Hebrew, when you press 'A', 'B', 'C' in that sequence (assuming 'A', 'B', 'C' are Hebrew characters), the text editor will display 'A', 'B', 'C' from right to left (that is, the text as appear on the screen will be 'CBA'). When the text is stored in the hard disk, the text editor will store it as 'A', 'B', 'C' in that sequence. (As explained above, there is no such thing as left or right in a hard disk. So the text is just stored in the same sequence as it is entered. This is also in compliance to the Unicode standard.)
When ChartDirector receives the text in the sequence 'A', 'B', 'C', it will render it as 'CBA', the same way as the Hebrew text editor. Thus people using Hebrew can see the correct text. The standard .NET framework also renders text the same way as ChartDirector.
For your case, I can think of two possibilities:
(a) The ChartDirector text is correct, and the text in the "Instance" text box is incorrect. We would need to find someone who can read Hebrew to determine which text is the correct one.
(b) The text in the database is really reversed. Unluckily, in this case, you would need to write code to reverse the text again (so that it becomes the character sequence as you would enter it using a Hebrew text editor).
Regards
Peter Kwan |
Re: Multi language charts and Hebrew |
Posted by Guus on Feb-23-2011 17:50 |
|
Hi Peter,
thanks for you extensive answer.
It appears that we are working with the ASP/VB/COM version of ChartDirector 5.0 instead of the .NET version (my mistake, we are working a lot with .NET, but not in this case)
Just to confirm, does the ASP/VB/COM version format Hebrew right to left (CBA) or left to right (ABC) when I input ABC
Regards,
Guus |
Re: Multi language charts and Hebrew |
Posted by Peter Kwan on Feb-23-2011 23:19 |
|
Hi Guus,
Currently, only "ChartDirector for .NET" can automatically format the characters from left to right or right to left based on their language. All other editions of ChartDirector (including ChartDirector for ASP/COM/VB) always render the characters from left to right.
Regards
Peter Kwan |
Re: Multi language charts and Hebrew |
Posted by Zev Toledano on Feb-27-2011 20:42 |
|
This is a BIG problem for us. Even a 'non-unicode' COM control can show RTL Hebrew/Arabic correctly as long as the Windows "default language for non-unicode programs" is set to the appropriate language. Now you're telling me that a Unicode control is worse than a non-Unicode one? One of my requirements for finding a better graph control was to check that it supported Unicode - it never occurred to me that RTL wouldn't work at all.
I MUST have a workaround for this. Don't tell me I have to convert every single text string that I send to the graph and flip any sequence of RTL characters that I find manually? This includes large arrays of labels, axis titles, legend names, extra textboxes, tooltips, etc. |
Re: Multi language charts and Hebrew |
Posted by Peter Kwan on Mar-01-2011 02:37 |
|
Hi Zev,
In the current version of "ChartDirector for ASP/COM/VB", you would need to layout the text first before passing the text to ChartDirector.
I would not expect people to layout the text "manually". Most people will write a function to layout the text.
It is very easy to detect if the text is Hebrew or Arabic (there is a standard Unicode range for Hebrew and Arabic). It is very easy to layout the text if it is pure Hebrew (just reverse it). It is harder if the text is pure Arabic because of Arabic shaping rules, but there is free code available (eg. see http://code.google.com/p/gjdesktop/source/diff?r=2&format=side&path=/trunk/src/fagd.php - I have also created a VB6 port of this code).
On the other hand, it is quite difficult if you need to handle a text string that can contain all possible characters from all languages (both RTL and LTR) simultaneously, which is possible in Unicode systems.
Currently, only ChartDirector for .NET can layout a text string with both RTL and LTR text. We also have a patch for ChartDirector for JSP/Java that can layout text strings containing with both RTL and LTR text. For ASP/COM/VB, we only have an internal build. If you are interested, I can ask our developer to compile a build for you.
Regards
Peter Kwan |
Re: Multi language charts and Hebrew |
Posted by Zev Toledano on Mar-01-2011 02:44 |
|
We expect some names with mixed English and Hebrew.
Will this internal build be compatible with our existing license? Is it relatively stable?
I would very much appreciate the build if possible. I've dealt with RTL algorithms for Unicode before and it was a nightmare. |
Re: Multi language charts and Hebrew |
Posted by Peter Kwan on Mar-02-2011 00:13 |
|
Hi Zev,
Yes. The bidirectional layout support is stable. However, we have not yet comprehensively tested it to see if it really works correctly. We will need to find someone fluent in Arabic/Hebrew to see if the results are correct. Currently, we are only verifying the results using some test input/output pairs that we know are correct.
I will send the updated "chartdir50.dll" to you possibly on Wednesday.
Regards
Peter Kwan |
Re: Multi language charts and Hebrew |
Posted by Peter Kwan on Mar-03-2011 00:13 |
|
Hi Zev,
I have just uploaded the updated "chartdir50.dll" to:
http://www.advsofteng.com/chartdir_win32_503p3.zip
The updated "chartdir50.dll" can perform bidirectional text layout as per Unicode Bidi standard.
Please use the updated "chartdir50.dll" to replace your existing "chartdir50.dll" (usually at c:\\Program Files\\ChartDirector\\lib). If you are using ChartDirector with ASP/IIS, the IIS may lock the chartdir50.dll, preventing you from updating it. In this case, please entire the following "iisreset" command in the command shell to reset the IIS.
Hope this can help.
Regards
Peter Kwan |
Re: Multi language charts and Hebrew |
Posted by Zev Toledano on Mar-03-2011 22:55 |
|
Thank you! You solved the crisis. I can't test Arabic, but I tested a few variations of mixed English and Hebrew and it seems to work perfectly.
I really appreciate for the super-fast response to this.
A minor issue: We use versioning to update chart components and this internal build has the same version as the previous so our installs won't update it. I managed to change the internal version of your DLL to 5.0.3.1 but I don't want to conflict with an official release with this version number. Any idea when this will be released officially, and is it OK that I changed it to 5.0.3.1? |
Re: Multi language charts and Hebrew |
Posted by Peter Kwan on Mar-04-2011 00:31 |
|
Hi Zev,
Yes. It is safe to change it to 5.0.3.1. The next official release is likely to be 5.1.0.0.
Hope this can help.
Regards
Peter Kwan |
|