diff --git a/app/src/cc/arduino/ConsoleOutputStream.java b/app/src/cc/arduino/ConsoleOutputStream.java index 452c190b4..6334f11e7 100644 --- a/app/src/cc/arduino/ConsoleOutputStream.java +++ b/app/src/cc/arduino/ConsoleOutputStream.java @@ -52,7 +52,7 @@ import java.io.PrintStream; */ public class ConsoleOutputStream extends ByteArrayOutputStream { - private final SimpleAttributeSet attributes; + private SimpleAttributeSet attributes; private final PrintStream printStream; private final Timer timer; @@ -73,6 +73,10 @@ public class ConsoleOutputStream extends ByteArrayOutputStream { timer.setRepeats(false); } + public void setAttibutes(SimpleAttributeSet attributes) { + this.attributes = attributes; + } + public void setCurrentEditorConsole(EditorConsole console) { this.editorConsole = console; } diff --git a/app/src/processing/app/Editor.java b/app/src/processing/app/Editor.java index 05fd31103..22212bd2a 100644 --- a/app/src/processing/app/Editor.java +++ b/app/src/processing/app/Editor.java @@ -480,8 +480,10 @@ public class Editor extends JFrame implements RunnerListener { boolean external = PreferencesData.getBoolean("editor.external"); saveMenuItem.setEnabled(!external); saveAsMenuItem.setEnabled(!external); - for (EditorTab tab: tabs) + for (EditorTab tab: tabs) { tab.applyPreferences(); + } + console.applyPreferences(); } diff --git a/app/src/processing/app/EditorConsole.java b/app/src/processing/app/EditorConsole.java index b32382354..f656798f0 100644 --- a/app/src/processing/app/EditorConsole.java +++ b/app/src/processing/app/EditorConsole.java @@ -58,6 +58,9 @@ public class EditorConsole extends JScrollPane { private final DefaultStyledDocument document; private final JTextPane consoleTextPane; + private SimpleAttributeSet stdOutStyle; + private SimpleAttributeSet stdErrStyle; + public EditorConsole() { document = new DefaultStyledDocument(); @@ -74,7 +77,7 @@ public class EditorConsole extends JScrollPane { Font editorFont = PreferencesData.getFont("editor.font"); Font actualFont = new Font(consoleFont.getName(), consoleFont.getStyle(), scale(editorFont.getSize())); - SimpleAttributeSet stdOutStyle = new SimpleAttributeSet(); + stdOutStyle = new SimpleAttributeSet(); StyleConstants.setForeground(stdOutStyle, Theme.getColor("console.output.color")); StyleConstants.setBackground(stdOutStyle, backgroundColour); StyleConstants.setFontSize(stdOutStyle, actualFont.getSize()); @@ -84,7 +87,7 @@ public class EditorConsole extends JScrollPane { consoleTextPane.setParagraphAttributes(stdOutStyle, true); - SimpleAttributeSet stdErrStyle = new SimpleAttributeSet(); + stdErrStyle = new SimpleAttributeSet(); StyleConstants.setForeground(stdErrStyle, Theme.getColor("console.error.color")); StyleConstants.setBackground(stdErrStyle, backgroundColour); StyleConstants.setFontSize(stdErrStyle, actualFont.getSize()); @@ -109,6 +112,18 @@ public class EditorConsole extends JScrollPane { EditorConsole.init(stdOutStyle, System.out, stdErrStyle, System.err); } + public void applyPreferences() { + Font consoleFont = Theme.getFont("console.font"); + Font editorFont = PreferencesData.getFont("editor.font"); + Font actualFont = new Font(consoleFont.getName(), consoleFont.getStyle(), scale(editorFont.getSize())); + + StyleConstants.setFontSize(stdOutStyle, actualFont.getSize()); + StyleConstants.setFontSize(stdErrStyle, actualFont.getSize()); + + out.setAttibutes(stdOutStyle); + err.setAttibutes(stdErrStyle); + } + public void clear() { try { document.remove(0, document.getLength());