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

Bug 164224

Summary: [StyledText] Ability To Turn Off Text Anti-aliasing for StyledText
Product: [Eclipse Project] Platform Reporter: Freddie Witherden <freddie>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED FIXED QA Contact: Felipe Heidrich <eclipse.felipe>
Severity: enhancement    
Priority: P3 CC: andre_weinand, daniel_megert, eclipse.felipe, heath.borders, ipun, Silenio_Quarti, snorthov
Version: 3.2.1Keywords: triaged
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Freddie Witherden CLA 2006-11-11 13:09:29 EST
On OS X Eclipse anti-aliases the text in the editor window. This not only looks bad (especially with monospace fonts) but also necessitates the use of a larger font size. This is because it is almost impossible to read anti aliased text at a size below around 10/11pt. All other editors do not do this, making it possible to use them with a much smaller font size than must be used with Eclipse.
Comment 1 Steve Northover CLA 2006-11-14 10:33:34 EST
There is a desktop setting that you can use to control this ('Turn off text smoothing for font sizes').

It is also possible to turn of anti-aliasing for string drawing at the GC level but no API exists to do this for StyledText.  If API were added to StyledText, then a preference would also need to be added to turn it on in the Eclipse UI.  This feature has been asked for in the past but I can't find the duplicate.  Moving to UI for consideration.
Comment 2 Dani Megert CLA 2006-11-15 02:57:11 EST
I have trouble parsing comment 1. What should Platform Text do with this PR if the API on StyledText isn't there yet?
Comment 3 Steve Northover CLA 2006-11-15 10:10:25 EST
We (as a group) need to decide whether we are going to support this feature.  If we decide "yes", then SWT will add the API to StyledText, Text can call it and UI (or whoever, Text still?) can make it an option somewhere in Eclipse.  We will not add the feature to SWT if nobody can get to it from the Eclipse UI.

Are we doing this?
Comment 4 Dani Megert CLA 2006-11-15 10:17:20 EST
I would be willing to add this to the 'Text Editors' preference page and offer it for textual editors.
Comment 5 Felipe Heidrich CLA 2006-11-15 15:59:05 EST
IMO this is a desktop preference, if the user doesn't like text AA he disables the feature for the desktop as a whole. The widget should not be able to override this preference.

On windows you can use clear type tunner:
http://www.microsoft.com/typography/ClearTypePowerToy.mspx
On gnome you can use gnome-font-properties
On mac, system preference -> appereance -> font smoothing style
Comment 6 Freddie Witherden CLA 2006-11-15 16:13:43 EST
(In reply to comment #5)
> IMO this is a desktop preference, if the user doesn't like text AA he disables
> the feature for the desktop as a whole. The widget should not be able to
> override this preference.
> 
> On windows you can use clear type tunner:
> http://www.microsoft.com/typography/ClearTypePowerToy.mspx
> On gnome you can use gnome-font-properties
> On mac, system preference -> appereance -> font smoothing style
> 

I have a tendency to disagree, as on OS X you need to keep text anti-aliasing on for font sizes 9 and greater (or turn off font smoothing for sizes 8 and smaller as it is written in the preferences window), or things break, applications depend on the font smoothing for their UIs. Turn it off and fonts throughout the system become hard to read in many applications.

The widget should have every right to override this preference, as do the widgets in Xcode, subetha edit and countless other editors. It is mainly because monospace fonts (at least some of them) do not respond well to AA, while normal (variable width) fonts do, at the same point sizes look fine with AA on.

There is no 'one-size-fits-all' solution to this problem at the OS level, and it would seem logical to me to allow the user to exercise discretion when it comes to choosing if they want their code font anti aliased (some work, but others, like monaco do not, compare Eclipse and Xcode at the same point sizes with the font monaco and choose for yourself).

Regards, Freddie.
Comment 7 Dani Megert CLA 2006-11-16 02:23:15 EST
André, what's your take on this?
Comment 8 Andre Weinand CLA 2006-11-16 05:55:00 EST
+1 on comment #6: IMO it is not a desktop setting, so Eclipse has to provide support for it.
Comment 9 Felipe Heidrich CLA 2006-11-16 11:50:53 EST
I could not find this option in Xcode or Visual Studio 2005.
On Windows Presentation Foundation you can not disable Anti-aliasing 
(http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=565101&SiteID=1).
If I am not wrong Carbon also doesn't have API to disable AA.
I changed StyledText to call gc.setTextAntialias(SWT.OFF); before drawing text and it failed on win32, gtk, and carbon.

SSQ, Carbon has flag you can set to disable AA for small fonts, don't we set this flag already ?
Comment 10 Silenio Quarti CLA 2006-11-16 12:03:25 EST
>I changed StyledText to call gc.setTextAntialias(SWT.OFF); before drawing text
>and it failed on win32, gtk, and carbon.

I am not sure why this API is not working (my guess it is because all drawing in StyledText goes through TextLayout which is not checking that attribute). But if we use it, GC will turn into advanced mode, which can cause a lot of problems (including bad performance). 

>SSQ, Carbon has flag you can set to disable AA for small fonts, don't we set
>this flag already ?

What is the flag (API)?
Comment 11 Steve Northover CLA 2006-11-16 12:07:31 EST
We need to fix the bug that this is not working (or enter a new bug report to capture this.  Is Xcode anti-aliased or not?
Comment 12 Andre Weinand CLA 2006-11-16 12:15:44 EST
Xcode does not antialias text in the source code editor but everywhere else.
Comment 13 Dani Megert CLA 2006-11-17 02:00:33 EST
Moving to SWT to implement this. Will add preference once it is available.
Comment 14 Dani Megert CLA 2006-11-17 02:08:10 EST
>I changed StyledText to call gc.setTextAntialias(SWT.OFF); before drawing text
>and it failed on win32, gtk, and carbon.
Filed bug 164928 to track this.

>On Windows Presentation Foundation you can not disable Anti-aliasing 
>(http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=565101&SiteID=1).
Does this mean we'd have to add a preference which states that it might not work?

Instead of adding a preference, could we do the same as Xcode and always disable AA on Mac - or make it font (size) dependent?
Comment 15 Steve Northover CLA 2008-08-15 14:56:46 EDT
The bug in comment #11 is fixed.
Comment 16 Felipe Heidrich CLA 2009-08-14 08:54:46 EDT
Your bug has been moved to triage, visit http://www.eclipse.org/swt/triage.php for more info.
Comment 17 Ian Pun CLA 2017-06-22 14:16:27 EDT
Hi whats the status of this bug? From the looks of it, the bug being tracked was from comment 11 ( bug 164928 ) and that seems to be fixed. I will close this bug in a week if there are no objections.
Comment 18 Ian Pun CLA 2017-07-24 16:06:27 EDT
Closed as to no objections.