archimatetool / archi

Archi: ArchiMate Modelling Tool
https://www.archimatetool.com
MIT License
955 stars 268 forks source link

RTL text not working since Eclipse 4.17 (Archi 4.8+) #796

Closed Alon-fnx closed 2 years ago

Alon-fnx commented 2 years ago

Bug report

Version of Archi

4.9.1

Archi Plug-ins

Collaboration

Operating System

Win10

Expected Behaviour

Text in shape should support RTL text

Actual Behaviour

Words written in Hebrew in shapes are written in LTR order For example, If I type שלום עולם It shows: עולם שלום

Steps to Reproduce the Behaviour

  1. Edit a diagram shape
  2. Enter a sentence in Hebrew
  3. The shape shows the words in opposite order
Alon-fnx commented 2 years ago

1 2

Alon-fnx commented 2 years ago

Samples

Phillipus commented 2 years ago

I don't know what the level of support for RTL text is in Eclipse based apps. I Googled the issue and found that one can add the following two lines to the Archi.ini file:

-dir
rtl

As this is an open source project please feel free to investigate the issue further (Google search is a good start)

Alon-fnx commented 2 years ago

Thanks for the fast response.

The strange thing is that in previous versions, this problem did not exist... I'll try and notify.

Phillipus commented 2 years ago

The strange thing is that in previous versions, this problem did not exist...

Is RTL working in, for example, a single line text control like "Name"?

Things that changed between Archi 4.8.1 and 4.9.x:

Eclipse 4.18 -> Eclipse 4.21 We forked the Eclipse GEF and Draw2d frameworks

You could try Archi 4.9.2 beta (uses Eclipse 4.22) https://www.archimatetool.com/beta/

Alon-fnx commented 2 years ago

The problem is happening even in a single line of text - as shown in the example. I'm talking about versions 4.4 / 4.7 and before

I'll try the beta

Phillipus commented 2 years ago

I'm not asking about the text in a diagram figure. I mean single line text controls as in the Properties tab or the controls in the Preferences dialog.

You could also test against Archi 4.8.1 - https://www.archimatetool.com/archive/

Please use the portable zip file versions for testing.

Alon-fnx commented 2 years ago

In any other object (Properties, diagram name etc'.) it's ok. It happens only in diagram objects

Phillipus commented 2 years ago

So we need to narrow it down to what version of Archi this problem is in, and perhaps whether it's a configuration issue for your setup.

Phillipus commented 2 years ago

Help me to understand this better...

As you type in the diagram text box the direction is correct? It's only when you finish editing that the displayed direction is wrong?

But please try to narrow it down to when this bug started.

Phillipus commented 2 years ago

And does this happen in Note text box?

Alon-fnx commented 2 years ago

When narrowing the box for one word at a line, It is OK. It shows the words as they ere typed. In note shape It is the same - when expanded it's reversed, and when narrowing the box it is shown OK..

Phillipus commented 2 years ago

What do you mean "narrowing the box"? Do you mean when the edit box is shown?

Please try all controls - Notes, Group, Stickies, Canvas blocks, stickies etc.

Alon-fnx commented 2 years ago

"Narrowing the box - i.e. changing the box width

Phillipus commented 2 years ago

"Narrowing the box - i.e. changing the box width

Now I'm even more confused. Are you saying that the direction of text changes when you resize a diagram box? Is it correct? Not correct? When you edit a box? Or what? Please provide the exact steps to reproduce this.

Also, please try Archi 4.8.1. Without knowing when this issue started I'm having a hard time to help.

Alon-fnx commented 2 years ago

22 44 33 11

Phillipus commented 2 years ago

And please answer this question:

As you type in the diagram text box the direction is correct? It's only when you finish editing that the displayed direction is wrong?

Alon-fnx commented 2 years ago

Correct. Edit pane is OK,

Phillipus commented 2 years ago

And please can you answer the questions for Archi versions:

Archi 4.7.1 - works OK? Not OK? Archi 4.8.1 - works OK? Not OK? Archi 4.9.2 beta - works OK? Not OK?

Alon-fnx commented 2 years ago

If I recall, the last version I had installed was 4.7.1 . In this version it worked OK.

Phillipus commented 2 years ago

Please test 4.8.1 and 4.9.2 beta

https://www.archimatetool.com/archive/

Phillipus commented 2 years ago

I have a theory that it might be related to this change:

https://github.com/archimatetool/archi/commit/81ad532bd072d099f6c9c28790af5847ea5d6318

I removed the BlockFlow container.

If this is the cause then it means that this was working in Archi 4.6 but not 4.7 and later.

@Alon-fnx Can you confirm that it is working in Archi 4.6 but not 4.7.1?

https://www.archimatetool.com/archive/

Alon-fnx commented 2 years ago

I'd love to, but I'm working in an enterprise that every installation can take days... :( I'll try my best

Phillipus commented 2 years ago

I'd love to, but I'm working in an enterprise that every installation can take days... :( I'll try my best

In that case I can't provide a fix in a beta version, because you wouldn't be able to test the beta version.

Phillipus commented 2 years ago

I've made a test build for Windows on the basis of my theory about a breaking change above:

~https://www.archimatetool.com/downloads/beta/Archi-Win64-4.9.2-test1.zip~ (edit: deleted now)

If it is possible for someone to test this and if it works I can apply the fix.

But without user feedback and testing I am not able to fix or diagnose this issue - all I simply need to know is which version of Archi this worked and which version it broke.

Alon-fnx commented 2 years ago

I've made a test build for Windows on the basis of my theory about a breaking change above:

https://www.archimatetool.com/downloads/beta/Archi-Win64-4.9.2-test1.zip

If it is possible for someone to test this and if it works I can apply the fix.

But without user feedback and testing I am not able to fix or diagnose this issue - all I simply need to know is which version of Archi this worked and which version it broke.

Phillip, I'm admired by the agility and the swiftness of your response. I already started to move the wheels.

Thank you - I really do.

Phillipus commented 2 years ago

Perhaps test on a non-work machine? Or someone else could test?

Alon-fnx commented 2 years ago

My other machine is a Linux... I hope tomorrow I'll have it installed.

Phillipus commented 2 years ago

If I recall, the last version I had installed was 4.7.1 . In this version it worked OK.

If that is the case then my proposed fix won't make any difference.

This really needs more eyes on the case.

We've not had any other reports about this. For me, as I said, I need to know when it stopped working. Also, need to know if this is an isolated case.

Alon-fnx commented 2 years ago

If I recall, the last version I had installed was 4.7.1 . In this version it worked OK.

If that is the case then my proposed fix won't make any difference.

This really needs more eyes on the case.

We've not had any other reports about this. For me, as I said, I need to know when it stopped working. Also, need to know if this is an isolated case.

Tested the zip on my home pc (win10). Same problem...

Phillipus commented 2 years ago

Tested the zip on my home pc (win10). Same problem...

OK, then I need to know the version where it did work. Can you test some versions please:

https://www.archimatetool.com/archive/

Alon-fnx commented 2 years ago

4.8.1 no ok 4.7.1 OK

Phillipus commented 2 years ago

4.8.1 no ok 4.7.1 OK

Thanks, that helps.

So we can eliminate these changes:

I reviewed the changes between Archi 4.7.1 and 4.8.1 and I can't see anything that might affect paragraph layout and Bidi support in the diagram figures.

What did change was Archi 4.8.1 uses Eclipse 4.18 instead of 4.15. If it is an Eclipse issue then it might be hard to pinpoint.

Is the issue present on the Mac and Linux versions?

Also, it's strange that this has not been reported before.

Alon-fnx commented 2 years ago

I haven't tried on Mac or Linux. Maybe I'll revert to 4.7.1 in the meantime. Yes, It's strange that it wasn't reported. I'm sure there are many RTL users.

Phillipus commented 2 years ago

Searching through the Eclipse Bugzilla I found this bug, "BIDI Support is broken in 4.17":

https://bugs.eclipse.org/bugs/show_bug.cgi?id=566914

Looks like it might have something to do with it.

Phillipus commented 2 years ago

Let's assume that the issue is caused by some bug in Eclipse. In order to figure out what's wrong requires somebody with a RTL setup to debug and try some things in the Archi code. I can't do that because I can't set text to Hebrew or Arabic and set things to use RTL.

If someone is able to set up a test environment they could look at the following classes:

com.archimatetool.editor.diagram.figures.AbstractTextControlContainerFigure
com.archimatetool.editor.diagram.figures.diagram.NoteFigure

For example, in the NoteFigure class the text control is set up as follows:

protected void setUI() {
    setLayoutManager(new GridLayout());

    FlowPage page = new FlowPage();
    fTextFlow = new TextFlow();
    fTextFlow.setLayoutManager(new ParagraphTextLayout(fTextFlow, ParagraphTextLayout.WORD_WRAP_SOFT));
    page.add(fTextFlow);
    setOpaque(true);

    GridData gd = new GridData(SWT.LEFT, SWT.TOP, true, true);
    add(page, gd);

    fTextPositionDelegate = new TextPositionDelegate(this, page, getDiagramModelObject());

    setIconicDelegate(new IconicDelegate(getDiagramModelObject()));
}

The FlowPage class handles Bidi information. One can manually set the orientation to RTL like this:

page.setOrientation(SWT.RIGHT_TO_LEFT);

Just some ideas...

Alon-fnx commented 2 years ago

Hello Phillip,

I manged to change the ini file with -dir rtl and it works O.K.! It change the entire ui to RTL but I can adapt to that.

Thank you very much for your time!

Alon

Phillipus commented 2 years ago

I still thinks there's a bug in Eclipse:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=566914

Alon-fnx commented 2 years ago

I still thinks there's a bug in Eclipse:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=566914

Please let me know if the bug is resolved.

Phillipus commented 2 years ago

@Alon-fnx

Perhaps you can help to test a special build of Archi that is built using Eclipse 4.15?

As you say that RTL is working in Archi 4.7.1 which is built on Eclipse 4.15.

It is a buggy build, errors will be written to the log, and it will leak memory...but it will show whether the RTL bug is in Eclipse or not:

~https://www.archimatetool.com/downloads/beta/Archi-Win64-4.9.2-testbuild.zip~ (edit: deleted now)

Perhaps you could launch it and do a quick test?

Don't use it for production work!

Alon-fnx commented 2 years ago

@Phillipus I'll try

Alon-fnx commented 2 years ago

@Alon-fnx

Perhaps you can help to test a special build of Archi that is built using Eclipse 4.15?

As you say that RTL is working in Archi 4.7.1 which is built on Eclipse 4.15.

It is a buggy build, errors will be written to the log, and it will leak memory...but it will show whether the RTL bug is in Eclipse or not:

https://www.archimatetool.com/downloads/beta/Archi-Win64-4.9.2-testbuild.zip

Perhaps you could launch it and do a quick test?

Don't use it for production work!

Hi Phil,

The Hebrew is correct.

Does it mean it's an Eclipse bug?

Phillipus commented 2 years ago

@Alon-fnx Thanks for testing that build.

Does it mean it's an Eclipse bug?

Yes, I think so.

The test build uses all of the code as used in Archi 4.9.2 (apart from having to change the calls to Eclipse's Colorobject for backward compatibility). The only difference is that it is built using Eclipse 4.15 (as used in Archi 4.7.1).

This tells me that there's nothing in Archi's code that can be changed and that we should look to this possible bug:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=566914

Phillipus commented 2 years ago

...and for the Eclipse developers to even look at this Eclipse bug they will need a reproducible test case in Eclipse itself.

Alon-fnx commented 2 years ago

Thank you. Please let me know whenever you hear it's done.

Phillipus commented 2 years ago

Thank you. Please let me know whenever you hear it's done.

Unless more Hebrew / Arabic Eclipse users can confirm and have steps to reproduce the bug/regression in Eclipse itself, the devs won't even look at it.

Phillipus commented 2 years ago

@Alon-fnx A new Eclipse bug has been reported:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=579626

Do you think this could be the cause?

Phillipus commented 2 years ago

That Eclipse bug fix that might have caused this is for Windows only. @Alon-fnx Can you check whether RTL works in Archi on Linux and Mac?

Phillipus commented 2 years ago

I think it's likely that the Eclipse bug at 579626 could be the cause. The affected Eclipse class was TextLayout and Draw2d uses TextLayout in its BidiProcessor class for RTL text.

Phillipus commented 2 years ago

@Alon-fnx I've made a test build of Archi 4.9.3 for Windows with a modified TextLayout class. Can you test it and see if it fixes the RTL issue?

~https://www.archimatetool.com/downloads/beta/Archi-Modified-4.9.3.zip~ (edit: deleted now)