Hi Everyone,

 

I'm not certain this is the right place to post this. Please let me know
I there is a more appropriate venue.

 

I will admit, up-front, that I am using iText in a non-standard way... I
am not using it to create or parse PDFs. I am only using the
CFFFontSubset class to subset the CFF table of a web font. Consequently,
I am not sure the problem I have found would ever surface when a
subsetted CFF is wrapped in a PDF.

 

That said, I have found an incompatibility between iText's CFF subsetter
and the rasterizer used in IE9 and Firefox 8.0 on Windows (the problem
is fixed in IE10). The bug is actually in Adobe's CFF rasterizer (this
nifty bit of code is licensed by MS and included in DirectWrite, and
therefore in IE). The nitty-gritty is that there is a bug in the CFF
rasterizer that causes problems parsing any operators after the FDArray
operator in a dictionary. The workaround, then, is to be sure the
FDArray is the last operator in the dictionary.

 

The implementation of this workaround in iText is quite simple. In class
com.itextpdf.text.pdf.CFFFontSubset I made the following change to the
CreateKeys method:

 

Old:

protected void CreateKeys(OffsetItem fdarrayRef,OffsetItem
fdselectRef,OffsetItem charsetRef,OffsetItem charstringsRef)

{

// create an FDArray key

OutputList.addLast(fdarrayRef);

OutputList.addLast(new UInt8Item((char)12));

OutputList.addLast(new UInt8Item((char)36));

// create an FDSelect key

OutputList.addLast(fdselectRef);

OutputList.addLast(new UInt8Item((char)12));

OutputList.addLast(new UInt8Item((char)37));

// create an charset key

OutputList.addLast(charsetRef);

OutputList.addLast(new UInt8Item((char)15));

// create a CharStrings key

OutputList.addLast(charstringsRef);

OutputList.addLast(new UInt8Item((char)17));

}

 

New:

protected void CreateKeys(OffsetItem fdarrayRef,OffsetItem
fdselectRef,OffsetItem charsetRef,OffsetItem charstringsRef)

{

// create an FDSelect key

OutputList.addLast(fdselectRef);

OutputList.addLast(new UInt8Item((char)12));

OutputList.addLast(new UInt8Item((char)37));

// create an charset key

OutputList.addLast(charsetRef);

OutputList.addLast(new UInt8Item((char)15));

// create a CharStrings key

OutputList.addLast(charstringsRef);

OutputList.addLast(new UInt8Item((char)17));

// create an FDArray key

OutputList.addLast(fdarrayRef);

OutputList.addLast(new UInt8Item((char)12));

OutputList.addLast(new UInt8Item((char)36));

}

 

Notice that I have just moved the creation of the FDArray key to the end
of the method.

 

Not sure if this will be beneficial to anyone, nonetheless I wanted to
document the incompatibility and the tested workaround.

 

Cheers,

Bill

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to