diff --git a/megamek/i18n/megamek/client/messages.properties b/megamek/i18n/megamek/client/messages.properties index 0e0f69b1413..336cddbb0f8 100644 --- a/megamek/i18n/megamek/client/messages.properties +++ b/megamek/i18n/megamek/client/messages.properties @@ -1289,6 +1289,7 @@ CommonSettingsDialog.playersRemainingToShow=Number of Players remaining to show CommonSettingsDialog.playersRemainingToShow.tooltip=set to 0 to turn off CommonSettingsDialog.protoMechUnitCodes=ProtoMech unit codes: CommonSettingsDialog.report=Report +CommonSettingsDialog.reportFontType=Report Font Type CommonSettingsDialog.reportKeywords=Report Keywords CommonSettingsDialog.reportPhases=Report Phases CommonSettingsDialog.seenby.Player=Player diff --git a/megamek/src/megamek/client/ui/swing/CommonSettingsDialog.java b/megamek/src/megamek/client/ui/swing/CommonSettingsDialog.java index 004a774b381..d9aea83697b 100644 --- a/megamek/src/megamek/client/ui/swing/CommonSettingsDialog.java +++ b/megamek/src/megamek/client/ui/swing/CommonSettingsDialog.java @@ -370,6 +370,7 @@ private void moveElement(DefaultListModel srcModel, int srcIndex, int trg private ColourSelectorButton csbReportSuccessColor; private ColourSelectorButton csbReportMissColor; private ColourSelectorButton csbReportInfoColor; + private JComboBox fontTypeChooserReportFont = new JComboBox<>(); private final JCheckBox showReportSprites = new JCheckBox(Messages.getString("CommonSettingsDialog.showReportSprites")); private ColourSelectorButton csbUnitOverviewTextShadowColor; @@ -1340,6 +1341,15 @@ private JPanel getReportPanel() { row.add(csbReportInfoColor); comps.add(row); + fontTypeChooserReportFont = new JComboBox<>(new Vector<>(FontHandler.getAvailableNonSymbolFonts())); + fontTypeChooserReportFont.setSelectedItem(GUIP.getReportFontType()); + + JLabel moveFontTypeLabel = new JLabel(Messages.getString("CommonSettingsDialog.reportFontType")); + row = new ArrayList<>(); + row.add(moveFontTypeLabel); + row.add(fontTypeChooserReportFont); + comps.add(row); + comps.add(checkboxEntry(showReportSprites, null)); showReportSprites.setSelected(GUIP.getMiniReportShowSprites()); @@ -2048,6 +2058,7 @@ protected void cancelAction() { csbReportSuccessColor.setColour(GUIP.getReportSuccessColor()); csbReportMissColor.setColour(GUIP.getReportMissColor()); csbReportInfoColor.setColour(GUIP.getReportInfoColor()); + fontTypeChooserReportFont.setSelectedItem(GUIP.getReportFontType()); showReportSprites.setSelected(GUIP.getMiniReportShowSprites()); csbUnitOverviewTextShadowColor.setColour(GUIP.getUnitOverviewTextShadowColor()); @@ -2524,6 +2535,7 @@ protected void okAction() { GUIP.setReportSuccessColor(csbReportSuccessColor.getColour()); GUIP.setReportMissColor(csbReportMissColor.getColour()); GUIP.setReportrInfoColo(csbReportInfoColor.getColour()); + GUIP.setReportFontType(fontTypeChooserReportFont.getSelectedItem().toString()); GUIP.setMiniReportShowSprites(showReportSprites.isSelected()); GUIP.setUnitOverviewTextShadowColor(csbUnitOverviewTextShadowColor.getColour()); diff --git a/megamek/src/megamek/client/ui/swing/GUIPreferences.java b/megamek/src/megamek/client/ui/swing/GUIPreferences.java index 332602e80e8..ab93457ad67 100644 --- a/megamek/src/megamek/client/ui/swing/GUIPreferences.java +++ b/megamek/src/megamek/client/ui/swing/GUIPreferences.java @@ -261,6 +261,7 @@ public class GUIPreferences extends PreferenceStoreProxy { public static final String MINI_REPORT_COLOR_SUCCESS = "MiniReportColorSuccess"; public static final String MINI_REPORT_COLOR_MISS = "MiniReportColorMiss"; public static final String MINI_REPORT_COLOR_INFO = "MiniReportColorInfo"; + public static final String MINI_REPORT_FONT_TYPE = "MiniReportFontType"; public static final String MINI_ROUND_REPORT_SPRITES = "MiniRoundReportSprites"; public static final String PLAYER_LIST_POS_X = "PlayerListPosX"; @@ -669,6 +670,7 @@ protected GUIPreferences() { setDefault(MINI_REPORT_COLOR_SUCCESS, new Color(0x008000)); setDefault(MINI_REPORT_COLOR_MISS, new Color(0x808080)); setDefault(MINI_REPORT_COLOR_INFO, new Color(0x0000FF)); + setDefault(MINI_REPORT_FONT_TYPE, "Segoe UI"); store.setDefault(MINI_ROUND_REPORT_SPRITES, true); store.setDefault(PLAYER_LIST_ENABLED, true); @@ -2808,6 +2810,10 @@ public Color getReportMissColor() { public Color getReportInfoColor() { return getColor(MINI_REPORT_COLOR_INFO); } + + public String getReportFontType() { + return getString(MINI_REPORT_FONT_TYPE); + } public int getUnitToolTipSeenByResolution() { return getInt(UNIT_TOOLTIP_SEENBYRESOLUTION); @@ -2929,6 +2935,10 @@ public void setReportMissColor(Color color) { public void setReportrInfoColo(Color color) { store.setValue(MINI_REPORT_COLOR_INFO, getColorString(color)); } + + public void setReportFontType(String font) { + store.setValue(MINI_REPORT_FONT_TYPE, font); + } public Color getPlanetaryConditionsColorTitle() { return getColor(PLANETARY_CONDITIONS_COLOR_TITLE); diff --git a/megamek/src/megamek/client/ui/swing/MiniReportDisplay.java b/megamek/src/megamek/client/ui/swing/MiniReportDisplay.java index c847adeca85..6beb2ab4cbc 100644 --- a/megamek/src/megamek/client/ui/swing/MiniReportDisplay.java +++ b/megamek/src/megamek/client/ui/swing/MiniReportDisplay.java @@ -415,6 +415,8 @@ public void preferenceChange(PreferenceChangeEvent e) { adaptToGUIScale(); } else if (e.getName().equals(GUIPreferences.WARNING_COLOR)) { adaptToGUIScale(); + } else if (e.getName().equals(GUIPreferences.MINI_REPORT_FONT_TYPE)) { + adaptToGUIScale(); } } } diff --git a/megamek/src/megamek/common/Report.java b/megamek/src/megamek/common/Report.java index e2949cacd66..30925b3b287 100755 --- a/megamek/src/megamek/common/Report.java +++ b/megamek/src/megamek/common/Report.java @@ -696,16 +696,16 @@ public static void setupStylesheet(JTextPane pane) { } public static void setupStylesheet(StyleSheet styleSheet) { - Font font = UIManager.getFont("Label.font"); + GUIPreferences GUIP = GUIPreferences.getInstance(); + Font font = new Font(GUIP.getReportFontType(), Font.PLAIN, UIUtil.FONT_SCALE1); int size = UIUtil.scaleForGUI(UIUtil.FONT_SCALE1); - GUIPreferences guip = GUIPreferences.getInstance(); styleSheet.addRule("pre { font-family: " + font.getFamily() + "; font-size: " + size + "pt; font-style:normal;}"); - styleSheet.addRule("a { color: " + hexColor(guip.getReportLinkColor()) + " }"); - styleSheet.addRule("span.warning { color: " + hexColor(guip.getWarningColor()) + " }"); - styleSheet.addRule("span.success { color: " + hexColor(guip.getReportSuccessColor()) + " }"); - styleSheet.addRule("span.miss { color: " + hexColor(guip.getReportMissColor()) + " }"); - styleSheet.addRule("span.info { color: " + hexColor(guip.getReportInfoColor()) + " }"); + styleSheet.addRule("a { color: " + hexColor(GUIP.getReportLinkColor()) + " }"); + styleSheet.addRule("span.warning { color: " + hexColor(GUIP.getWarningColor()) + " }"); + styleSheet.addRule("span.success { color: " + hexColor(GUIP.getReportSuccessColor()) + " }"); + styleSheet.addRule("span.miss { color: " + hexColor(GUIP.getReportMissColor()) + " }"); + styleSheet.addRule("span.info { color: " + hexColor(GUIP.getReportInfoColor()) + " }"); } public String span(String name, String text) {