JFreeGraphics2D 1.0

A discussion forum for JFreeSVG (a fast, lightweight, SVG generator for the Java platform).
Locked
david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

JFreeGraphics2D 1.0

Post by david.gilbert » Wed Jul 31, 2013 8:26 am

JFreeGraphics2D is a vector graphics library for the Java(tm) platform that allows you to generate content in SVG and PDF format using the standard Java2D drawing API (Graphics2D). JFreeGraphics2D is light-weight, fast, and has no dependencies other than the Java runtime (1.6 or later). The home page for the project is:

http://www.jfree.org/jfreegraphics2d/

This is the first public release of JFreeGraphics2D, your feedback is very welcome.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

AnnaW
Posts: 1
Joined: Wed Aug 14, 2013 1:15 pm
antibot: No, of course not.

Re: JFreeGraphics2D 1.0

Post by AnnaW » Wed Aug 14, 2013 1:27 pm

Hi dear creator,

I started using JFreeChart only recently. As I see a new release recently and also the JFreeGraphics2D, what is the purpose of having separate new API?

I read that SVG is handled in JFreeGraphics, does that mean that Batik isn't need any more like with JFreeChart ?

Is there any demo available to see yet?

Edit: now I see one of answers about JFreeGraphics:
has no dependencies other than the Java runtime (1.6 or later)


Kind regards,
Anna

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: JFreeGraphics2D 1.0

Post by david.gilbert » Wed Aug 14, 2013 1:46 pm

JFreeGraphics2D provides some lightweight implementations of the Graphics2D API, for general purpose vector graphics. It has support for PDF and SVG output. It doesn't create charts on it's own, but you can use JFreeChart and JFreeGraphics2D together very easily to generate charts in SVG and PDF formats. JFreeGraphics2D would replace Batik and iText in this use case.

With regard to demos:
  • in the first release of JFreeGraphics2D I put some small demo applications in the org.jfree.graphics2d.demo package. These require JFreeChart to run;
  • in a subsequent release I will include some more general purpose demos to illustrate the fact that JFreeGraphics2D is not about charts, it is about general purpose vector graphics;
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

mhilpert
Posts: 497
Joined: Wed Apr 02, 2003 1:57 pm
Location: Germany

Re: JFreeGraphics2D 1.0

Post by mhilpert » Mon Sep 02, 2013 4:29 pm

This sounds good. How is this library handling fonts? So far, the Batik library generates system font names in the SVG; resulting in the bad behaviour, that these fonds need to be installed on the server Windows operating system. Is your library doing the same? Or is there an alternative way to state font paths?
Java 11, JFreeChart 1.0.15, JFreeSVG 4.0

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: JFreeGraphics2D 1.0

Post by david.gilbert » Mon Sep 02, 2013 5:25 pm

I just write the font family name, as reported by Java, into the SVG element:

Code: Select all

    /**
     * Returns a string containing font style info.
     * 
     * @return A string containing font style info.
     */
    private String getSVGFontStyle() {
        StringBuilder b = new StringBuilder();
        b.append("fill: ").append(getSVGColor()).append("; ");
        b.append("font-family: ").append(this.font.getFamily()).append("; ");
        b.append("font-size: ").append(this.font.getSize()).append("; ");
        if (this.font.isBold()) {
            b.append("font-weight: bold; ");
        }
        if (this.font.isItalic()) {
            b.append("font-style: italic; ");
        }
        return b.toString();
    }
I'm reading up a bit more right now on font handling in SVG to see what other options could be implemented.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

mhilpert
Posts: 497
Joined: Wed Apr 02, 2003 1:57 pm
Location: Germany

Re: JFreeGraphics2D 1.0

Post by mhilpert » Tue Sep 03, 2013 7:56 pm

Yes, that's what Batik also does and this is bad as these fonts need to be registered in the system. Better would be an alternative way to include fonts, but I don't know much about this.
Java 11, JFreeChart 1.0.15, JFreeSVG 4.0

Locked