}
/**
* read all the key pairs for Glyphs
*/
PdfKeyPairsIterator keyPairs=CharProcs.getKeyPairsIterator();
String glyphKey,pKey;
PdfObject glyphObj;
while(keyPairs.hasMorePairs()){
glyphKey=keyPairs.getNextKeyAsString();
glyphObj=keyPairs.getNextValueAsDictionary();
Object diffValue=null;
if(diffLookup!=null){
pKey= StandardFonts.convertNumberToGlyph(glyphKey, containsHexNumbers, allNumbers);
diffValue=diffLookup.get(pKey);
}
//decode and store in array
if(glyphObj!=null && renderPage){
//decode and create graphic of glyph
T3Renderer glyphDisplay=new T3Display(0,false,20,objectStore);
glyphDisplay.setHiResImageForDisplayMode(hires);
glyphDisplay.setType3Glyph(glyphKey);
try{
glyphDecoder.setObjectValue(ValueTypes.DynamicVectorRenderer,glyphDisplay);
glyphDecoder.setDefaultColors(currentGraphicsState.getNonstrokeColor(),currentGraphicsState.getNonstrokeColor());
int renderX,renderY;
//if size is 1 we need to scale up so we can see
int factor=1;
double[] fontMatrix=pdfObject.getDoubleArray(PdfDictionary.FontMatrix);
if(fontMatrix!=null && fontMatrix[0]==1 && (fontMatrix[3]==1 || fontMatrix[3]==-1))
factor=10;
GraphicsState gs=new GraphicsState(0,0);
gs.CTM = new float[][]{{factor,0,0},
{0,factor,0},{0,0,1}
};
T3Size t3 = glyphDecoder.decodePageContent(glyphObj, gs);
renderX=t3.x;
renderY=t3.y;
//allow for rotated on page in case swapped
if(renderX==0 && renderY!=0){
renderX=t3.y;
renderY=t3.x;
}
T3Glyph glyph=new T3Glyph(glyphDisplay, renderX,renderY,glyphDecoder.ignoreColors,glyphKey);
glyph.setScaling(1f/factor);
otherKey=-1;
if(diffValue!=null){
key= (Integer) diffValue;
if(keyPairs.isNextKeyANumber())
otherKey=keyPairs.getNextKeyAsNumber();
}else
key=keyPairs.getNextKeyAsNumber();
glyphs.setT3Glyph(key,otherKey, glyph);
}catch(Exception e){
e.printStackTrace();
if(LogWriter.isOutput())
LogWriter.writeLog("Exception "+e+" is Type3 font code");
}
}
//roll on
keyPairs.nextPair();
}
isFontEmbedded = true;
}
}