Bug 531719 - [StyledText] Make StyledText#getFont(int style) public API
Summary: [StyledText] Make StyledText#getFont(int style) public API
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.8   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact: Mickael Istria CLA
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks:
 
Reported: 2018-02-27 03:24 EST by Angelo ZERR CLA
Modified: 2018-03-07 03:57 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Angelo ZERR CLA 2018-02-27 03:24:01 EST
The inlined line content annotation needs to redraw the first character where annotation 
is added and takes place by setting the GlyphMetrics width.

When the first character has bold, font italic, the draw of inlined annotation 
(see InlinedAnnotationDrawingStrategy) needs to get the Font StyledText as bold.

Today StyledTextRenderer#getFont(int style) manage that in her class. It should be very cool if StyledText 
could expose the StyledText#getFont(int style) like this:

----------------------------------------------------------
/**
 * Returns the font according the specified <code>style</code> that the receiver will use to paint textual information.
 *
 * @param style the style of Font widget to get.
 * @return the receiver's font according the specified <code>style</code>
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 * @since 3.107
 */
public Font getFont(int style) {
	checkWidget ();
	return renderer.getFont(style);
}
----------------------------------------------------------
Comment 1 Eclipse Genie CLA 2018-03-01 05:46:51 EST
New Gerrit change created: https://git.eclipse.org/r/118409
Comment 2 Angelo ZERR CLA 2018-03-01 16:31:29 EST
@Mickael is there any chance that you review this very simple gerrit patch?

I need this feature for several things:

 * fix font problem with line content annotation (as the character after GlyphMetrics is redrawn) (ex: 'true' in Java Editor appears 't' with non bold and 'rue'  as bold). With this API I could get the bold font and fix this problem.
 * I would like by default display line header mining in italic.
Comment 3 Angelo ZERR CLA 2018-03-06 17:19:08 EST
@Mickael is there any chance that you review this gerrit patch, please?

Thanks!
Comment 4 Mickael Istria CLA 2018-03-07 03:57:45 EST
This is a workaround to allow better redraw, which itself is a workaround used because of lack of GlyphMetrics "margin" concept ( bug 531769 ). I don't want to introduce new API because of a workaround. Please copy paste the necessary code instead and mention in a comment that it's a workaround for bug 531769, copied from StyledTextRenderer, that should be replaced by a more proper solution when bug 531769 is fixed.