private void interpolateUntouchedPoints(final int direction){
  final int[] points;
  final int[] original;
  final boolean[] touched=new boolean[this.touched[GLYPH_ZONE].length];
  if (direction == IUPx) {
    points=x[GLYPH_ZONE];
    original=x[ORIGINAL + GLYPH_ZONE];
    for (int i=0; i < this.touched[GLYPH_ZONE].length; i++) {
      touched[i]=this.touched[GLYPH_ZONE][i][0];
    }
  }
 else {
    points=y[GLYPH_ZONE];
    original=y[ORIGINAL + GLYPH_ZONE];
    for (int i=0; i < this.touched[GLYPH_ZONE].length; i++) {
      touched[i]=this.touched[GLYPH_ZONE][i][1];
    }
  }
  int contourStart=0;
  while (contourStart < points.length) {
    final int[] touchedPointNumbers=new int[original.length];
    int touchedCount=0, point=0;
    do {
      if (touched[contourStart + point]) {
        touchedPointNumbers[touchedCount]=contourStart + point;
        touchedCount++;
      }
      point++;
    }
 while (!contour[GLYPH_ZONE][contourStart + point - 1] && (contourStart + point) < contour[GLYPH_ZONE].length);
    if (touchedCount == 1) {
      final int shift=points[touchedPointNumbers[0]] - original[touchedPointNumbers[0]];
      for (int i=contourStart; i < contourStart + point; i++) {
        if (!touched[i]) {
          points[i]+=shift;
        }
      }
    }
 else     if (touchedCount > 1) {
      for (int i=0; i < touchedCount; i++) {
        if (i + 1 >= touchedCount) {
          interpolateRange(touchedPointNumbers[i] + 1,contourStart + point - 1,touchedPointNumbers[i],touchedPointNumbers[0],points,original);
          interpolateRange(contourStart,touchedPointNumbers[0] - 1,touchedPointNumbers[i],touchedPointNumbers[0],points,original);
        }
 else {
          interpolateRange(touchedPointNumbers[i] + 1,touchedPointNumbers[i + 1] - 1,touchedPointNumbers[i],touchedPointNumbers[i + 1],points,original);
        }
      }
    }
    contourStart+=point;
  }
}

private void interpolateUntouchedPoints ( final int direction ) { final int [ ] points ; final int [ ] original ; final boolean [ ] touched = new boolean [ this . touched [ GLYPH_ZONE ] . length ] ; if ( direction == IUPx ) { points = x [ GLYPH_ZONE ] ; original = x [ ORIGINAL + GLYPH_ZONE ] ; for ( int i = 0 ; i < this . touched [ GLYPH_ZONE ] . length ; i ++ ) { touched [ i ] = this . touched [ GLYPH_ZONE ] [ i ] [ 0 ] ; } } else { points = y [ GLYPH_ZONE ] ; original = y [ ORIGINAL + GLYPH_ZONE ] ; for ( int i = 0 ; i < this . touched [ GLYPH_ZONE ] . length ; i ++ ) { touched [ i ] = this . touched [ GLYPH_ZONE ] [ i ] [ 1 ] ; } } int contourStart = 0 ; while ( contourStart < points . length ) { final int [ ] touchedPointNumbers = new int [ original . length ] ; int touchedCount = 0 , point = 0 ; do { if ( touched [ contourStart + point ] ) { touchedPointNumbers [ touchedCount ] = contourStart + point ; touchedCount ++ ; } point ++ ; } while ( ! contour [ GLYPH_ZONE ] [ contourStart + point - 1 ] && ( contourStart + point ) < contour [ GLYPH_ZONE ] . length ) ; if ( touchedCount == 1 ) { final int shift = points [ touchedPointNumbers [ 0 ] ] - original [ touchedPointNumbers [ 0 ] ] ; for ( int i = contourStart ; i < contourStart + point ; i ++ ) { if ( ! touched [ i ] ) { points [ i ] += shift ; } } } else if ( touchedCount > 1 ) { for ( int i = 0 ; i < touchedCount ; i ++ ) { if ( i + 1 >= touchedCount ) { interpolateRange ( touchedPointNumbers [ i ] + 1 , contourStart + point - 1 , touchedPointNumbers [ i ] , touchedPointNumbers [ 0 ] , points , original ) ; interpolateRange ( contourStart , touchedPointNumbers [ 0 ] - 1 , touchedPointNumbers [ i ] , touchedPointNumbers [ 0 ] , points , original ) ; } else { interpolateRange ( touchedPointNumbers [ i ] + 1 , touchedPointNumbers [ i + 1 ] - 1 , touchedPointNumbers [ i ] , touchedPointNumbers [ i + 1 ] , points , original ) ; } } } contourStart += point ; } }
goes through the glyph contour by contour finding pairs of touched points and moving the points between them to preserve the shape of the original outline .
