Changeset 18751 in josm


Ignore:
Timestamp:
2023-06-13T18:29:55+02:00 (18 months ago)
Author:
taylor.smock
Message:

Fix #20850 and #22253: Font size in TextAreas is very small in Windows (patch by gaben, modified)

This is due to JDK-6396936: Windows LaF has an incorrect font for TextArea.font.
The bug will most likely never be fixed due to backwards compatibility concerns.

Modifications are as follows:

  • Move the workaround to be with other LaF workarounds
  • Ensure that LaF workarounds are applied by calling them after the LaF is set.
  • Add a check to the workaround to ensure that it will only be applied in known-bad configurations.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r18598 r18751  
    842842        PlatformManager.getPlatform().afterPrefStartupHook();
    843843
    844         applyWorkarounds();
    845 
    846844        FontsManager.initialize();
    847845
     
    914912        // Configure Look and feel before showing SplashScreen (#19290)
    915913        setupUIManager();
     914        // Then apply LaF workarounds
     915        applyLaFWorkarounds();
    916916        // MainFrame created before setting look and feel and not updated (#20771)
    917917        SwingUtilities.updateComponentTreeUI(mainFrame);
     
    10631063    }
    10641064
    1065     static void applyWorkarounds() {
     1065    /**
     1066     * Apply workarounds for LaF and platform specific issues. This must be called <i>after</i> the
     1067     * LaF is set.
     1068     */
     1069    static void applyLaFWorkarounds() {
    10661070        final String laf = UIManager.getLookAndFeel().getID();
    10671071        final int javaVersion = Utils.getJavaVersion();
     
    11011105        if ("Metal".equals(laf) && javaVersion >= 11 && javaVersion < 17) {
    11021106            UIManager.put("ToolTipUI", JosmMetalToolTipUI.class.getCanonicalName());
     1107        }
     1108
     1109        // See #20850. The upstream bug (JDK-6396936) is unlikely to ever be fixed due to potential compatibility
     1110        // issues. This affects Windows LaF only (includes Windows Classic, a sub-LaF of Windows LaF).
     1111        if ("Windows".equals(laf) && "Monospaced".equals(UIManager.getFont("TextArea.font").getFamily())) {
     1112            UIManager.put("TextArea.font", UIManager.getFont("TextField.font"));
    11031113        }
    11041114    }
Note: See TracChangeset for help on using the changeset viewer.