disable ligatures when non-JetBrains JRE is used (to prevent issues like IDEA-157347)

This commit is contained in:
Dmitry Batrak
2017-01-10 15:37:18 +03:00
parent 1f4c422a2d
commit 7812690c2e
3 changed files with 11 additions and 12 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,10 @@ import com.intellij.openapi.editor.colors.EditorColorsScheme;
import com.intellij.openapi.editor.colors.FontPreferences;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.ui.*;
import com.intellij.ui.DocumentAdapter;
import com.intellij.ui.FontComboBox;
import com.intellij.ui.FontInfoRenderer;
import com.intellij.ui.TooltipWithClickableLinks;
import com.intellij.ui.components.JBCheckBox;
import com.intellij.util.EventDispatcher;
import com.intellij.util.ui.JBUI;
@@ -98,7 +101,7 @@ public class FontOptions extends JPanel implements OptionsPanel{
ApplicationBundle.message("ligatures.jre.warning",
ApplicationNamesInfo.getInstance().getFullProductName())));
warningIcon.setBorder(JBUI.Borders.emptyLeft(5));
updateWarningIconVisibility(warningIcon);
warningIcon.setVisible(!SystemInfo.isJetbrainsJvm);
panel.add(warningIcon);
add(panel, "newline, sx 2");
@@ -185,15 +188,10 @@ public class FontOptions extends JPanel implements OptionsPanel{
});
myEnableLigaturesCheckbox.addActionListener(e -> {
getFontPreferences().setUseLigatures(myEnableLigaturesCheckbox.isSelected());
updateWarningIconVisibility(warningIcon);
updateDescription(true);
});
}
private void updateWarningIconVisibility(JLabel warningIcon) {
warningIcon.setVisible(!SystemInfo.isJetbrainsJvm && getFontPreferences().useLigatures());
}
private int getFontSizeFromField() {
try {
return Math.min(EditorFontsConstants.getMaxEditorFontSize(),
@@ -273,7 +271,7 @@ public class FontOptions extends JPanel implements OptionsPanel{
myEditorFontSizeField.setEnabled(!readOnly);
myUseSecondaryFontCheckbox.setEnabled(!readOnly);
myEnableLigaturesCheckbox.setEnabled(!readOnly);
myEnableLigaturesCheckbox.setEnabled(!readOnly && SystemInfo.isJetbrainsJvm);
myEnableLigaturesCheckbox.setSelected(fontPreferences.useLigatures());
myIsInSchemeChange = false;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.colors.FontPreferences;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.SystemInfo;
import gnu.trove.TIntHashSet;
import org.intellij.lang.annotations.JdkConstants;
import org.jetbrains.annotations.NonNls;
@@ -146,7 +147,7 @@ public class ComplementaryFontsRegistry {
FontRenderContext context) {
boolean tryDefaultFont = true;
List<String> fontFamilies = preferences.getEffectiveFontFamilies();
boolean useLigatures = preferences.useLigatures();
boolean useLigatures = SystemInfo.isJetbrainsJvm && preferences.useLigatures();
FontInfo result;
//noinspection ForLoopReplaceableByForEach
for (int i = 0, len = fontFamilies.size(); i < len; ++i) { // avoid foreach, it instantiates ArrayList$Itr, this traversal happens very often
@@ -534,7 +534,7 @@ checkbox.show.only.monospaced.fonts=Show only monospaced fonts
primary.font=Primary font:
secondary.font=Secondary font:
use.ligatures=Enable font ligatures
ligatures.jre.warning=<html>The JRE you are running {0} with might have<br>functional and performance issues related to ligatures support.<br>To avoid such issues, run {0} with <a href="https://confluence.jetbrains.com/display/IDEADEV/JetBrains+Runtime+Environment">JetBrains Runtime</a>.
ligatures.jre.warning=<html>The JRE you are running {0} with<br>is known to have performance issues<br>related to ligatures support.<br>Use <a href="https://confluence.jetbrains.com/display/IDEADEV/JetBrains+Runtime+Environment">JetBrains Runtime</a> instead to enable ligatures.
editbox.enter.tag.name=Enter tag name:
title.tag.name=Tag Name
title.xml=XML