diff --git a/apps/routerconsole/java/src/net/i2p/router/web/SummaryRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/SummaryRenderer.java index 68e62e05f..1f4ba8587 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/SummaryRenderer.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/SummaryRenderer.java @@ -46,8 +46,17 @@ class SummaryRenderer { private static final Color AREA_COLOR = new Color(100, 160, 200, 200); private static final Color LINE_COLOR = new Color(0, 30, 110, 255); private static final Color RESTART_BAR_COLOR = new Color(223, 13, 13, 255); - private static final String DEFAULT_FONT_NAME = System.getProperty("os.name").toLowerCase().contains("windows") ? + private static final boolean IS_WIN = SystemVersion.isWindows(); + private static final String DEFAULT_FONT_NAME = IS_WIN ? "Lucida Console" : "Monospaced"; + private static final String DEFAULT_TITLE_FONT_NAME = "Dialog"; + private static final String DEFAULT_LEGEND_FONT_NAME = "Dialog"; + private static final String PROP_FONT_MONO = "routerconsole.graphFont.unit"; + private static final String PROP_FONT_LEGEND = "routerconsole.graphFont.legend"; + private static final String PROP_FONT_TITLE = "routerconsole.graphFont.title"; + private static final int SIZE_MONO = 10; + private static final int SIZE_LEGEND = 10; + private static final int SIZE_TITLE = 13; public SummaryRenderer(I2PAppContext ctx, SummaryListener lsnr) { _log = ctx.logManager().getLog(SummaryRenderer.class); @@ -144,28 +153,30 @@ class SummaryRenderer { def.setColor(RrdGraphDef.COLOR_MGRID, MGRID_COLOR); def.setColor(RrdGraphDef.COLOR_FONT, FONT_COLOR); def.setColor(RrdGraphDef.COLOR_FRAME, FRAME_COLOR); - def.setFont(RrdGraphDef.FONTTAG_DEFAULT, new Font(DEFAULT_FONT_NAME, Font.PLAIN, 10)); - def.setFont(RrdGraphDef.FONTTAG_TITLE, new Font(DEFAULT_FONT_NAME, Font.PLAIN, 10)); - def.setFont(RrdGraphDef.FONTTAG_AXIS, new Font("Droid Sans Mono", Font.PLAIN, 10)); - def.setFont(RrdGraphDef.FONTTAG_UNIT, new Font(DEFAULT_FONT_NAME, Font.PLAIN, 10)); - def.setFont(RrdGraphDef.FONTTAG_LEGEND, new Font("Droid Sans Mono", Font.PLAIN, 10)); // improve text legibility String lang = Messages.getLanguage(_context); - Font small = def.getSmallFont(); - Font large = def.getLargeFont(); - if ("ar".equals(lang) || "jp".equals(lang) || ("zh".equals(lang) && !IS_WIN)) { - small = small.deriveFont(small.getSize2D() + 2.0f); - large = large.deriveFont(Font.PLAIN, large.getSize2D() + 3.0f); - } else { - // small = small.deriveFont(small.getSize2D() + 1.0f); - // if specified font family is missing, jrobin will use fallback - small = new Font("Droid Sans Mono", Font.PLAIN, 10); - // large = large.deriveFont(large.getSize2D() + 1.0f); - large = new Font("Droid Sans", Font.PLAIN, 13); + int smallSize = SIZE_MONO; + int legendSize = SIZE_LEGEND; + int largeSize = SIZE_TITLE; + if ("ar".equals(lang) || "ja".equals(lang) || ("zh".equals(lang) && !IS_WIN)) { + smallSize += 2; + legendSize += 2; + largeSize += 3; } - def.setSmallFont(small); - def.setLargeFont(large); + String ssmall = _context.getProperty(PROP_FONT_MONO, DEFAULT_FONT_NAME); + String slegend = _context.getProperty(PROP_FONT_LEGEND, DEFAULT_LEGEND_FONT_NAME); + String stitle = _context.getProperty(PROP_FONT_TITLE, DEFAULT_TITLE_FONT_NAME); + Font small = new Font(ssmall, Font.PLAIN, smallSize); + Font legnd = new Font(slegend, Font.PLAIN, legendSize); + Font large = new Font(stitle, Font.PLAIN, largeSize); + // DEFAULT is unused since we set all the others + def.setFont(RrdGraphDef.FONTTAG_DEFAULT, small); + // AXIS is unused, we do not set any axis labels + def.setFont(RrdGraphDef.FONTTAG_AXIS, small); + def.setFont(RrdGraphDef.FONTTAG_UNIT, small); + def.setFont(RrdGraphDef.FONTTAG_LEGEND, legnd); + def.setFont(RrdGraphDef.FONTTAG_TITLE, large); def.setTimeSpan(start/1000, end/1000); def.setMinValue(0d); @@ -247,13 +258,14 @@ class SummaryRenderer { long started = event.getKey().longValue(); if (started > start && started < end) { // String legend = _t("Restart") + ' ' + sdf.format(new Date(started)) + " UTC " + event.getValue() + "\\l"; - if ("ar".equals(lang)) { - String legend = _t("Restart") + ' ' + sdf.format(new Date(started)) + " - " + event.getValue() + "\\l"; - def.vrule(started / 1000, RESTART_BAR_COLOR, legend, 2.0f); + String legend; + if ("ar".equals(lang) || "fa".equals(lang) || "iw".equals(lang)) { + // RTL languages + legend = _t("Restart") + ' ' + sdf.format(new Date(started)) + " - " + event.getValue() + "\\l"; } else { - String legend = _t("Restart") + ' ' + sdf.format(new Date(started)) + " [" + event.getValue() + "]\\l"; - def.vrule(started / 1000, RESTART_BAR_COLOR, legend, 2.0f); + legend = _t("Restart") + ' ' + sdf.format(new Date(started)) + " [" + event.getValue() + "]\\l"; } + def.vrule(started / 1000, RESTART_BAR_COLOR, legend, 2.0f); } } def.comment(sdf.format(new Date(start)) + " — " + sdf.format(new Date(end)) + " UTC\\r"); @@ -322,8 +334,6 @@ class SummaryRenderer { } } - private static final boolean IS_WIN = SystemVersion.isWindows(); - /** translate a string */ private String _t(String s) { // the RRD font doesn't have zh chars, at least on my system diff --git a/history.txt b/history.txt index 57f645616..527f3301a 100644 --- a/history.txt +++ b/history.txt @@ -1,6 +1,15 @@ -2020-01-26 +2020-02-03 zzz + * Graphs: Clean up font setting, fix bugs (ticket #2684) + +2020-01-26 idk * changed many icons on both light and dark themes out for Feather equivalents. +2020-01-26 zzz + * Tunnels: Don't test ECIES-only tunnels + +2020-01-21 zzz + * SSU: Use same valid IP criteria for relay request and response + 2020-01-21 zzz * Ratchet: Randomize two high bits of Elligator2 encoding @@ -17,7 +26,7 @@ 2020-01-03 zzz * Console: - - Don't refresh bw graph unless enclosing sidebar refresh\is longer + - Don't refresh bw graph unless enclosing sidebar refresh is longer - Remove scroll-in-scroll for wrapper logs - Refactor the configstats js * i2psnark: diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 4e28a2c8d..c10128fe6 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 5; + public final static long BUILD = 6; /** for example "-test" */ public final static String EXTRA = "";