Project: SWT
Bug 63154 JavaEditor draws squiggle underline over the string
Reported: 2004-05-19 19:07:18 | Status: resolved fixed

build I20040519 JavaEditor draws squiggle underline over the string (a.k.a red see). This problem is been caused by SWT. It was introduced when we added italic font support. Here is the situation: The application set a font in the StyledText. Internally StyledText will create 3 more fonts: boldFont, italicFont, boldItalicFont. In order to line up normal, bold, italic, and boldItalic segments of text in the same line StyledText need to compute the max baseline amongs all those fonts. Usually these font have same (or very similar) metrics, but sometimes they are not (example: default font in Solaris). I believe the code that draws the squiggle is getting the normal font from the StyledText, getting its metrics, compute the baseline (ascent+descent), and draws the squiggle at y + baseline. Since this baseline can be less than the maxBaseline it possible that the siggle will be drawn over the text instead of the real baseline where the strings where drawn. Right now we have two solutions: 1) The app code will need to create all the fonts and do the same styledtext is doing. 2) We add getBaseline() to StyledText and app code start to using it instead of getting the line metrics.

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledTextRenderer.java