Skip to content

Conversation

@ebourg
Copy link
Contributor

@ebourg ebourg commented Nov 9, 2020

Hi,

I noticed that subpixel text anti-aliasing doesn't work when the hint is set on the chart:

chart.setTextAntiAlias(RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);

With this hint the title and the values on the axis are anti-aliased with shades of gray and look blurry.

A workaround is to disable the buffering of the ChartPanel.

Another solution is to remove the Transparency.TRANSLUCENT parameter when creating the buffer, this is what this PR suggests.

@jfree
Copy link
Owner

jfree commented Nov 10, 2020

Which version of JFreeChart and Java are you using?

@ebourg
Copy link
Contributor Author

ebourg commented Nov 10, 2020

I've tested with the version 1.5.1 and the head of the master branch.

@raven2cz
Copy link

Just for information. If you are using HiDPI resolutions like 4k. The problem is not about text aliasing, similar disabling of chart buffering is very bad solution. In mainly, if you are using java11. The problem is in the swing directly.
The best solution which I found is old swing configuration which still works! Place this to the JVM environment (for example to /etc/environment)
_JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true'

@ebourg
Copy link
Contributor Author

ebourg commented Nov 10, 2020

I tried with Java 8 and 11 on Windows 10 with a standard 1920x1080, non scaled display. There was no difference with -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true, the subpixel anti-aliasing still doesn't work.

@jfree
Copy link
Owner

jfree commented Nov 10, 2020

Can you email me ([email protected]) a screenshot of what you see? Meanwhile I'm trying to figure out the original purpose of the translucent setting - it was useful in some context, but I don't recall exactly what.

@ebourg
Copy link
Contributor Author

ebourg commented Nov 10, 2020

This is with buffering enabled:

image

and this is with buffering disabled (or TRANSLUCENT removed):

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants