> -----Original Message-----
> From: Jeremy Bowman [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, April 10, 2002 7:11
> To:   [EMAIL PROTECTED]
> Subject:      Re: PdfGraphics2D class (RE:  [iText-questions] generating
> graphs)
> 
> Your code is in more usable shape than mine, especially the parts of 
> Graphics2D that aren't in Graphics (I'm not too far into that yet.)  Looks
> 
> like I have implemented some things that aren't in your code though, or
> that 
> aren't done as completely in your code.  I'm attaching what I have so far;
> 
> I'd like to figure out how we can proceed to work on this together, if
> that's 
> ok.  There seems to be enough left to do for a relatively complete 
> implementation, and I just bought a nifty book called "Java 2D API
> Graphics" 
> that I'd like to get some use out of...
> 
> Some quick points of comparison on the 2 pieces of code so far:
> - My code uses a PdfTemplate as the basis of the Graphics context; I think
> 
> this is a more flexible solution than writing directly to a PdfContentByte
> 
> obtained from the PdfWriter, since the template can then be used in
> multiple 
> places, as an image, etc.
> 
        I've already changed this.

> - You've implemented a lot more of the methods than I have, but some of
> them 
> not as completely as I'd like to see in the long term.  We should probably
> 
> start with your implementation (especially if JFreeChart is already mostly
> 
> working) and expand it piece by piece.
> 
        I agree. We can continue from there.

> - Since there isn't really a 1-to-1 mapping between AWT fonts and PDF
> fonts, 
> I created an interface for mapping them; a simple implementation is used
> by 
> default, but applications which use more unusual fonts are free to
> override 
> this with a custom mapping.  This would be necessary for asian fonts, for 
> example.
> 
        Good idea! Font mapping is going to be a problem, specially if
external true-type fonts are used.
        There's something I'm not sure what would be the best way to deal
with fonts. Should we keep the metrics of the pdf fonts or use the metrics
of the awt fonts? In the first case if the program gets the metrics from the
PdfGraphics2D it will work correctly. In the second case we would have
wysiwyg with the panel and with pdf but would require some tinkering in the
pdf fonts (must of it is already in place).

        I'm preparing a cleaned up version of PdfGraphics2D that I'll post
when ready with an example using JFreeChart.

        Best Regards,
        Paulo Soares

> - My files are a lot bigger since I copied most of the method javadocs
> pretty 
> much verbatim.  It's probably debatable whether this is a good thing or
> not. 
> ^_^
> 
> The classes I've attached are:
> PdfGraphics - a mostly working Graphics subclass plus some Graphics2D
> methods
> PdfFontMetrics - FontMetrics subclass which uses BaseFont metrics
> FontMapper - interface for mapping between AWT and PDF fonts
> DefaultFontMapper - simple default FontMapper implementation
> PdfGraphicsDevice - GraphicsDevice subclass
> PdfGraphicsConfiguration - GraphicsConfiguration subclass
> Test - test application I've been using to try out features as I add them.
> 
> I also included an image used in Test.java (picture of the Japanese pop 
> singing/dancing quartet MAX).
> 
> Let me know if you want to cooperate on this, and if so how you'd like to
> go 
> about it.
> 
> Jeremy
> 
> On Tuesday 09 April 2002 01:36 pm, you wrote:
> > To anyone following this thread, there is a small bug in the
> getTransform
> > method. I was returning the transform directly, but I'm supposed to
> return
> > a copy. I'm attaching an update copy of the file, but if you want to
> make
> > the changes yourself, change it to:
> >
> > /**
> > * @see Graphics2D#getTransform()
> > */
> > public AffineTransform getTransform() {
> >     return new AffineTransform(transform);
> > }
> >
> > Also I was throwing UnsupportedOperationExceptions on getComposite and
> > setComposite, but JFreeChart is actually using those. Changing them as
> > below will get them working.
> >
> > /**
> > * @see Graphics2D#getComposite()
> > */
> > public Composite getComposite() {
> >     return null;
> > }
> >
> > and
> >
> > /**
> > * @see Graphics2D#setComposite(Composite)
> > */
> > public Composite getComposite(Composite comp) {
> >
> > }
> >
> > By the way it now seems to be working very nicely. Just ran it against a
> > battery of JFreeCharts (I modified the JFreeChartDemo to write pdf files
> as
> > well as draw in the window) and it basically performed perfectly. The
> only
> > problem I can find is that descenders are not being drawn for some of
> the
> > labels (i.e. when drawing a 'y' you only see the 'v'; portion). I'm
> pretty
> > sure this is a FontMetrics issue.
> >
> > regards,
> >
> > --jim moore << File: PdfGraphics.zip >> 

_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to