Changeset 8111 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2015-03-03T22:20:57+01:00 (5 years ago)
Author:
bastiK
Message:

fixed #11194 - Bangla script not rendered correctly on main map area

File:
1 edited

Legend:

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

    r8110 r8111  
    2626import java.awt.geom.Point2D;
    2727import java.awt.geom.Rectangle2D;
     28import java.text.Bidi;
    2829import java.util.ArrayList;
    2930import java.util.Collection;
     
    12041205
    12051206        FontRenderContext frc = g.getFontRenderContext();
    1206         GlyphVector gv = text.font.createGlyphVector(frc, name);
     1207        char[] chars = name.toCharArray();
     1208        int dirFlag = Bidi.DIRECTION_LEFT_TO_RIGHT;
     1209        if (Bidi.requiresBidi(chars, 0, chars.length)) {
     1210            Bidi bd = new Bidi(name, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT);
     1211            if (bd.isRightToLeft()) {
     1212                dirFlag = Bidi.DIRECTION_RIGHT_TO_LEFT;
     1213            }
     1214        }
     1215        // only works for text that is completely left-to-right or completely
     1216        // right-to-left, not bi-directional text
     1217        GlyphVector gv = text.font.layoutGlyphVector(frc, chars, 0, chars.length, dirFlag);
    12071218
    12081219        for (int i=0; i<gv.getNumGlyphs(); ++i) {
Note: See TracChangeset for help on using the changeset viewer.