Bug 71901 - Underline and Strikethrough Font styles
Summary: Underline and Strikethrough Font styles
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 124551 154600 (view as bug list)
Depends on:
Blocks: 6712
  Show dependency tree
 
Reported: 2004-08-12 15:34 EDT by Chris Gross CLA
Modified: 2010-06-07 10:42 EDT (History)
11 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Gross CLA 2004-08-12 15:34:34 EDT
Please support underline and strikethrough font styles.  I understand this 
isn't easy on all platforms.  I would be happy if the styles were ignore on non-
Windows platforms.
Comment 1 Carolyn MacLeod CLA 2004-08-13 10:52:21 EDT
See also 59514
Comment 2 Silenio Quarti CLA 2004-08-13 11:11:59 EDT

*** This bug has been marked as a duplicate of 59514 ***
Comment 3 Silenio Quarti CLA 2004-08-13 13:58:33 EDT
This is a more generic request than the TextLayout API. 
Comment 4 Chris Gross CLA 2004-08-13 14:00:33 EDT
Thank you
Comment 5 Carolyn MacLeod CLA 2004-08-16 15:34:50 EDT
See also bug 54426.
Comment 6 Chris Gross CLA 2004-08-16 15:57:16 EDT
I am looking for these font styles to be available in many widgets 
(specifically tables).  I believe that adding them to the base Font class would 
offer that capability.  Sorry if I wasn't specific enough in my original 
description.
Comment 7 Steven R. Shaw CLA 2004-10-26 12:24:06 EDT
This issue gets continually raised since SWT invokes OS dialog for changing 
font properties.  The Windows dialog contains checkbox options for setting 
underline and strike-out.  Either SWT should override the font properties 
dialog from Windows to reflect it's capabilities, or these should be supported 
in SWT for Windows only if necessary.
Comment 8 Steve Northover CLA 2004-10-27 11:49:24 EDT
We can't offer underline or strike through as API for fonts in SWT because 
they are not implemented for fonts on every platform.  If we offered them as a 
hint, application code would fail on non-Windows platforms.  We could offer 
the ability to query these attributes but not to set them.  We could also 
improve TextLayout such that it could draw using these attributes.  This is 
how this functionality is exposed on non-Windows platforms.

SSQ?
Comment 9 Dani Megert CLA 2005-04-07 13:25:10 EDT
Underline and strikethrough are provided via StyleRange but not as font style
but as separate attributes.
Comment 10 Steve Northover CLA 2005-04-07 13:30:31 EDT
Daniel, please reread comment #8.
Comment 11 Silenio Quarti CLA 2006-01-20 11:39:24 EST
*** Bug 124551 has been marked as a duplicate of this bug. ***
Comment 12 Mik Kersten CLA 2006-08-24 17:42:21 EDT
*** Bug 154600 has been marked as a duplicate of this bug. ***
Comment 13 Mik Kersten CLA 2006-08-24 17:55:16 EDT
Just curious since this often comes up with Mylar users: will it possible to support strikethrough on Linux/GTK in the future?  Also, is there a more generic way of setting a strikethrough than the following, should strikethrough start being supported on other platforms?

			// Windows XP only
			try {
				Field dataField = data.getClass().getDeclaredField("data");
				Object dataObject = dataField.get(data);
				Class clazz = dataObject.getClass().getSuperclass();
				Field strikeOutFiled = clazz.getDeclaredField("lfStrikeOut");
				strikeOutFiled.set(dataObject, (byte) 1);
				STRIKETHROUGH = new Font(Display.getCurrent(), data);
			} catch (Throwable t) {
				// Linux or other platform
				STRIKETHROUGH = defaultFont;
			}
Comment 14 justmaddio CLA 2010-06-07 07:15:06 EDT
Is there any possibility to have transparency support for TextLayout any time soon? 
I do not fully understand why drawing methods from TextLayout do not use alpha parameters from its associated graphics...
Comment 15 Felipe Heidrich CLA 2010-06-07 09:20:36 EDT
(In reply to comment #14)
> Is there any possibility to have transparency support for TextLayout any time
> soon? 
> I do not fully understand why drawing methods from TextLayout do not use alpha
> parameters from its associated graphics...

TextLayout draws with transparency, call setAlpha on GC before passing it to TextLayout#draw(). I believe this works on all platforms.
Comment 16 justmaddio CLA 2010-06-07 10:11:48 EDT
(In reply to comment #15)
> (In reply to comment #14)
> > Is there any possibility to have transparency support for TextLayout any time
> > soon? 
> > I do not fully understand why drawing methods from TextLayout do not use alpha
> > parameters from its associated graphics...
> 
> TextLayout draws with transparency, call setAlpha on GC before passing it to
> TextLayout#draw(). I believe this works on all platforms.

I've tried what you suggested but still couldn't get it working. Actually I've tried the code on Windows and carbon MacOS platforms and it works fine. It looks like it's only a cocoa issue...
Comment 17 Felipe Heidrich CLA 2010-06-07 10:42:20 EDT
(In reply to comment #16)
> It looks like it's only a cocoa issue...

Enter a new bug report with your test code.
We will have a look at it (add me to the cc list).
Thank you