Community
Participate
Working Groups
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);
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
Good work http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=e9f12754015493ac55bc996c9b2b653951ebc7cd
(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.