Ticket #20706: antialias_v2.patch

File antialias_v2.patch, 2.5 KB (added by nvarner, 4 years ago)
  • src/org/openstreetmap/josm/gui/MainApplication.java

     
    10301030        }
    10311031        // Disable automatic POST retry after 5 minutes, see #17882 / https://bugs.openjdk.java.net/browse/JDK-6382788
    10321032        Utils.updateSystemProperty("sun.net.http.retryPost", "false");
     1033        // Force text antialiasing, not including mappaint text
     1034        Utils.updateSystemProperty("awt.useSystemAAFontSettings", "on");
    10331035    }
    10341036
    10351037    /**
  • src/org/openstreetmap/josm/gui/widgets/JosmEditorPane.java

     
    33
    44import java.awt.Color;
    55import java.awt.Font;
     6import java.awt.Graphics;
     7import java.awt.Graphics2D;
     8import java.awt.RenderingHints;
    69import java.io.IOException;
    710import java.io.InputStream;
    811import java.net.URL;
     
    2124import org.openstreetmap.josm.tools.LanguageInfo;
    2225
    2326/**
    24  * Subclass of {@link JEditorPane} that adds a "native" context menu (cut/copy/paste/select all)
    25  * and effectively uses JOSM user agent when performing HTTP request in {@link #setPage(URL)} method.
     27 * Subclass of {@link JEditorPane} that adds a "native" context menu (cut/copy/paste/select all), forces text and bullet
     28 * point antialiasing based on user preferences, and effectively uses JOSM user agent when performing HTTP request in
     29 * {@link #setPage(URL)} method.
    2630 * @since 5886
    2731 */
    2832public class JosmEditorPane extends JEditorPane implements Destroyable {
     
    8690        return conn.getContent();
    8791    }
    8892
     93    @Override
     94    public void paintComponent(Graphics g) {
     95        // Force antialiasing within the JosmEditorPane for antialiased bullet points
     96        Graphics2D g2d = (Graphics2D) g.create();
     97        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
     98        g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
     99        super.paintComponent(g2d);
     100        g2d.dispose();
     101    }
     102
    89103    /**
    90104     * Adapts a {@link JEditorPane} to be used as a powerful replacement of {@link javax.swing.JLabel}.
    91105     * @param pane The editor pane to adapt