| Summary: | StyledText - line for underlined text with a 'rise' other than zero is not shifted | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Radu Vlasov <vlasov.r> | ||||||
| Component: | SWT | Assignee: | Felipe Heidrich <eclipse.felipe> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | daniel_megert, eclipse.felipe, Silenio_Quarti, y29cheng | ||||||
| Version: | 4.1 | ||||||||
| Target Milestone: | 3.8 M3 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows Vista | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Created attachment 204098 [details]
StyledText when rendered on screen
Indeed, this is a testcode
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.addListener(SWT.Paint, new Listener() {
public void handleEvent(Event e) {
TextLayout layout = new TextLayout(e.display);
String underline = "underline";
String strike = "strike";
layout.setText("abc"+underline+"abc"+strike+"abc");
TextStyle style0 = new TextStyle();
style0.underline = true;
style0.rise = +20;
TextStyle style1 = new TextStyle();
style1.strikeout = true;
style1.rise = +20;
int index = layout.getText().indexOf(underline);
layout.setStyle(style0, index, index + underline.length()-1);
index = layout.getText().indexOf(strike);
layout.setStyle(style1, index, index + strike.length()-1);
layout.draw(e.gc, 10, 10);
}
});
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
George, can you fix this for me ? Created attachment 204526 [details]
patch fix for underline and strikeout shift when 'rise' is used
(In reply to comment #5) > Good work > http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=e9f12754015493ac55bc996c9b2b653951ebc7cd Actually, not so good. The fix causes bug 377472 and should be reverted. (In reply to comment #6) > (In reply to comment #5) > > Good work > > http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=e9f12754015493ac55bc996c9b2b653951ebc7cd > > Actually, not so good. The fix causes bug 377472 and should be reverted. Sorry, all is good. I picked the wrong bug. |
Build Identifier: I20110620-1631 In StyledText when a range of characters are underlined and in the same time have a 'rise' attribute different than zero, the line is drawn as if 'rise' would be zero. The same thing happens for strikeout. Reproducible: Always Steps to Reproduce: StyledText st = new StyledText (parentComposite, SWT.NORMAL); st.setText ("ABCDE"); StyleRange sr = new StyleRange (); sr.start = 1; sr.length = 3; sr.underlineStyle = SWT.UNDERLINE_SINGLE; sr.underline = true; sr.rise = +20; st.setStyleRange (sr);