Well, I could ask you why should a fix be applied just to ease your unit 
testing, as if the font order was any obstacle. I wonder why the dictionary 
keys shouldn't also be ordered, you forgot that one. The fix doesn't add 
anything to iText, makes it slower, wastes memory, is another lock on jdk 
1.4 when many are still using jdk 1.3 and your reasoning that the fonts must 
be ordered to be tested is flawed.

Paulo

----- Original Message ----- 
From: "Chad Loder" <[EMAIL PROTECTED]>
To: "Post all your questions about iText here" 
<[email protected]>
Sent: Wednesday, August 27, 2008 8:31 PM
Subject: Re: [iText-questions] [patch] output PDF fonts in predictable order


Hi Paulo. Can you please elaborate on why the fix won't happen?

Thanks,
        c

On Wed Aug 27/2008 @ 12:08:P +0100 asdasd, Paulo Soares wrote:
> That fix won't happen, change your testing or your iText code.
>
> Paulo
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On
> > Behalf Of Chad Loder
> > Sent: Wednesday, August 27, 2008 3:09 AM
> > To: [email protected]
> > Subject: [iText-questions] [patch] output PDF fonts in
> > predictable order
> >
> > One of our issues when unit testing our PDF generation code
> > is that iText
> > creates PDFs with fonts in an unpredictable order. This makes
> > it impossible
> > to simply compare checksums of itext-generated PDF files from
> > one change
> > to the next.
> >
> > This is due to one particular use of HashMap internally
> > within the PdfWriter
> > class. Replacing this use of HashMap with LinkedHashMap
> > solves the problem
> > because LinkedHashMap iterates over its entries in the order they were
> > inserted. LinkedHashMap was added in JDK 1.4 so it will be
> > compatible with
> > the 1.4 requirement that itext has.
> >
> > The following diff fixes the issue and has been tested.
> >
> > Index: itext/java/com/lowagie/text/pdf/PdfWriter.java
> > ===================================================================
> > diff -u -p -r1.1.1.9 PdfWriter.java
> > --- itext/java/com/lowagie/text/pdf/PdfWriter.java      6 Jun
> > 2007 23:11:39 -0000       1.1.1.9
> > +++ itext/java/com/lowagie/text/pdf/PdfWriter.java      26
> > Aug 2008 23:22:06 -0000
> > @@ -57,6 +57,7 @@ import java.util.ArrayList;
> >  import java.util.HashMap;
> >  import java.util.HashSet;
> >  import java.util.Iterator;
> > +import java.util.LinkedHashMap;
> >  import java.util.Map;
> >  import java.util.TreeMap;
> >  import java.util.TreeSet;
> > @@ -1842,7 +1843,7 @@ public class PdfWriter extends DocWriter
> >  //     [F3] adding fonts
> >
> >      /** The fonts of this document */
> > -    protected HashMap documentFonts = new HashMap();
> > +    protected LinkedHashMap documentFonts = new LinkedHashMap();
> >
> >      /** The font number counter for the fonts in the document. */
> >      protected int fontNumber = 1;


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to