Skip to content

Commit 55b4b73

Browse files
committed
Change font size, in Syntax text view, using StyleContext
1 parent 47bcb21 commit 55b4b73

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/org/zaproxy/zap/extension/httppanel/view/syntaxhighlight/HttpPanelSyntaxHighlightTextArea.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import javax.swing.text.DefaultHighlighter;
3535
import javax.swing.text.Highlighter;
3636
import javax.swing.text.Highlighter.HighlightPainter;
37+
import javax.swing.text.StyleContext;
3738

3839
import org.apache.commons.configuration.FileConfiguration;
3940
import org.apache.log4j.Logger;
@@ -125,7 +126,8 @@ public HttpPanelSyntaxHighlightTextArea() {
125126
setClearWhitespaceLinesEnabled(false);
126127

127128
// Correct the font size
128-
this.setFont(FontUtils.getFont(this.getFont().getFontName()));
129+
StyleContext sc = StyleContext.getDefaultStyleContext();
130+
this.setFont(sc.getFont(getFont().getFamily(), getFont().getStyle(), FontUtils.getDefaultSize()));
129131

130132
initHighlighter();
131133
}

src/org/zaproxy/zap/utils/FontUtils.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,8 @@ public static float getScale() {
118118
}
119119
return scale;
120120
}
121+
122+
public static int getDefaultSize() {
123+
return getDefaultFont().getSize();
124+
}
121125
}

0 commit comments

Comments
 (0)