Skip to content

Commit

Permalink
Change font size, in Syntax text view, using StyleContext
Browse files Browse the repository at this point in the history
  • Loading branch information
thc202 committed Jan 3, 2016
1 parent 47bcb21 commit 55b4b73
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import javax.swing.text.DefaultHighlighter;
import javax.swing.text.Highlighter;
import javax.swing.text.Highlighter.HighlightPainter;
import javax.swing.text.StyleContext;

import org.apache.commons.configuration.FileConfiguration;
import org.apache.log4j.Logger;
Expand Down Expand Up @@ -125,7 +126,8 @@ public HttpPanelSyntaxHighlightTextArea() {
setClearWhitespaceLinesEnabled(false);

// Correct the font size
this.setFont(FontUtils.getFont(this.getFont().getFontName()));
StyleContext sc = StyleContext.getDefaultStyleContext();
this.setFont(sc.getFont(getFont().getFamily(), getFont().getStyle(), FontUtils.getDefaultSize()));

initHighlighter();
}
Expand Down
4 changes: 4 additions & 0 deletions src/org/zaproxy/zap/utils/FontUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,8 @@ public static float getScale() {
}
return scale;
}

public static int getDefaultSize() {
return getDefaultFont().getSize();
}
}

0 comments on commit 55b4b73

Please sign in to comment.