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.
JFreeGraphics2D 1.0
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
JFreeGraphics2D 1.0
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Re: JFreeGraphics2D 1.0
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:
Kind regards,
Anna
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
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: JFreeGraphics2D 1.0
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:
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
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Re: JFreeGraphics2D 1.0
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
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: JFreeGraphics2D 1.0
I just write the font family name, as reported by Java, into the SVG element:
I'm reading up a bit more right now on font handling in SVG to see what other options could be implemented.
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();
}
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Re: JFreeGraphics2D 1.0
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