don't use workaround for a Mac OS font display issue with JDK 1.8.0_60 or later - the issue is fixed there

This commit is contained in:
Dmitry Batrak
2015-10-07 17:09:22 +03:00
parent e6cf8c52eb
commit fb1a2e7662
2 changed files with 9 additions and 3 deletions
@@ -15,13 +15,13 @@
*/
package com.intellij.openapi.editor.impl;
import com.intellij.Patches;
import com.intellij.ide.ui.AntialiasingType;
import com.intellij.ide.ui.UISettings;
import com.intellij.ide.ui.UISettingsListener;
import com.intellij.openapi.application.ApplicationManager;
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;
@@ -111,7 +111,7 @@ public class ComplementaryFontsRegistry {
if (ApplicationManager.getApplication().isUnitTestMode()) {
ourFontNames.add("Monospaced");
} else {
if (SystemInfo.isMac) {
if (Patches.JDK_MAC_FONT_STYLE_BUG) {
fillStyledFontMap();
}
String[] fontNames = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
@@ -199,7 +199,7 @@ public class ComplementaryFontsRegistry {
@Nullable
private static FontInfo doGetFontAbleToDisplay(char c, int size, @JdkConstants.FontStyle int style, @NotNull String defaultFontFamily) {
synchronized (lock) {
if (SystemInfo.isMac && style > 0 && style < 4) {
if (Patches.JDK_MAC_FONT_STYLE_BUG && style > 0 && style < 4) {
Pair<String, Integer>[] replacement = ourStyledFontMap.get(defaultFontFamily);
if (replacement != null) {
defaultFontFamily = replacement[style].first;
@@ -129,4 +129,10 @@ public class Patches {
* See <a href="https://bugs.openjdk.java.net/browse/JDK-8042123">JDK-8042123</a>
*/
public static final boolean JDK_BUG_ID_8042123 = !SystemInfo.isJavaVersionAtLeast("1.8.0_40");
/**
* Older JDK versions could mistakenly use derived italics font, when genuine italics font was available in the system.
* The issue was fixed in JDK 1.8.0_60 as part of <a href="https://bugs.openjdk.java.net/browse/JDK-8064833">JDK-8064833</a>.
*/
public static final boolean JDK_MAC_FONT_STYLE_BUG = SystemInfo.isMac && !SystemInfo.isJavaVersionAtLeast("1.8.0_60");
}