|
11 | 11 | import com.intellij.openapi.fileEditor.*; |
12 | 12 | import com.intellij.openapi.project.Project; |
13 | 13 | import com.intellij.openapi.util.Key; |
| 14 | +import com.intellij.openapi.util.SystemInfo; |
14 | 15 | import com.intellij.openapi.util.UserDataHolder; |
15 | 16 | import com.intellij.openapi.util.UserDataHolderBase; |
16 | 17 | import com.intellij.openapi.vfs.ReadonlyStatusHandler; |
|
30 | 31 | import org.jetbrains.annotations.Nullable; |
31 | 32 |
|
32 | 33 | import javax.swing.*; |
| 34 | +import javax.swing.plaf.FontUIResource; |
| 35 | +import javax.swing.text.StyleContext; |
33 | 36 | import java.awt.*; |
34 | 37 | import java.beans.PropertyChangeListener; |
35 | 38 | import java.beans.PropertyChangeSupport; |
@@ -320,7 +323,15 @@ public final int getRowCount() { |
320 | 323 | } |
321 | 324 |
|
322 | 325 | public Font getFont() { |
323 | | - return EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN); |
| 326 | + // the one-liner to be used requires 172.2465.6 - compatibility |
| 327 | + // return UIUtil.getFontWithFallback(EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN)); |
| 328 | + |
| 329 | + Font font = EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN); |
| 330 | + String familyName = font.getFamily(); |
| 331 | + int style = font.getStyle(); |
| 332 | + int size = font.getSize(); |
| 333 | + Font fontWithFallback = SystemInfo.isMac ? new Font(familyName, style, size) : (new StyleContext()).getFont(familyName, style, size); |
| 334 | + return fontWithFallback instanceof FontUIResource ? (FontUIResource)fontWithFallback : new FontUIResource(fontWithFallback); |
324 | 335 | } |
325 | 336 |
|
326 | 337 | protected int getStringWidth(String text) { |
|
0 commit comments