| Summary: | [Widget] alignment for different language users(start with blank space char) is a mess with Tree/List | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | yanghang | ||||||||||||||||
| Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> | ||||||||||||||||
| Status: | CLOSED WORKSFORME | QA Contact: | Bogdan Gheorghe <gheorghe> | ||||||||||||||||
| Severity: | normal | ||||||||||||||||||
| Priority: | P3 | CC: | eclipse.felipe, ericwill, ipun, mukund, pinnamur, prakash, pwebster, raji, Silenio_Quarti | ||||||||||||||||
| Version: | 4.8 | Keywords: | helpwanted, triaged | ||||||||||||||||
| Target Milestone: | --- | ||||||||||||||||||
| Hardware: | PC | ||||||||||||||||||
| OS: | Linux | ||||||||||||||||||
| Whiteboard: | |||||||||||||||||||
| Attachments: |
|
||||||||||||||||||
Created attachment 165685 [details]
input
This is being reported as a usability issue by Lotus Sametime team. Should this be moved to UI category instead of SWT? Yes, please send it back if the problem is caused by the native control. Requesting feedback from UI team. Please also attach a picture of the tree with the problem. PW Created attachment 168397 [details]
Picture of the tree with problem
Adding picture as requested
Created attachment 168398 [details]
Screenshot of problem in Lotus Sametime Connect
Hang Yang, If you have additional data please add here.
Created attachment 168500 [details]
Multilingual tree viewer
It looks good to me.
I've used the TreeViewer created by PDE's wizard and used some strings translated by Google. Any specific steps to reproduce? Or is it a Lotus/Linux specific bug?
(In reply to comment #9) > Created an attachment (id=168500) [details] > Multilingual tree viewer > It looks good to me. > I've used the TreeViewer created by PDE's wizard and used some strings > translated by Google. Any specific steps to reproduce? Or is it a Lotus/Linux > specific bug? It is only reproduce on Suse11. Just reminder, the String includes some space char. For example " hello" (In reply to comment #10) > It is only reproduce on Suse11. Possibly SWT bug? Adding Praveen to cc. Praveen,/ Can you quickly check whether SWT Tree on Linux has this issue? (In reply to comment #9) Thanks, Prakash. Also ,Hang Yang are you using ownerdraw/stylledlabelproviders ? Could you please share information on the labelprovider code and if you have used alignment bits while setting up columns if any. Created attachment 168507 [details]
sample code
This is my sample code
(In reply to comment #13) > Created an attachment (id=168507) [details] > sample code > > This is my sample code Thanks for the snippet. This is not reproducible on windows either. (In reply to comment #11) > (In reply to comment #10) > > It is only reproduce on Suse11. > > Possibly SWT bug? Adding Praveen to cc. > > Praveen,/ > Can you quickly check whether SWT Tree on Linux has this issue? Prakash is right and looks like a platform specific problem. Waiting for SWT's comment. (In reply to comment #11) > Can you quickly check whether SWT Tree on Linux has this issue? Yes, I am able to reproduce the problem on my Ubuntu machine. So, it appears to me that GTK does not handle such charset strings in the right way. However, I have noticed that the alignment happens correctly when there are no spaces before the string. After some investigation, I realized that incorrect alignment was due to the variation in the size of "space" character for different unicode chars. For example, the space char size of chinese chars is slightly wider than the space char size of english chars. Due to this reason, the chinese chars appear as they moved towards right. This is clearly evident when these strings are set to a Text widget :) So it is valid bug, right? Have workaround to avoid this? Thanks This bug showed up in a unrelated query for me. Shouldn't the component of this bug be SWT instead of UI? (In reply to comment #17) > So it is valid bug, right? > Have workaround to avoid this? > Thanks I'm still not sure I understood the problem, can you please add a screenshot and highlight how the alignment is wrong ? I think this problem can be a duplicate of bug 236513. Can you also test using the latest SWT (3.6 RC2) Hi Felipe, I had added a couple of screenshots earlier on Hang Yang's behalf. Pls see the one from Lotus Sametime Connect. Where can I get the swt3.6 RC2? I do not find the download on the page http://www.eclipse.org/swt/ (In reply to comment #21) > Where can I get the swt3.6 RC2? http://download.eclipse.org/eclipse/downloads/drops/S-3.6RC2-201005201744/index.php Search for SWT binary and source run the sample code on Eclipse 3.6 RC2. still has the issue I have seem this problem before (not sure if it was on Linux, maybe it was). The problem is the current font does not support all the languages, so the system replaces the current font with a fallback font for the language in the item. But instead of drawing only the foreign characters with the fallback font it draws the entire string. It happens that the whitespace characters have different width in different fonts. If the system was always drawing the whitespaces with the current font and only using the fallback font to draw the foreign characters the problem wouldn't exist (IMO). Not sure how to fix this problem. Any more thoughts on this one? (In reply to comment #25) > Any more thoughts on this one? Just for my curiosity, why do you need to add whitespaces in the beginning of the text ? We need use different width icon in the tree. The expected result is in image(expected result) attached. But if we if use Labelprovider to provide these different width icons. the result is is in image(compressed result). So we use gc.drawImage() to make the icon show correctly. to avoid overlap, we need add some space char to text Created attachment 171793 [details]
expected result
Created attachment 171794 [details]
compressed result
I would not recommend using whitespace for that. You should make all images the same width. When the actual image is smaller than max width you need to create a transparent image (or with the same background as the item) with max width and draw your image in it (easy to control the alignment). At the end, set the transparent image to the item. I believe Eclipse uses this technique all over the place and they even have a class to help you composite images. Other option is, keep using custom draw (like it seems you are already doing). In MeasureItem you return the width to draw all the images, paddings, and text. In EraseItem you clear the SWT.FOREGROUND flag (so SWT wont draw the text for you. In PaintItem you draw all your imges and the text. Bug triaged. Visit https://wiki.eclipse.org/SWT/Devel/Triage for more information. As per comment 30. |
Build Identifier: 20100218-1602 My OS is Linux Suse11: Create input for Jface treeviewer like below: public static UserTreeNode getInitalInput() { UserTreeNode root = null; root = new UserTreeNode( ""); UserTreeNode n1 = new UserTreeNode( " ±±¾©"); UserTreeNode n2 = new UserTreeNode( " قفغعهخحم"); UserTreeNode n3 = new UserTreeNode( " ئءؤرلاى"); UserTreeNode n4 = new UserTreeNode( " English"); root.addChildren(n1); root.addChildren(n2); root.addChildren(n3); root.addChildren(n4); return root; } bug: alignment for different language users is a mess Reproducible: Always Steps to Reproduce: 1.create jfacetreeview 2. creat input for the tree, input different language string, and the string start with same blank space char. 3. show the tree Bug: alignment for different language users is a mess