Community
Participate
Working Groups
I2006030314-0800 TextLayout.setStyle(TextStyle, int, int) is not working with StyleRange which is a public subclass of TextStyle. I could not find anything in the Javadoc which says it's not OK to use StyleRange here. However, when I use a StyleRange with some fontStyle it is simply ignored.
That is right. TextLayout takes TextStyle, and TextStyle don't have fontStyle. You can pass StyleRanges to TextLayout, it works fine. But StyleRange.start, StyleRange.length and StyleRange.fontStyle are not used (ignored). See StyledTextRenderer#getStyleRange() StyledTextRenderer#getFont() This that the only problem ? (fontStyle being ignored?)
Mmh - from an OO standpoint the current behavior is OK. I guess you can close this as a user error: I was used to use StyleRange and simply continued to use it when I had to do some computations using TextLayout and was then surprised that this thing didn't get bold even though I've set the fontStyle. Feel free to close.
closing.
I'm reopening this either to reconsider ignoring the fontStyle or to make it very clear in the Javadoc. See bug 228397 comment 23 where another user tried to set the fontStyle on StyleRange and then legitimately expects to see it applied.
Bug 350041 seems to be a duplicate of this bug (colors are fine; fontStyle works with a LineStyleListener but not with a StyledCellLabelProvider). Besides, I second the previous commenters opinion: a user legitimately expects to se fontStyle applied. Is there a workaround (e.g. by overwriting some methods in StyledCellLabelProvider)?
Workaround: Set a new font (with the appropriate style) instead of using fontStyle.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. If the bug is still relevant, please remove the stalebug whiteboard tag.