mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
enable ligatures for JDK 13+, text layout is faster there (using same logic as in JetBrains Runtime)
GitOrigin-RevId: b49fad2939e89eb3818cbf3252f0b8d296ecc648
This commit is contained in:
committed by
intellij-monorepo-bot
parent
475ef5297f
commit
dcf6c520dc
+7
-3
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.application.options.colors;
|
||||
|
||||
import com.intellij.Patches;
|
||||
import com.intellij.application.options.EditorFontsConstants;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.IdeTooltipManager;
|
||||
@@ -9,7 +10,6 @@ import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.colors.FontPreferences;
|
||||
import com.intellij.openapi.editor.colors.ModifiableFontPreferences;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.ui.DocumentAdapter;
|
||||
import com.intellij.ui.FontComboBox;
|
||||
import com.intellij.ui.FontInfoRenderer;
|
||||
@@ -125,7 +125,7 @@ public abstract class AbstractFontOptionsPanel extends JPanel implements Options
|
||||
ApplicationBundle.message("ligatures.jre.warning",
|
||||
ApplicationNamesInfo.getInstance().getFullProductName())));
|
||||
warningIcon.setBorder(JBUI.Borders.emptyLeft(5));
|
||||
warningIcon.setVisible(!SystemInfo.isJetBrainsJvm);
|
||||
warningIcon.setVisible(!areLigaturesAllowed());
|
||||
panel.add(warningIcon);
|
||||
c.gridx = 0;
|
||||
c.gridy = 4;
|
||||
@@ -322,12 +322,16 @@ public abstract class AbstractFontOptionsPanel extends JPanel implements Options
|
||||
myEditorFontSizeField.setEnabled(!readOnly);
|
||||
mySizeLabel.setEnabled(!readOnly);
|
||||
|
||||
myEnableLigaturesCheckbox.setEnabled(!readOnly && SystemInfo.isJetBrainsJvm);
|
||||
myEnableLigaturesCheckbox.setEnabled(!readOnly && areLigaturesAllowed());
|
||||
myEnableLigaturesCheckbox.setSelected(fontPreferences.useLigatures());
|
||||
|
||||
myIsInSchemeChange = false;
|
||||
}
|
||||
|
||||
private static boolean areLigaturesAllowed() {
|
||||
return !Patches.TEXT_LAYOUT_IS_SLOW;
|
||||
}
|
||||
|
||||
protected void updateCustomOptions() {
|
||||
}
|
||||
|
||||
|
||||
@@ -138,4 +138,9 @@ public class Patches {
|
||||
* Ultimately fixed by <a href="https://bugs.openjdk.java.net/browse/JDK-8147994">JDK-8147994</a>.
|
||||
*/
|
||||
public static final boolean JDK_BUG_ID_8147994 = !(SystemInfo.isMac || SystemInfo.isJavaVersionAtLeast(8, 0, 102));
|
||||
|
||||
/**
|
||||
* https://bugs.openjdk.java.net/browse/JDK-8220231
|
||||
*/
|
||||
public static final boolean TEXT_LAYOUT_IS_SLOW = !SystemInfo.isJetBrainsJvm && !SystemInfo.isJavaVersionAtLeast(13);
|
||||
}
|
||||
@@ -191,6 +191,10 @@ public class SystemInfo extends SystemInfoRt {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isJavaVersionAtLeast(int major) {
|
||||
return isJavaVersionAtLeast(major, 0, 0);
|
||||
}
|
||||
|
||||
public static boolean isJavaVersionAtLeast(int major, int minor, int update) {
|
||||
return JavaVersion.current().compareTo(JavaVersion.compose(major, minor, update, 0, false)) >= 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user