Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] SWT Bidi Text Support

I'm posting this for Lynne, she is having mailer problems.

----- Forwarded by Lynne Kues/RAL/OTI on 11/15/01 02:42 PM -----


Lynne Kues
11/15/01 05:17 PM


        To:     platform-swt-dev@xxxxxxxxxxx
        cc: 
        Subject:        Re: [platform-swt-dev] SWT Bidi Text Support

Steve is referring to the portion of BidiUtil that provides a listener for 
WM_INPUTLANGCHANGE (i.e., so that the application can be notified when the 
user changes the keyboard language via Alt-Shift).  For most cases, one 
would add the listener at the canvas level, but technically the code is 
incorrect.  A bug report has been opened for the problem http://bugs.eclipse.org/bugs/show_bug.cgi?id=5986.

Lynne




"Steve Northover/OTT/OTI" <Steve_Northover@xxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx
11/15/01 01:34 PM
Please respond to platform-swt-dev

 
        To:     platform-swt-dev@xxxxxxxxxxx
        cc: 
        Subject:        Re: [platform-swt-dev] SWT Bidi Text Support


Please note that there is a serious problem in the current BidiUtil 
if it is used with anything other than a Canvas or subclass of Canvas. 




"Lynne Kues/RAL/OTI" <Lynne_Kues@xxxxxxx> 
Sent by: platform-swt-dev-admin@xxxxxxxxxxx 
11/15/01 12:51 PM 
Please respond to platform-swt-dev 
 
        To:        platform-swt-dev@xxxxxxxxxxx 
        cc:        stori@xxxxxxxxxx 
        Subject:        [platform-swt-dev] SWT Bidi Text Support



Adrian I am posting your question and my reply to the SWT mailing list so 
that others can be involved.  You can find out about the mailing lists and 
how to subscribe at http://www.eclipsecorner.org/. 

>> Lynne,
>> 
>> Is there any decision on making the bidi API public and/or when will
>> Eclipse move to Java 1.4?
>>
>> Thank you.  Best regards -
>> Adrian.
>>
>> Adrian Storisteanu
>> IBM Toronto Lab, Canada
>> Tie line 8-969-3156 * Phone 905-413-3156 * Fax 905-413-4850 

Currently SWT includes an internal class, 
org.eclipse.swt.internal.BidiUtil, which wraps the Win32 bidi platform 
calls (specifically - GetCharacterPlacement, GetFontLanguageInfo, 
ExtTextOut, GetKeyboardLayout, GetKeyboardLayoutList).  This class is used 
by the org.eclipse.swt.custom.StyledText widget to provide bidi support. 
The class is internal because it is only a Windows solution.  This class 
does nothing on the other platforms that SWT supports. 

That said, you may use BidiUtil.  It should be sufficient for LPEX since 
it is sufficient for bidi text support in Eclipse (i.e., via the 
StyledText widget), BUT it will most likely change in the future as we 
move towards bidi support for other platforms.  Until we investigate a 
multi-platform solution, we are not in the position to make any of the 
bidi API truly public (i.e., supported and maintained). 

Looking at the list of the support you said you needed: 

>> - detection of RTL environment (active native RTL locale),
>> - cursor (caret) navigation (i.e., detect RTL - LTR boundaries & 
direction
>> changes),
>> - cursor <-> text index corelation (index n in String text <-> position 
m
>> on display),
>>  - text String <-> displayed text corelation (important in Arabic, 
where n
>> text characters may display as a smaller m glyphs as a result of
>> autoshaping).

BidiUtil will supply you with what you need except for detection of RTL 
environment.  You can look at the current code page using 
System.getProperty("file encoding") to determine this. 
org.eclipse.swt.custom.StyledTextBidi will give you an example of how to 
utilize the information that BidiUtil gives you. 

You probably also want to look at the classes 
org.eclipse.swt.custom.BidiSegmentListener and 
org.eclipse.swt.custom.BidiSegmentEvent (in R2.0 stream).  In some 
instances (e.g., source code editors), you may want the bidi algorithm to 
be applied separately to portions of the line vs. the whole line. 

If you decide to use BidiUtil, we can certainly answer questions for you, 
discuss the issues we ran into, etc..  It would also be useful to get your 
feedback as to what you (or anyone for that matter) think API for bidi 
support should look like. 

Lynne 








Back to the top