Bug 4846 - StyledText - bidi - partial styling of ligatures (1GL3AWT)
Summary: StyledText - bidi - partial styling of ligatures (1GL3AWT)
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Lynne Kues CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-11 14:24 EDT by Lynne Kues CLA
Modified: 2001-11-05 17:27 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lynne Kues CLA 2001-10-11 14:24:04 EDT
Partial Styling of Ligatures - known problem, currently if you select only part of a ligature and attempt to
	apply a style to it, the caret positioning/rendering for the ligature gets messed up.  Need to talk to
	bidi folks about how to handle this.  Word Pad actually renders the ligature as its parts when this is
	done.  Unable to apply the scenario in PageDesigner.

NOTES:
MA (06/09/2001 18:08:14) 
	The Arabic experts have expressed their preference that, in such a case, the scope of the style application be 
	extended to include all characters forming the ligature.

LK (04/10/2001 16:54:16)
	Due to line style listeners we would need to do this during the getLineStyleData callback.  Need to check the
	beginning and end of each style range to see if it is in a ligature.  Code something like the following.  Waiting
	until bidiColoring code pulled out since this code calls getLineStyleData excessively.

	if (isListening(LineGetStyle)) {
		StyledTextEvent event = new StyledTextEvent(content);
		event.detail = lineOffset;
		event.text = line;
		notifyListeners(LineGetStyle, event);
		if (event.styles == null) {
			event.styles = new StyleRange[0];
		}
		if (isBidi()) {
			GC gc = new GC(this);
			if (StyledTextBidi.isLigated(gc)) {
				for (int i=0; i<event.styles.length; i++) {
					StyleRange range = event.styles[i];
					int relativeStart = range.start - lineOffset;
					StyledTextBidi bidi = new StyledTextBidi(gc, tabWidth, line, null, null, getStyleOffsets(line, lineOffset, event.styles));
					int startLigature = bidi.getLigatureStartOffset(relativeStart);
					if (startLigature != relativeStart) {
						range.start = range.start - (relativeStart - startLigature);
						range.length = range.length + (relativeStart - startLigature);
					}
					int rangeEnd = range.start + range.length;
					int relativeEnd = rangeEnd - lineOffset - 1;
					int endLigature = bidi.getLigatureEndOffset(relativeEnd);
					if (endLigature != relativeEnd) range.length = range.length + (endLigature - relativeEnd);
				}
			}
			gc.dispose();
		}
		return event;
	}
Comment 1 DJ Houghton CLA 2001-10-29 16:43:08 EST
PRODUCT VERSION:
2.006

Comment 2 Lynne Kues CLA 2001-11-05 17:27:06 EST
Changed getLineStyleData method to check if the font supports ligatures and if 
so to check for partially styled ligatures and apply the style to the entire 
ligature.