From b3051b2503582000d984164b41b72d650f638dc7 Mon Sep 17 00:00:00 2001 From: Sam Pottinger Date: Thu, 7 Nov 2019 11:09:35 -0800 Subject: [PATCH 1/2] Fix font size calculation issue in the editor console. Responding to https://github.com/processing/processing4/issues/19, there appears to be an issue with calculating the bounds of text inside JTextPane within EditorConsole for specific font family and size combinations. This may be related to https://bugs.openjdk.java.net/browse/JDK-8158370 or https://bugs.openjdk.java.net/browse/JDK-8156217 but resolves when changing Editor.LEFT_GUTTER from 45 to basically anything else. --- app/src/processing/app/ui/Editor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/processing/app/ui/Editor.java b/app/src/processing/app/ui/Editor.java index e71e1efeb..3effe0d2b 100644 --- a/app/src/processing/app/ui/Editor.java +++ b/app/src/processing/app/ui/Editor.java @@ -79,7 +79,7 @@ public abstract class Editor extends JFrame implements RunnerListener { protected EditorState state; protected Mode mode; - static public final int LEFT_GUTTER = Toolkit.zoom(44); + static public final int LEFT_GUTTER = Toolkit.zoom(45); static public final int RIGHT_GUTTER = Toolkit.zoom(12); static public final int GUTTER_MARGIN = Toolkit.zoom(3); From 1dafe1689722394793bdae5a2954cbe3484b4bc0 Mon Sep 17 00:00:00 2001 From: Sam Pottinger Date: Thu, 7 Nov 2019 11:15:28 -0800 Subject: [PATCH 2/2] Added comment about LEFT_GUTTER. Correcting an earlier comment in the git log, 45 seems to work for LEFT_GUTTER but not 44. --- app/src/processing/app/ui/Editor.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/processing/app/ui/Editor.java b/app/src/processing/app/ui/Editor.java index 3effe0d2b..83e30235b 100644 --- a/app/src/processing/app/ui/Editor.java +++ b/app/src/processing/app/ui/Editor.java @@ -79,7 +79,10 @@ public abstract class Editor extends JFrame implements RunnerListener { protected EditorState state; protected Mode mode; + // There may be certain gutter sizes which cause text bounds inside the console to be calculated incorrectly. 45 + // seems to work but change with caution. static public final int LEFT_GUTTER = Toolkit.zoom(45); + static public final int RIGHT_GUTTER = Toolkit.zoom(12); static public final int GUTTER_MARGIN = Toolkit.zoom(3);