cjolif 01/08/29 05:47:09
Modified: sources/org/apache/batik/svggen SVGFontDescriptor.java
SVGGeneratorContext.java SVGGraphics2D.java
Log:
generating SVG Fonts is now optional and can be configured trough
the generator context.
Revision Changes Path
1.5 +1 -3 xml-batik/sources/org/apache/batik/svggen/SVGFontDescriptor.java
Index: SVGFontDescriptor.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/svggen/SVGFontDescriptor.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SVGFontDescriptor.java 2001/08/03 04:21:53 1.4
+++ SVGFontDescriptor.java 2001/08/29 12:47:08 1.5
@@ -16,13 +16,11 @@
* Describes an SVG font
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vincent Hardy</a>
- * @version $Id: SVGFontDescriptor.java,v 1.4 2001/08/03 04:21:53 bella Exp $
+ * @version $Id: SVGFontDescriptor.java,v 1.5 2001/08/29 12:47:08 cjolif Exp $
* @see org.apache.batik.svggen.SVGFont
*/
public class SVGFontDescriptor implements SVGDescriptor, SVGSyntax {
-
private Element def;
-
private String fontSize;
private String fontWeight;
private String fontStyle;
1.10 +24 -2
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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SVGGeneratorContext.java 2001/06/21 07:54:29 1.9
+++ SVGGeneratorContext.java 2001/08/29 12:47:08 1.10
@@ -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.9 2001/06/21 07:54:29 cjolif Exp $
+ * @version $Id: SVGGeneratorContext.java,v 1.10 2001/08/29 12:47:08 cjolif Exp $
*/
public class SVGGeneratorContext implements ErrorConstants {
// this fields are package access for read-only purpose
@@ -66,9 +66,15 @@
ErrorHandler errorHandler;
/**
+ * Do we accept SVG Fonts generation?
+ */
+ boolean svgFont = false;
+
+ /**
* Builds an instance of <code>SVGGeneratorContext</code> with the given
* <code>domFactory</code> but let the user set later the other contextual
- * information. Please note that none of the parameter below should be
<code>null</code>.
+ * information. Please note that none of the parameter below should be
+ * <code>null</code>.
* @see #setIDGenerator
* @see #setExtensionHandler
* @see #setImageHandler
@@ -221,5 +227,21 @@
if (errorHandler == null)
throw new SVGGraphics2DRuntimeException(ERR_ERROR_HANDLER_NULL);
this.errorHandler = errorHandler;
+ }
+
+ /**
+ * Returns <code>true</code> if we should generate SVG Fonts for
+ * texts.
+ */
+ final public boolean isEmbededFontsEnabled() {
+ return svgFont;
+ }
+
+ /**
+ * Sets if we should generate SVG Fonts for texts. Default value
+ * is <code>false</code>.
+ */
+ final public void setEmbededFontsEnabled(boolean svgFont) {
+ this.svgFont = svgFont;
}
}
1.21 +7 -5 xml-batik/sources/org/apache/batik/svggen/SVGGraphics2D.java
Index: SVGGraphics2D.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/SVGGraphics2D.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- SVGGraphics2D.java 2001/08/03 04:21:53 1.20
+++ SVGGraphics2D.java 2001/08/29 12:47:08 1.21
@@ -44,7 +44,7 @@
*
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vincent Hardy</a>
- * @version $Id: SVGGraphics2D.java,v 1.20 2001/08/03 04:21:53 bella Exp $
+ * @version $Id: SVGGraphics2D.java,v 1.21 2001/08/29 12:47:08 cjolif Exp $
* @see org.apache.batik.ext.awt.g2d.GraphicContext
* @see org.apache.batik.svggen.DOMTreeManager
* @see org.apache.batik.svggen.DOMGroupManager
@@ -969,10 +969,12 @@
public void drawString(String s, float x, float y) {
if (!textAsShapes) {
- // record that the font is being used to draw this string, this is
- // so that the SVG Font element will only create glyphs for the
- // characters that are needed
- SVGFont.recordFontUsage(s, getFont());
+ if (generatorCtx.svgFont) {
+ // record that the font is being used to draw this string, this is
+ // so that the SVG Font element will only create glyphs for the
+ // characters that are needed
+ SVGFont.recordFontUsage(s, getFont());
+ }
Element text =
getDOMFactory().createElementNS(SVG_NAMESPACE_URI, SVG_TEXT_TAG);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]