Bug 266464 - SWT TextStyle support for TextFlow
Summary: SWT TextStyle support for TextFlow
Status: NEW
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy Draw2d (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: gef-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-27 06:06 EST by Dennis van der Laan CLA
Modified: 2009-11-30 22:12 EST (History)
1 user (show)

See Also:


Attachments
My quick solution (1.90 KB, text/plain)
2009-02-27 06:06 EST, Dennis van der Laan CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis van der Laan CLA 2009-02-27 06:06:56 EST
Created attachment 126969 [details]
My quick solution

Build ID: M20080911-1700

Steps To Reproduce:
We're building a WYSIWYG editor using Draw2D. I'm missing the possibility of setting TextStyles (or equivalent) on a TextFlow. This would make it possible to use the underline-features (including SWT.UNDERLINE_ERROR for marking text by a spellchecker).

I already created a subclass of TextFlow (StyledTextFlow) on which one can add TextStyle objects on a specific range. To apply these TextStyles, I made an override of paintText(), but this method is called with substrings (the fragmented parts) so the offsets given for the TextStyles won't always match.

I also added basic support for sub-/superscript, by changing the y-coordinate when drawing the string. This currently has no effect on the line-height, so setting the baseline too high or too low, makes the string (partially) invisible.

I could make the necessary changes to the Draw2D source myself, but I don't want to change the Draw2D/GEF plugin, because that would mean extra effort when updating to new releases.

More information:
Any other enhancement to Draw2D text which enables the rendering of subscript and superscript, and makes it possible to decorate text with SWT.UNDERLINE.ERROR are welcome, obviously.