Hi,

There is a problem with using PDFGraphics2D on the Mac , which throws an 
exception when setRenderingHint() is called with a certain value; the message 
of the exception thrown is:
"null incompatible with Text-specific antialiasing 
enable key."

This has been mentioned on this list before, I believe. A simple fix for this 
would be to add a try-catch block to the setRenderingHint() method in 
PdfGraphics2D.

However, let's assume that there is a reason not to put in the abovementioned 
try-catch block into PdfGraphics2D, so that this solution is inadmissible.

Then, the logical solution would be for the user to extend PdfGraphics2D and 
override the setRenderingHint() method. However, the way PdfGraphics2D is 
written makes this impossible. The only visible constructor:

PdfGraphics2D(PdfContentByte cb, float width, float height, FontMapper 
fontMapper, boolean onlyShapes, boolean convertImagesToJPEG, float quality) 

is package private, implying that a subclass must also be in the package
com.lowagie.text.pdf

Even if you create a subclass in this package, it still doesn't work, because 
the method
create() 
also has to be overwritten to return an object of the subclass type, and the 
no argument constructor is private. Further, the create method uses a number 
of private variables that the subclass has no access to.

A gross solution to this problem would be to change everything that's private 
in the PdfGraphics2D class to protected. I'm sure the developers can think of 
better solutions.

On the other hand, if the intention is to not allow subclasses of PdfGraphics 
to be made, why not just mark it final?

In any case, if it's hard to follow what I'm trying to say, this experiment 
will make it totally clear - just modify the setRenderingHint() method of 
PdfGraphics2D to throw an exception, and then try to create a subclass of 
PdfGraphics2D to work around that exception.

Looking forward to your comments,
SPC.





-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to