cjolif 01/08/29 06:08:52 Modified: xdocs svggen.xml sources/org/apache/batik/svggen SVGGeneratorContext.java Log: documentation on how to generate SVG Fonts from the Batik SVG Generator Revision Changes Path 1.8 +17 -5 xml-batik/xdocs/svggen.xml Index: svggen.xml =================================================================== RCS file: /home/cvs/xml-batik/xdocs/svggen.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- svggen.xml 2001/05/11 16:33:58 1.7 +++ svggen.xml 2001/08/29 13:08:52 1.8 @@ -12,7 +12,7 @@ <!-- ========================================================================= --> <!-- author [EMAIL PROTECTED] --> <!-- author [EMAIL PROTECTED] --> -<!-- version $Id: svggen.xml,v 1.7 2001/05/11 16:33:58 vhardy Exp $ --> +<!-- version $Id: svggen.xml,v 1.8 2001/08/29 13:08:52 cjolif Exp $ --> <!-- ========================================================================= --> <document> <header> @@ -190,7 +190,7 @@ In the previous section, we have just seen that the SVG generation process can be customized to output SVG style as XML attributes or CSS inline properties. In this section we will talk about some examples of more advanced customizations. </p> <p> - Instead of creating the <code>SVGGraphics2D</code> just by using the <code>Document</code> that will be used as a factory for creating the SVG elements, we can use the constructor that use an <code>SVGGeneratorContext</code> instance. By providing your own <code>SVGGeneratorContext</code> instance, you will be able to do advanced customization. You will find below three examples of possible customizations. + Instead of creating the <code>SVGGraphics2D</code> just by using the <code>Document</code> that will be used as a factory for creating the SVG elements, we can use the constructor that use an <code>SVGGeneratorContext</code> instance. By providing your own <code>SVGGeneratorContext</code> instance, you will be able to do advanced customization. You will find below several examples of possible customizations. </p> <s2 title="Have your own comment in the generated SVG file"> <p> @@ -200,10 +200,22 @@ SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(myFactory); ctx.setComment("Generated by FooApplication with Batik SVG Generator"); -SVGGraphics2D g2d = new SVGGraphics2D(ctx, false); +SVGGraphics2D g2d = new SVGGraphics2D(ctx); </source> </s2> + <s2 title="Use Embedded SVG Fonts in the generated SVG file"> + <p> + In order to have a self-contained SVG file that doesn't have to use system fonts to be displayed, you can embed the fonts you used for drawing strings in the SVG file through the SVG fonts facility. + </p> + <source> + +SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(myFactory); +ctx.setEmbeddedFontsOn(true); +SVGGraphics2D g2d = new SVGGraphics2D(ctx); + </source> + + </s2> <s2 title="Customizing the generated SVG style"> <p> @@ -245,7 +257,7 @@ SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(myFactory); CDATASection styleSheet = myFactory.createCDATASection(""); ctx.setStyleHandler(new StyleSheetStyleHandler(styleSheet)); -SVGGraphics2D g2d = new SVGGraphics2D(ctx, false); +SVGGraphics2D g2d = new SVGGraphics2D(ctx); // use the g2d to dump drawings (component.paint(g2d)) @@ -327,7 +339,7 @@ SVGGeneratorContext ctx = SVGGeneratorContext.createDefault(myFactory); ctx.setExtensionHandler(new SubExtensionHandler()); -SVGGraphics2D g2d = new SVGGraphics2D(ctx, false);</source> +SVGGraphics2D g2d = new SVGGraphics2D(ctx);</source> </s2> </s1> </body> 1.11 +3 -3 xml-batik/sources/org/apache/batik/svggen/SVGGeneratorContext.java Index: SVGGeneratorContext.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/SVGGeneratorContext.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- SVGGeneratorContext.java 2001/08/29 12:47:08 1.10 +++ SVGGeneratorContext.java 2001/08/29 13:08:52 1.11 @@ -18,7 +18,7 @@ * * @see org.apache.batik.svggen.SVGGraphics2D#SVGGraphics2D(SVGGeneratorContext,boolean) * @author <a href="mailto:[EMAIL PROTECTED]>Christophe Jolif</a> - * @version $Id: SVGGeneratorContext.java,v 1.10 2001/08/29 12:47:08 cjolif Exp $ + * @version $Id: SVGGeneratorContext.java,v 1.11 2001/08/29 13:08:52 cjolif Exp $ */ public class SVGGeneratorContext implements ErrorConstants { // this fields are package access for read-only purpose @@ -233,7 +233,7 @@ * Returns <code>true</code> if we should generate SVG Fonts for * texts. */ - final public boolean isEmbededFontsEnabled() { + final public boolean isEmbeddedFontsOn() { return svgFont; } @@ -241,7 +241,7 @@ * Sets if we should generate SVG Fonts for texts. Default value * is <code>false</code>. */ - final public void setEmbededFontsEnabled(boolean svgFont) { + final public void setEmbeddedFontsOn(boolean svgFont) { this.svgFont = svgFont; } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]