Intellij / OpenJDK 15 fonts are not crisp

I have OpenJDK 15 and Intellij 2020.2 Community installed. I removed my previous configuration and removed a deprecated GC option. After all of that, I am able to launch intellij, but the fonts are bold and not crisp, they're difficult to read. I tried changing vm options, but to no avail. Additionally, I noticed the fontconfig from OpenJDK15 is a bit different from OpenJDK8. Namely, it was pointing at non-existent paths for font directories. After copying the OpenJDK 8 fontconfig, I didn't see any improvement.

I have anti-aliasing and sub-pixel hinting enabled, I also tried installing urwfonts and truetype fonts, but that didn't make a change either. All of my other applications look good, even Libreoffice looks good.

If I uninstall OpenJDK15, and just use OpenJDK8, the fonts are crisp again. So, OpenJDK15 is doing something, but I cannot figure out what.
 
This is still an issue for me:

1646851440657.png


Basically, the fonts are pixelated and essentially bold.
 
1646869453499.png

Code:
% pkg info -x openjdk
openjdk11-11.0.14+9.1_1
openjdk11-jre-11.0.14+9.1_1
openjdk16-16.0.2+7.1_1
openjdk8-8.322.06.1
% pkg info -x intellij
intellij-2020.2.3
intellij-fsnotifier-20160221_6
% java -version
openjdk version "1.8.0_322"
OpenJDK Runtime Environment (build 1.8.0_322-b06)
OpenJDK 64-Bit Server VM (build 25.322-b06, mixed mode)
% pkg -vv | grep -e url -e enabled
    url             : "http://pkg0.bme.freebsd.org/FreeBSD:14:amd64/latest",
    enabled         : yes,
    url             : "https://alpha.pkgbase.live/current/FreeBSD:14:amd64/latest",
    enabled         : no,
    url             : "file:///usr/local/poudriere/data/packages/main-default",
    enabled         : yes,
% uname -aKU
FreeBSD mowa219-gjp4-8570p-freebsd 14.0-CURRENT FreeBSD 14.0-CURRENT #5 main-n253627-25375b1415f-dirty: Sat Mar  5 14:21:40 GMT 2022     root@mowa219-gjp4-8570p-freebsd:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG amd64 1400053 1400053
%

My memory of Java basics is rusty. If what's pictured is using the inferior version of OpenJDK, how I can I test with the superior version?
 
I cheated, I updated the symlink:

Code:
/usr/local/bin/java -> /usr/local/openjdk11/bin/java

I think there should be a more elegant way to set the preferred JDK, but this is what I'm doing presently. Note that Intellij can only run on up to JDK11, but not anything newer.
 
I have had that too on several machines. Turned out to be some DPI related issue. Unfortunately, I still don't really understand the DPI setup on *nix systems properly. Seems like there are several places such as Xorg itself, GTK and Qt. Even in Xorg itself there seem to be multiple places such as xorg.conf and ~/.Xresources - and potentially also via xrandr.
I'm sure all of this makes sense - Just one of the many thing I do not yet understand properly.

But maybe this information allows you to proceed with your investigations & experiments.
Please do share results.
 
Just some extra information: In my case the entire IDE GUI was blurry, not just the font(s) in the code editor. Changing the UI font/scale in the IntelliJ settings didn't affect this. Carefully choosing the value just made it more bearable.
 
Uh, I should also note that I compiled and am running the latest version of Intellij 2021.3.2 ... the patch is attached to a bug report somewhere. Let me remove that and install the vanilla (old) package.

EDIT:
The current package works just fine. The latest one is the one I'm having issues with 2021.3.2.
 
Setting JAVA_VERSION=1.8 in your environment would suffice (see javavm(1)).

… Note that Intellij can only run on up to JDK11, but not anything newer.

Noted:

Code:
% setenv JAVA_VERSION 11+
% echo $JAVA_VERSION
11+
% idea
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.intellij.util.ReflectionUtil to field sun.awt.X11.XToolkit.awtAppClassName
WARNING: Please consider reporting this to the maintainers of com.intellij.util.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2022-03-10 03:43:05,067 [  44488]   WARN - .diagnostic.PerformanceWatcher - UI was frozen for 30516ms, details saved to /home/grahamperrin/.cache/JetBrains/IdeaIC2020.2/log/threadDumps-freeze-20220310-034239-IC-202.7660.26-ProjectUiFrameAllocator.initNewFrame-30sec
2022-03-10 03:43:07,195 [  46616]   WARN - Container.ComponentManagerImpl - Do not use constructor injection (requestorClass=org.jetbrains.android.compose.AndroidComposeAutoDocumentation)
2022-03-10 03:43:08,424 [  47845]   WARN - tartup.impl.StartupManagerImpl - Activities registered via registerPostStartupActivity must be dumb-aware: org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerComponent$projectOpened$1@f5c43aa
2022-03-10 03:43:20,868 [  60289]   WARN - .diagnostic.PerformanceWatcher - UI was frozen for 11847ms, details saved to /home/grahamperrin/.cache/JetBrains/IdeaIC2020.2/log/threadDumps-freeze-20220310-034313-IC-202.7660.26-BaseComponentAdapter.getInstanceUncached-11sec
2022-03-10 03:43:26,465 [  65886]   WARN - com.intellij.util.xmlb.Binding - no accessors for org.jetbrains.kotlin.idea.highlighter.KotlinDefaultHighlightingSettingsProvider
2022-03-10 03:43:31,158 [  70579]   WARN - g.jetbrains.kotlin.idea.script - Default Script SDK is null: projectSdk = null, all sdks = 
2022-03-10 03:43:31,233 [  70654]   WARN - g.jetbrains.kotlin.idea.script - Default Script SDK is null: projectSdk = null, all sdks = 
2022-03-10 03:43:46,193 [  85614]   WARN - com.intellij.util.xmlb.Binding - no accessors for org.jetbrains.kotlin.idea.core.script.configuration.utils.ScriptClassRootsStorage
% setenv JAVA_VERSION 16+
% idea
Unrecognized VM option 'UseConcMarkSweepGC'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
%
 
I think there should be a more elegant way to set the preferred JDK, but this is what I'm doing presently. Note that Intellij can only run on up to JDK11, but not anything newer.

Note that you can set the JDK for IntelliJ with the IDEA_JDK environment variable, e.g.

~/.zshrc
Code:
# Set default JDK to OpenJDK17
export JAVA_HOME=/usr/local/openjdk17

# Set IntelliJ to use OpenJDK 11
export IDEA_JDK=/usr/local/openjdk11
 
Did you set _JAVA_OPTIONS and JAVA_FONTS variables in your environment ?
Mine are set like this :
Code:
# Antialiased fonts for Java
#
# _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=setting'
#
# Where setting is one of the values:
# Setting     Description
# off, false, default     No anti-aliasing
# on     Full anti-aliasing
# gasp     Use the font's built-in hinting instructions
# lcd, lcd_hrgb     Anti-aliasing tuned for many popular LCD monitors
# lcd_hbgr, lcd_vrgb, lcd_vbgr     Alternative LCD monitor setting
#
# The gasp and lcd settings work well in many instances.
#
# To optionally to use GTK look and feel, add the following line instead:
# _JAVA_OPTIONS='-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel'
#
_JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on'; export _JAVA_OPTIONS
JAVA_FONTS=/usr/local/share/fonts/TTF; export JAVA_FONTS
 
Setting java options and fonts had no effect for me in intellij. Additionally, intellij complained about doing that and suggested I set it in vmoptions, which I am checking.
 
Thanks for all of your help. I had to edit vmoptions as it said:

/usr/local/share/intellij/bin/idea.vmoptions:
Code:
-Dawt.useSystemAAFontSettings=on
-Dswing.aatext=true
-Dsun.java2d.xrender=true

/usr/local/share/intellij/bin/idea64.vmoptions:
Code:
-Dawt.useSystemAAFontSettings=on
-Dswing.aatext=true
-Dsun.java2d.xrender=true

It originally had -Dsun.java2d.xrender=true set to false. Now, it is usable, the term was font smoothing, I needed to look there.
 
Back
Top