Blurry preview when using JavaFX

When the characters in the preview look blurry, while the editor shows sharp characters.

Symptom

When the preview of the AsciiDoc Plugin (usually on the right) is blurry: While the characters in the editor on the left look sharp, the characters in the preview on the right look blurry.

The following JetBrains ticket contains examples: IDEA-213110

Environment

This only happens when using the JavaFX preview. The current combinations seems to be:

  • Operating System Windows 10,
    JavaFX preview
    a high-resolution display with a fractional scaling (for example 125% or 175%),
    IntelliJ running on OpenJDK 8 / JetBrains Runtime 8

or

  • Operating System Linux (for example Fedora 31 Wayland),
    JavaFX preview
    a high-resolution display with scaling-factor 200% or more,
    IntelliJ running on OpenJDK or JetBrains Runtime (any version)

How do I fix this?

There are four alternatives to fix this:

Change to JCEF preview

This JCEF preview embeds a Chromium based browser in the IDE. As it supports high-resolution displays and is the preview technology recommended by JetBrains, follow the instructions in the chapter ‘JCEF Preview’ to activate it.

Configure option sun.java2d.uiScale.enabled

Apply the following steps:

  1. Go to Menu entry Help  Edit Custom VM Options…​

  2. Remove any previous set option containing sun.java2d.uiScale.enabled

  3. Add the following line to the options:

    -Dsun.java2d.uiScale.enabled=false
  4. Restart the IDE

Upgrade to JetBrains Runtime 11 for running the IDE

Use one of the following options:

  • Download IntelliJ (or PyCharm, WebStorm, etc.) with JetBrains Runtime 11 (JBR11). This is available from release 2019.1, and will be the default starting from 2019.2.
    When downloading click on the format (pre-populated with .EXE for Windows users) to select the JBR11 bundle from the download page.

  • Use the JetBrains Toolbox application to download the JBR11 version

Download a JetBrains Runtime using the “Choose Runtime” plugin

  • Install the plugin “Choose Runtime” as described in the JetBrains knowledge base “Selecting the JDK version the IDE will run under”.

  • Choose a runtime "jbrsdk-11_0_8-…​-x64-b944.34.tar.gz" or later and install it. The IDE will restart.

  • Go to the settings of the AsciiDoc plugin and check if the preview is set to “JCEF Browser” (recommended if available) or “JavaFX WebView”.

Help, preview is still blurry!

To have the maintainers investigate the issue, open a GitHub issue.