Skip to content

Commit 8fb68c9

Browse files
committed
[FIX] No fallback font used in table editor
Fixes #145
1 parent cde3f71 commit 8fb68c9

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

CHANGELOG

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2.6.2
2+
Aug 09, 2019
3+
4+
FIX: AssertionError: Already disposed: Project (Disposed) #147
5+
FIX: No fallback font used in table editor #145
6+
17
2.6.1
28
Aug 01, 2019
39

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# https://www.jetbrains.com/intellij-repository/snapshots
44

55
name='CSV Plugin'
6-
pluginVersion=2.6.1
6+
pluginVersion=2.6.2
77
javaVersion=1.8
88
javaTargetVersion=1.8
99
downloadIntellijSources=false

src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/CsvTableEditor.java

+12-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.intellij.openapi.fileEditor.*;
1212
import com.intellij.openapi.project.Project;
1313
import com.intellij.openapi.util.Key;
14+
import com.intellij.openapi.util.SystemInfo;
1415
import com.intellij.openapi.util.UserDataHolder;
1516
import com.intellij.openapi.util.UserDataHolderBase;
1617
import com.intellij.openapi.vfs.ReadonlyStatusHandler;
@@ -30,6 +31,8 @@
3031
import org.jetbrains.annotations.Nullable;
3132

3233
import javax.swing.*;
34+
import javax.swing.plaf.FontUIResource;
35+
import javax.swing.text.StyleContext;
3336
import java.awt.*;
3437
import java.beans.PropertyChangeListener;
3538
import java.beans.PropertyChangeSupport;
@@ -320,7 +323,15 @@ public final int getRowCount() {
320323
}
321324

322325
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);
324335
}
325336

326337
protected int getStringWidth(String text) {

src/main/resources/META-INF/plugin.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646

4747
<change-notes><![CDATA[
4848
<pre style="font-family: sans-serif">
49-
NEW: plugin logo icons added (Thx to FineVisuals for support)
49+
FIX: AssertionError: Already disposed Project #147
50+
FIX: No fallback font used in table editor #145
5051
</pre>
5152
]]>
5253
</change-notes>

0 commit comments

Comments
 (0)