Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 323875

Summary: [Viewers] [JFace] Setting font in StyledString does not work
Product: [Eclipse Project] Platform Reporter: Flannan Lo <flannanl>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED FIXED QA Contact: Hitesh <hsoliwal>
Severity: normal    
Priority: P3 CC: eclipse.felipe
Version: 3.4.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Code snippet that shows the problem.
none
A screen capture that shows the problem.
none
ScreenShot on my system ;) none

Description Flannan Lo CLA 2010-08-27 21:18:37 EDT
Build Identifier: M20090211-1700

I have a label provider which make use of StyledString. I have a custom org.eclipse.jface.viewers.StylerString.Styler to set the style in my StyledString. In the applyStyles method, I did something like:

                Font systemFont = Display.getDefault().getSystemFont();
                FontData fd = systemFont.getFontData()[0];
                fd.setStyle(SWT.BOLD);
                textStyle.font = = new Font(Display.getDefault(), fd);

However, in my tree viewer, I don't see the bold font applied to my label.

Reproducible: Always
Comment 1 Felipe Heidrich CLA 2010-08-30 10:30:54 EDT
JFace bug ?
Comment 2 Hitesh CLA 2010-09-07 04:35:05 EDT
Works just fine on my Win-Xp system. Can you please paste a snippet that I could use to test the bug ?
Comment 3 Flannan Lo CLA 2010-09-07 10:46:11 EDT
Created attachment 178329 [details]
Code snippet that shows the problem.

This is a label provider I use for my tree viewer. I simplified it so that it will shows a label "Hello there!" in my tree viewer. The word "there" should have a yellow background color and bold font. However, in my tree viewer, I only see the yellow background. The text is not bold.
Comment 4 Flannan Lo CLA 2010-09-07 10:47:32 EDT
Created attachment 178330 [details]
A screen capture that shows the problem.
Comment 5 Hitesh CLA 2010-09-07 11:33:09 EDT
Created attachment 178334 [details]
ScreenShot on my system ;)

> Build Identifier: M20090211-1700
>
Above is an old build; please try this on the newer builds(I have been testing with 3.6 without any luck). The bug might have existed in 3.4 build and may have got fixed as a side-effect of another bug-fix.
Comment 6 Flannan Lo CLA 2010-09-07 16:29:17 EDT
Not reproducible in later Eclipse version.