Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting LCD gamma / contrast (IntelliJ IDEA, JDK 8)

I am having trouble with anti-aliased text in IntelliJ IDEA. That thing for some reason ships with its own version of OpenJDK 8. Anyway... sub-pixel aliasing is acceptable with dark-on-bright text:

enter image description here

But the gamma is wrong for bright-on-dark text:

enter image description here

Which means in this scheme, text looks as if it was bold-face and horizontally smeared/fuzzy.

Is it possible to specify a system property or hack the system otherwise to change the gamma for AA interpolation towards darker colours? I already choose a very fine font (FicaCode Light), there is simply no font that shows less bold on this computer (Linux with Gnome 3, 1920x1080 display).


Edit: I am really looking for a way to control the AA gamma. I have not used IDEA 2017.1 EAP, but the release version which comes already with the 'fixed' bundled tuned version 1.8.0_112, that is mentioned in the gist comment. If I download that version, I get exactly the same pixel output as the two images above. These are the idea64.jvmoptions:

custom IntelliJ IDEA VM options

-Xms128m
-Xmx750m
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-Dawt.useSystemAAFontSettings=lcd
-Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine
-Djava2d.font.loadFontConf=false

Adding or removing the last property simply makes zero difference, also changing from lcd to on or off has zero effect.

Compare these pictures to the regular OpenJDK 1.8.0_121 that I installed via Debian:

enter image description here

Clearly here the AA is broken (at 1:1 it looks totally coloured). So I think the subpixel rendering of the bundled version is basically correct. Only it uses the wrong gamma for light text on dark background.


Edit: After more investigation, the problem boils down to this: I can use a custom font.conf file with hintstyle between hintslight, hintmedium and hintfull. For slight hinting, the font looks balanced in terms of aspect ratio, but the anti-aliasing has wrong gamma, and so the font lines are thick (everything looks bold face). For medium or full hinting, the font appears more thin-lined and sharp, but now the aspect ratio is broken, the font is too wide.

like image 432
0__ Avatar asked Mar 29 '17 12:03

0__


2 Answers

You said that the normal openJDK works the way you want him to work, correct?

If true, Why don't you change the JDK IntelliJ use? I believe it is platform SDK in preferences.

like image 127
Deian Avatar answered Oct 19 '22 07:10

Deian


FWIW, although zooming into the current rendering (IC 2020.3) looks similar to the original screenshot:

enter image description here

I no longer feel this looks too bold or blurry. Perhaps it's the slight change of font (using JetBrains Mono now).

like image 36
0__ Avatar answered Oct 19 '22 06:10

0__