Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: java printing font issue on leopard - hack for special JasperReports case



Hello,

I'm responding to myself here. After further experimenting, I both fixed a bug (use getBeginIndex()) and found a simplification (create the font with all attributes in one step) for my JasperReports/Leopard hack.

In net.sf.jasperreports.engine.export.TextRenderer#renderParagraph (
    AttributedCharacterIterator allParagraphs,
    int lastParagraphStart, String lastParagraphText)

I replaced

    draw(layout);

with

// I am trying to fix printing problems under Leopard, // where fonts get not set properly. // I am checking the OS Version, maybe I should check // the JRE release instead. // This has to be amended when the bug in whatever // library has been corrected. // Hopefully I have covered all malfunctioning system versions.

     if (System.getProperty("os.name").equals("Mac OS X") &&
         System.getProperty("os.version").startsWith("10.5"))
         {
         paragraph.setIndex(paragraph.getBeginIndex());
         grx.setFont(Font.getFont(paragraph.getAttributes()));
         }

    draw(layout);

This is faster (getFont uses the systems font cache), simpler, does not disturb other correct working systems and works, contrary to my previous hack.

But why this is necessary at all I still don't know.

Regards,
Bernd
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.