< prev index next >

src/java.desktop/share/classes/sun/font/StandardGlyphVector.java

Print this page

        

@@ -443,17 +443,23 @@
         ix *= 2;
         return new Point2D.Float(positions[ix], positions[ix + 1]);
     }
 
     public void setGlyphPosition(int ix, Point2D pos) {
+        if (ix < 0 || ix > glyphs.length) {
+            throw new IndexOutOfBoundsException("ix = " + ix);
+        }
+        
         initPositions();
 
         int ix2 = ix << 1;
         positions[ix2] = (float)pos.getX();
         positions[ix2 + 1] = (float)pos.getY();
 
+        if (ix < glyphs.length) {
         clearCaches(ix);
+        }           
         addFlags(FLAG_HAS_POSITION_ADJUSTMENTS);
     }
 
     public AffineTransform getGlyphTransform(int ix) {
         if (ix < 0 || ix >= glyphs.length) {
< prev index next >