int flagCount=1;
short x1 ;
Vector_Int rawFlags=new Vector_Int(50);
Vector_Int endPts=new Vector_Int(50);
Vector_Short XX=new Vector_Short(50);
Vector_Short Y=new Vector_Short(50);
//all endpoints
if(debug){
System.out.println("endPoints");
System.out.println("---------");
}
int lastPt=0;
for(int i=0;i<contourCount;i++){
lastPt=currentFontFile.getNextUint16();
if(debug)
System.out.println(i+" "+lastPt);
endPts.addElement(lastPt);
}
//allow for corrupted value with not enough entries
//ie customers3/ICG3Q03.pdf
if(currentFontFile.hasValuesLeft()){
/**Don;t comment out !!!!!!!!!
* needs to be read to advance pointer*/
int instructionLength=currentFontFile.getNextUint16();
int[] instructions=new int[instructionLength];
for(int i=0;i<instructionLength;i++)
instructions[i]=currentFontFile.getNextUint8();
if (depth < currentInstructionDepth)
this.instructions = instructions;
if(debug){
System.out.println("Instructions");
System.out.println("------------");
System.out.println("count="+instructionLength);
}
int count = lastPt+ 1;
int flag;
/**we read the flags (some can repeat)*/
for (int i = 0; i < count; i++) {
flag=currentFontFile.getNextUint8();
rawFlags.addElement(flag);
flagCount++;
if ((flag & 8) == 8) { //repeating flags
int repeatCount = currentFontFile.getNextUint8();
for (int r = 1; r <= repeatCount; r++) {
rawFlags.addElement(flag);
flagCount++;
}
i += repeatCount;
}
}
/**read the x values and set segment for complex glyph*/
for(int i=0;i<count;i++){
flag=rawFlags.elementAt(i);
//boolean twoByteValue=((flag & 2)==0);
if ((flag & 16) != 0) { //
if ((flag & 2) != 0) { //1 byte + value
x1=(short)currentFontFile.getNextUint8();
XX.addElement(x1);
}else{ //2 byte value - same as previous - ??? same X coord or value
XX.addElement((short)0);
}
} else {
if ((flag & 2) != 0){ //1 byte - value
x1=(short)-currentFontFile.getNextUint8();
XX.addElement(x1);
}else{ //signed 16 bit delta vector
x1=currentFontFile.getNextSignedInt16();
XX.addElement(x1);
}
}
}
/**read the y values*/
for(int i=0;i<count;i++){
flag=rawFlags.elementAt(i);
if ((flag & 32) != 0) {
if ((flag & 4) != 0) {
Y.addElement((short)currentFontFile.getNextUint8());
} else {
Y.addElement((short)0);
}
} else {
if ((flag & 4) != 0) {
Y.addElement((short)-currentFontFile.getNextUint8());
} else {
short val=currentFontFile.getNextSignedInt16();
Y.addElement(val);
}
}
}
/**
* calculate the points
*/
int endPtIndex = 0;
int x=0,y=0;
int[] flags=rawFlags.get();
int[] endPtsOfContours=endPts.get();
short[] XPoints=XX.get();
short[] YPoints=Y.get();
count=XPoints.length;
int[] pX=new int[count+2];