Changeset 7478 in josm


Ignore:
Timestamp:
2014-08-31T17:49:56+02:00 (5 years ago)
Author:
bastiK
Message:

fixed #10446 - Strange Text all over display on Mac

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r7477 r7478  
    247247     *
    248248     * This bug has only been observed on Mac OS X, see #7841.
     249     *
     250     * After switch to Java 7, this test is a false positive on Mac OS X (see #10446),
     251     * i.e. it returns true, but the real rendering code does not require any special
     252     * handling.
     253     * It hasn't been further investigated why the test reports a wrong result in
     254     * this case, but the method has been changed to simply return false by default.
     255     * (This can be changed with a setting in the advanced preferences.)
    249256     *
    250      * @return true, if the GlyphVector double translation bug is present on
    251      * this System
     257     * @return false by default, but depends on the value of the advanced
     258     * preference glyph-bug=false|true|auto, where auto is the automatic detection
     259     * method which apparently no longer gives a useful result for Java 7.
    252260     */
    253261    public static boolean isGlyphVectorDoubleTranslationBug() {
    254262        if (IS_GLYPH_VECTOR_DOUBLE_TRANSLATION_BUG != null)
    255263            return IS_GLYPH_VECTOR_DOUBLE_TRANSLATION_BUG;
    256         String overridePref = Main.pref.get("glyph-bug", null);
    257         if (overridePref != null) {
     264        String overridePref = Main.pref.get("glyph-bug", "false");
     265        if ("auto".equals(overridePref)) {
     266            FontRenderContext frc = new FontRenderContext(null, false, false);
     267            Font font = new Font("Dialog", Font.PLAIN, 12);
     268            GlyphVector gv = font.createGlyphVector(frc, "x");
     269            gv.setGlyphTransform(0, AffineTransform.getTranslateInstance(1000, 1000));
     270            Shape shape = gv.getGlyphOutline(0);
     271            Main.trace("#10446: shape: "+shape.getBounds());
     272            // x is about 1000 on normal stystems and about 2000 when the bug occurs
     273            int x = shape.getBounds().x;
     274            IS_GLYPH_VECTOR_DOUBLE_TRANSLATION_BUG = x > 1500;
     275            return IS_GLYPH_VECTOR_DOUBLE_TRANSLATION_BUG;
     276        } else {
    258277            boolean override = Boolean.parseBoolean(overridePref);
    259             Main.info("Override glyph vector bug: set to value "+override);
    260278            IS_GLYPH_VECTOR_DOUBLE_TRANSLATION_BUG = override;
    261279            return IS_GLYPH_VECTOR_DOUBLE_TRANSLATION_BUG;
    262280        }
    263         FontRenderContext frc = new FontRenderContext(null, false, false);
    264         Font font = new Font("Dialog", Font.PLAIN, 12);
    265         GlyphVector gv = font.createGlyphVector(frc, "x");
    266         gv.setGlyphTransform(0, AffineTransform.getTranslateInstance(1000, 1000));
    267         Shape shape = gv.getGlyphOutline(0);
    268         Main.trace("#10446: shape: "+shape.getBounds());
    269         // x is about 1000 on normal stystems and about 2000 when the bug occurs
    270         int x = shape.getBounds().x;
    271         IS_GLYPH_VECTOR_DOUBLE_TRANSLATION_BUG = x > 1500;
    272         return IS_GLYPH_VECTOR_DOUBLE_TRANSLATION_BUG;
    273281    }
    274282
Note: See TracChangeset for help on using the changeset viewer.