Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325383 - StyledText has problems with layout in the presence of ligatures
Summary: StyledText has problems with layout in the presence of ligatures
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.7 M3   Edit
Assignee: Felipe Heidrich CLA
QA Contact: Silenio Quarti CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-15 15:02 EDT by Boris Bokowski CLA
Modified: 2010-10-21 17:36 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Boris Bokowski CLA 2010-09-15 15:02:29 EDT
[3.6.0 and 3.6.1]

Create a mini snippet with just a StyledText in a shell:

StyledText styledText = new StyledText(shell, SWT.V_SCROLL
				| SWT.H_SCROLL);

Enter the following characters and observe where the cursor moves after each character:

abcdeffg 

Note that after entering the second 'f' the cursor is in the wrong position. Happens for the ligature 'fi' as well.
Comment 1 Scott Kovatch CLA 2010-09-15 15:15:48 EDT
I'm pretty sure the auto-conversion to ligature behavior can be disabled. TextEdit.app, for example, doesn't do this by default.
Comment 2 Boris Bokowski CLA 2010-09-15 15:41:44 EDT
Btw, one place in Eclipse where this can be observed is in the CVS Commit dialog.
Comment 3 Felipe Heidrich CLA 2010-09-15 15:59:44 EDT
I very quickly try adding this line:

attrStr.addAttribute(OS.NSKernAttributeName, NSNumber.numberWithInt(0), range);
to TextLayout#computeRuns() but it didn't work, more investigation is needed.

see http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSAttributedString_AppKitAdditions/Reference/Reference.html
Comment 4 Scott Kovatch CLA 2010-09-15 16:40:47 EDT
(In reply to comment #3)
> I very quickly try adding this line:
> 
> attrStr.addAttribute(OS.NSKernAttributeName, NSNumber.numberWithInt(0), range);
> to TextLayout#computeRuns() but it didn't work, more investigation is needed.

Try NSLigatureAttributeName with a value of 0 instead.

"NSLigatureAttributeName
NSNumber containing integer
Default 1, standard ligatures; 0, no ligatures; 2, all ligatures"
Comment 5 Felipe Heidrich CLA 2010-09-15 16:56:29 EDT
(In reply to comment #4)
> (In reply to comment #3)
> > I very quickly try adding this line:
> > 
> > attrStr.addAttribute(OS.NSKernAttributeName, NSNumber.numberWithInt(0), range);
> > to TextLayout#computeRuns() but it didn't work, more investigation is needed.
> Try NSLigatureAttributeName with a value of 0 instead.
> "NSLigatureAttributeName
> NSNumber containing integer
> Default 1, standard ligatures; 0, no ligatures; 2, all ligatures"

thank you sir, that worked.
I was afraid that no ligatures was going to break lam-alef ligatures but it all worked fine.
I'll clean my workspace tomorrow morning and release the fix.
Comment 6 Felipe Heidrich CLA 2010-09-16 11:13:21 EDT
Fixed in HEAD > 20100916