bella 01/08/02 00:49:35
Modified: sources/org/apache/batik/bridge
SVGAltGlyphElementBridge.java
SVGAltGlyphHandler.java SVGGVTFont.java
SVGGlyphElementBridge.java
SVGTextElementBridge.java
Log:
gradient fill of SVG fonts now works properly
Revision Changes Path
1.4 +50 -20
xml-batik/sources/org/apache/batik/bridge/SVGAltGlyphElementBridge.java
Index: SVGAltGlyphElementBridge.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGAltGlyphElementBridge.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SVGAltGlyphElementBridge.java 2001/07/05 06:56:07 1.3
+++ SVGAltGlyphElementBridge.java 2001/08/02 07:49:35 1.4
@@ -11,17 +11,23 @@
import org.apache.batik.dom.svg.SVGOMDocument;
import org.apache.batik.dom.util.XLinkSupport;
import org.apache.batik.gvt.font.Glyph;
+import org.apache.batik.gvt.text.GVTAttributedCharacterIterator;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import java.text.AttributedCharacterIterator;
+import java.awt.font.TextAttribute;
+import java.awt.Paint;
+import java.awt.Stroke;
+
/**
* Bridge class for the <altGlyph> element.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Bella Robinson</a>
- * @version $Id: SVGAltGlyphElementBridge.java,v 1.3 2001/07/05 06:56:07 bella Exp $
+ * @version $Id: SVGAltGlyphElementBridge.java,v 1.4 2001/08/02 07:49:35 bella Exp $
*/
public class SVGAltGlyphElementBridge extends AbstractSVGBridge
implements ErrorConstants {
@@ -53,7 +59,8 @@
*/
public Glyph[] createAltGlyphArray(BridgeContext ctx,
Element altGlyphElement,
- float fontSize) {
+ float fontSize,
+ AttributedCharacterIterator aci) {
// get the referenced element
String uri = XLinkSupport.getXLinkHref(altGlyphElement);
@@ -67,7 +74,7 @@
// if the referenced element is a glyph
if (refElement.getTagName().equals(SVG_GLYPH_TAG)) {
- Glyph glyph = getGlyph(ctx, uri, altGlyphElement, fontSize);
+ Glyph glyph = getGlyph(ctx, uri, altGlyphElement, fontSize, aci);
if (glyph == null) {
// failed to create a glyph for the specified glyph uri
@@ -82,7 +89,8 @@
// else should be an altGlyphDef element
if (refElement.getTagName().equals(SVG_ALT_GLYPH_DEF_TAG)) {
- // if not local import the referenced altGlyphDef into the current
document
+ // if not local import the referenced altGlyphDef
+ // into the current document
SVGOMDocument document
= (SVGOMDocument)altGlyphElement.getOwnerDocument();
SVGOMDocument refDocument
@@ -114,7 +122,8 @@
}
if (containsGlyphRefNodes) { // process the glyphRef children
- NodeList glyphRefNodes =
localRefElement.getElementsByTagName(SVG_GLYPH_REF_TAG);
+ NodeList glyphRefNodes
+ = localRefElement.getElementsByTagName(SVG_GLYPH_REF_TAG);
int numGlyphRefNodes = glyphRefNodes.getLength();
Glyph[] glyphArray = new Glyph[numGlyphRefNodes];
for (int i = 0; i < numGlyphRefNodes; i++) {
@@ -122,7 +131,8 @@
Element glyphRefElement = (Element)glyphRefNodes.item(i);
String glyphUri = XLinkSupport.getXLinkHref(glyphRefElement);
- Glyph glyph = getGlyph(ctx, glyphUri, altGlyphElement,
fontSize);
+ Glyph glyph
+ = getGlyph(ctx, glyphUri, altGlyphElement, fontSize, aci);
if (glyph == null) {
// failed to create a glyph for the specified glyph uri
return null;
@@ -133,14 +143,16 @@
} else { // try looking for altGlyphItem children
- NodeList altGlyphItemNodes =
localRefElement.getElementsByTagName(SVG_ALT_GLYPH_ITEM_TAG);
+ NodeList altGlyphItemNodes
+ = localRefElement.getElementsByTagName(SVG_ALT_GLYPH_ITEM_TAG);
int numAltGlyphItemNodes = altGlyphItemNodes.getLength();
if (numAltGlyphItemNodes > 0) {
Glyph[] glyphArray = new Glyph[numAltGlyphItemNodes];
for (int i = 0; i < numAltGlyphItemNodes; i++) {
// try to find a resolvable glyphRef
Element altGlyphItemElement =
(Element)altGlyphItemNodes.item(i);
- NodeList altGlyphRefNodes =
altGlyphItemElement.getElementsByTagName(SVG_GLYPH_REF_TAG);
+ NodeList altGlyphRefNodes
+ =
altGlyphItemElement.getElementsByTagName(SVG_GLYPH_REF_TAG);
int numAltGlyphRefNodes = altGlyphRefNodes.getLength();
boolean foundMatchingGlyph = false;
for (int j = 0; j < numAltGlyphRefNodes; j++) {
@@ -148,7 +160,7 @@
Element glyphRefElement =
(Element)altGlyphRefNodes.item(j);
String glyphUri =
XLinkSupport.getXLinkHref(glyphRefElement);
- Glyph glyph = getGlyph(ctx, glyphUri, altGlyphElement,
fontSize);
+ Glyph glyph = getGlyph(ctx, glyphUri, altGlyphElement,
fontSize, aci);
if (glyph != null) {
// found a matching glyph for this altGlyphItem
glyphArray[i] = glyph;
@@ -186,16 +198,19 @@
private Glyph getGlyph(BridgeContext ctx,
String glyphUri,
Element altGlyphElement,
- float fontSize) {
+ float fontSize,
+ AttributedCharacterIterator aci) {
Element refGlyphElement = null;
try {
refGlyphElement = ctx.getReferencedElement(altGlyphElement, glyphUri);
} catch (BridgeException e) {
- // this is ok, it is possible that the glyph at the given uri is not
available
+ // this is ok, it is possible that the glyph at the given
+ // uri is not available
}
- if (refGlyphElement == null ||
!refGlyphElement.getTagName().equals(SVG_GLYPH_TAG)) {
+ if (refGlyphElement == null
+ || !refGlyphElement.getTagName().equals(SVG_GLYPH_TAG)) {
// couldn't find the referenced glyph element,
// or referenced element not a glyph
return null;
@@ -215,7 +230,8 @@
if (isLocal) {
localGlyphElement = refGlyphElement;
Element fontElement = (Element)localGlyphElement.getParentNode();
- NodeList fontFaceElements =
fontElement.getElementsByTagName(SVG_FONT_FACE_TAG);
+ NodeList fontFaceElements
+ = fontElement.getElementsByTagName(SVG_FONT_FACE_TAG);
if (fontFaceElements.getLength() > 0) {
localFontFaceElement = (Element)fontFaceElements.item(0);
}
@@ -223,10 +239,12 @@
} else {
// import the whole font
- Element localFontElement =
(Element)document.importNode(refGlyphElement.getParentNode(), true);
+ Element localFontElement
+ = (Element)document.importNode(refGlyphElement.getParentNode(),
true);
Element g = document.createElementNS(SVG_NAMESPACE_URI, SVG_G_TAG);
g.appendChild(localFontElement);
-
CSSUtilities.computeStyleAndURIs((Element)refGlyphElement.getParentNode(),
localFontElement);
+ CSSUtilities.computeStyleAndURIs(
+ (Element)refGlyphElement.getParentNode(), localFontElement);
// get the local glyph element
String glyphId = refGlyphElement.getAttributeNS(null, SVG_ID_ATTRIBUTE);
@@ -239,7 +257,8 @@
}
}
// get the local font-face element
- NodeList fontFaceElements =
localFontElement.getElementsByTagName(SVG_FONT_FACE_TAG);
+ NodeList fontFaceElements
+ = localFontElement.getElementsByTagName(SVG_FONT_FACE_TAG);
if (fontFaceElements.getLength() > 0) {
localFontFaceElement = (Element)fontFaceElements.item(0);
}
@@ -252,10 +271,21 @@
SVGFontFaceElementBridge fontFaceBridge
= (SVGFontFaceElementBridge)ctx.getBridge(localFontFaceElement);
- SVGFontFace fontFace = fontFaceBridge.createFontFace(ctx,
localFontFaceElement);
-
- SVGGlyphElementBridge glyphBridge =
(SVGGlyphElementBridge)ctx.getBridge(localGlyphElement);
- return glyphBridge.createGlyph(ctx, localGlyphElement, altGlyphElement, -1,
fontSize, fontFace);
+ SVGFontFace fontFace
+ = fontFaceBridge.createFontFace(ctx, localFontFaceElement);
+ SVGGlyphElementBridge glyphBridge
+ = (SVGGlyphElementBridge)ctx.getBridge(localGlyphElement);
+
+ aci.first();
+ Paint fillPaint = (Paint)aci.getAttribute(TextAttribute.FOREGROUND);
+ Paint strokePaint = (Paint)aci.getAttribute(
+ GVTAttributedCharacterIterator.TextAttribute.STROKE_PAINT);
+ Stroke stroke = (Stroke)aci.getAttribute(
+ GVTAttributedCharacterIterator.TextAttribute.STROKE);
+
+ return glyphBridge.createGlyph(ctx, localGlyphElement, altGlyphElement,
+ -1, fontSize, fontFace,
+ fillPaint, strokePaint, stroke);
}
}
1.4 +8 -4
xml-batik/sources/org/apache/batik/bridge/SVGAltGlyphHandler.java
Index: SVGAltGlyphHandler.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGAltGlyphHandler.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SVGAltGlyphHandler.java 2001/07/05 06:56:07 1.3
+++ SVGAltGlyphHandler.java 2001/08/02 07:49:35 1.4
@@ -15,6 +15,7 @@
import org.apache.batik.util.SVGConstants;
import java.awt.font.FontRenderContext;
+import java.text.AttributedCharacterIterator;
import org.w3c.dom.Element;
/**
@@ -22,7 +23,7 @@
* GVTGlyphVector for the altGlyph element.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Bella Robinson</a>
- * @version $Id: SVGAltGlyphHandler.java,v 1.3 2001/07/05 06:56:07 bella Exp $
+ * @version $Id: SVGAltGlyphHandler.java,v 1.4 2001/08/02 07:49:35 bella Exp $
*/
public class SVGAltGlyphHandler implements AltGlyphHandler, SVGConstants {
@@ -50,10 +51,13 @@
* @return The GVTGlyphVector containing the alternate glyphs, or null if
* the alternate glyphs could not be found.
*/
- public GVTGlyphVector createGlyphVector(FontRenderContext frc, float fontSize) {
+ public GVTGlyphVector createGlyphVector(FontRenderContext frc, float fontSize,
+ AttributedCharacterIterator aci) {
if (textElement.getTagName().equals(SVG_ALT_GLYPH_TAG)) {
- SVGAltGlyphElementBridge altGlyphBridge =
(SVGAltGlyphElementBridge)ctx.getBridge(textElement);
- Glyph[] glyphArray = altGlyphBridge.createAltGlyphArray(ctx,
textElement, fontSize);
+ SVGAltGlyphElementBridge altGlyphBridge
+ = (SVGAltGlyphElementBridge)ctx.getBridge(textElement);
+ Glyph[] glyphArray
+ = altGlyphBridge.createAltGlyphArray(ctx, textElement, fontSize,
aci);
if (glyphArray != null) {
return new SVGGVTGlyphVector(null, glyphArray, frc);
}
1.6 +42 -7 xml-batik/sources/org/apache/batik/bridge/SVGGVTFont.java
Index: SVGGVTFont.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGGVTFont.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SVGGVTFont.java 2001/07/05 06:56:08 1.5
+++ SVGGVTFont.java 2001/08/02 07:49:35 1.6
@@ -9,6 +9,9 @@
package org.apache.batik.bridge;
import java.awt.Font;
+import java.awt.Paint;
+import java.awt.Stroke;
+import java.awt.font.TextAttribute;
import java.awt.font.FontRenderContext;
import java.awt.font.LineMetrics;
import java.awt.font.GlyphVector;
@@ -38,7 +41,7 @@
* Represents an SVG font.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Bella Robinson</a>
- * @version $Id: SVGGVTFont.java,v 1.5 2001/07/05 06:56:08 bella Exp $
+ * @version $Id: SVGGVTFont.java,v 1.6 2001/08/02 07:49:35 bella Exp $
*/
public final class SVGGVTFont implements GVTFont, SVGConstants {
@@ -538,8 +541,18 @@
Element glyphElement = glyphElements[i];
SVGGlyphElementBridge glyphBridge
= (SVGGlyphElementBridge)ctx.getBridge(glyphElement);
- Glyph glyph = glyphBridge.createGlyph(
- ctx, glyphElement, textElement, i, fontSize, fontFace);
+ Glyph glyph;
+ if (aci != null) {
+ aci.setIndex(ci.getIndex());
+ Paint fillPaint =
(Paint)aci.getAttribute(TextAttribute.FOREGROUND);
+ Paint strokePaint =
(Paint)aci.getAttribute(GVTAttributedCharacterIterator.TextAttribute.STROKE_PAINT);
+ Stroke stroke =
(Stroke)aci.getAttribute(GVTAttributedCharacterIterator.TextAttribute.STROKE);
+ glyph = glyphBridge.createGlyph(
+ ctx, glyphElement, textElement, i, fontSize,
fontFace, fillPaint, strokePaint, stroke);
+ } else {
+ glyph = glyphBridge.createGlyph(
+ ctx, glyphElement, textElement, i, fontSize,
fontFace, null, null, null);
+ }
glyphs.add(glyph);
foundMatchingGlyph = true;
break;
@@ -561,8 +574,18 @@
Element glyphElement = glyphElements[i];
SVGGlyphElementBridge glyphBridge
=
(SVGGlyphElementBridge)ctx.getBridge(glyphElement);
- Glyph glyph = glyphBridge.createGlyph(
- ctx, glyphElement, textElement, i, fontSize,
fontFace);
+ Glyph glyph;
+ if (aci != null) {
+ aci.setIndex(ci.getIndex());
+ Paint fillPaint =
(Paint)aci.getAttribute(TextAttribute.FOREGROUND);
+ Paint strokePaint =
(Paint)aci.getAttribute(GVTAttributedCharacterIterator.TextAttribute.STROKE_PAINT);
+ Stroke stroke =
(Stroke)aci.getAttribute(GVTAttributedCharacterIterator.TextAttribute.STROKE);
+ glyph = glyphBridge.createGlyph(
+ ctx, glyphElement, textElement, i, fontSize,
fontFace, fillPaint, strokePaint, stroke);
+ } else {
+ glyph = glyphBridge.createGlyph(
+ ctx, glyphElement, textElement, i, fontSize,
fontFace, null, null, null);
+ }
glyphs.add(glyph);
foundMatchingGlyph = true;
break;
@@ -578,8 +601,20 @@
// add the missing glyph
SVGGlyphElementBridge glyphBridge
= (SVGGlyphElementBridge)ctx.getBridge(missingGlyphElement);
- Glyph glyph = glyphBridge.createGlyph(
- ctx, missingGlyphElement, textElement, -1, fontSize, fontFace);
+ Glyph glyph;
+ if (aci != null) {
+ aci.setIndex(ci.getIndex());
+ Paint fillPaint =
(Paint)aci.getAttribute(TextAttribute.FOREGROUND);
+ Paint strokePaint =
(Paint)aci.getAttribute(GVTAttributedCharacterIterator.TextAttribute.STROKE_PAINT);
+ Stroke stroke =
(Stroke)aci.getAttribute(GVTAttributedCharacterIterator.TextAttribute.STROKE);
+ glyph = glyphBridge.createGlyph(
+ ctx, missingGlyphElement, textElement, -1, fontSize,
+ fontFace, fillPaint, strokePaint, stroke);
+ } else {
+ glyph = glyphBridge.createGlyph(
+ ctx, missingGlyphElement, textElement, -1, fontSize,
+ fontFace, null, null, null);
+ }
glyphs.add(glyph);
}
1.5 +26 -21
xml-batik/sources/org/apache/batik/bridge/SVGGlyphElementBridge.java
Index: SVGGlyphElementBridge.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGGlyphElementBridge.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SVGGlyphElementBridge.java 2001/07/05 06:56:08 1.4
+++ SVGGlyphElementBridge.java 2001/08/02 07:49:35 1.5
@@ -9,6 +9,9 @@
package org.apache.batik.bridge;
import java.awt.Shape;
+import java.awt.Paint;
+import java.awt.Stroke;
+import java.awt.Color;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
@@ -20,8 +23,11 @@
import org.apache.batik.gvt.CompositeGraphicsNode;
import org.apache.batik.gvt.GraphicsNode;
import org.apache.batik.gvt.ShapeNode;
-import org.apache.batik.gvt.ShapePainter;
+import org.apache.batik.gvt.StrokeShapePainter;
+import org.apache.batik.gvt.FillShapePainter;
+import org.apache.batik.gvt.CompositeShapePainter;
import org.apache.batik.gvt.font.Glyph;
+import org.apache.batik.ext.awt.LinearGradientPaint;
import org.apache.batik.parser.AWTPathProducer;
import org.apache.batik.parser.ParseException;
@@ -37,7 +43,7 @@
* Bridge class for the <glyph> element.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Bella Robinson</a>
- * @version $Id: SVGGlyphElementBridge.java,v 1.4 2001/07/05 06:56:08 bella Exp $
+ * @version $Id: SVGGlyphElementBridge.java,v 1.5 2001/08/02 07:49:35 bella Exp $
*/
public class SVGGlyphElementBridge extends AbstractSVGBridge
implements ErrorConstants {
@@ -72,24 +78,22 @@
Element textElement,
int glyphCode,
float fontSize,
- SVGFontFace fontFace) {
+ SVGFontFace fontFace,
+ Paint fillPaint,
+ Paint strokePaint,
+ Stroke stroke) {
- // build the GVT tree that represents the glyph
- GVTBuilder builder = ctx.getGVTBuilder();
- CompositeGraphicsNode glyphContentNode
- = new CompositeGraphicsNode();
-
float fontHeight = fontFace.getUnitsPerEm();
float scale = fontSize/fontHeight;
AffineTransform scaleTransform
= AffineTransform.getScaleInstance(scale, -scale);
- // create a shape node that represents the d attribute
+ // create a shape that represents the d attribute
String d = glyphElement.getAttributeNS(null, SVG_D_ATTRIBUTE);
+ Shape dShape = null;
if (d.length() != 0) {
- ShapeNode shapeNode = new ShapeNode();
AWTPathProducer app = new AWTPathProducer();
app.setWindingRule(CSSUtilities.convertFillRule(glyphElement));
try {
@@ -105,15 +109,7 @@
Shape shape = app.getShape();
Shape transformedShape
= scaleTransform.createTransformedShape(shape);
-
- shapeNode.setShape(transformedShape);
-
- // set up the painter for the d part of the glyph
- ShapePainter painter = PaintServer.convertFillAndStroke(
- textElement, shapeNode, ctx);
- shapeNode.setShapePainter(painter);
-
- glyphContentNode.add(shapeNode);
+ dShape = transformedShape;
}
}
@@ -132,8 +128,15 @@
}
}
+ CompositeGraphicsNode glyphContentNode = null;
+
if (numGlyphChildren > 0) { // the glyph has child elements
+ // build the GVT tree that represents the glyph children
+ GVTBuilder builder = ctx.getGVTBuilder();
+
+ glyphContentNode = new CompositeGraphicsNode();
+
//
// need to clone the parent font element and glyph element
// this is so that the glyph doesn't inherit anything past the font
element
@@ -318,8 +321,10 @@
Point2D horizOrigin = new Point2D.Float(horizOriginX, horizOriginY);
// return a new Glyph
- return new Glyph(glyphContentNode, unicode, names, orientation,
+ return new Glyph(unicode, names, orientation,
arabicForm, lang, horizOrigin, vertOrigin,
- horizAdvX, vertAdvY, glyphCode, scale);
+ horizAdvX, vertAdvY, glyphCode, scale,
+ fillPaint, strokePaint, stroke,
+ dShape, glyphContentNode);
}
}
1.31 +34 -30
xml-batik/sources/org/apache/batik/bridge/SVGTextElementBridge.java
Index: SVGTextElementBridge.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGTextElementBridge.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- SVGTextElementBridge.java 2001/08/01 05:39:06 1.30
+++ SVGTextElementBridge.java 2001/08/02 07:49:35 1.31
@@ -57,7 +57,7 @@
* Bridge class for the <text> element.
*
* @author <a href="[EMAIL PROTECTED]>Bill Haneman</a>
- * @version $Id: SVGTextElementBridge.java,v 1.30 2001/08/01 05:39:06 bella Exp $
+ * @version $Id: SVGTextElementBridge.java,v 1.31 2001/08/02 07:49:35 bella Exp $
*/
public class SVGTextElementBridge extends AbstractSVGBridge
implements GraphicsNodeBridge, ErrorConstants {
@@ -973,9 +973,6 @@
}
// Unicode-bidi mode
- // full support requires revision: see comments
- // below regarding 'direction'
-
v = (CSSPrimitiveValue)cssDecl.getPropertyCSSValueInternal
(CSS_UNICODE_BIDI_PROPERTY);
s = v.getStringValue();
@@ -1033,6 +1030,8 @@
// Writing mode
+ boolean horizontal = true;
+
v = (CSSPrimitiveValue)cssDecl.getPropertyCSSValueInternal
(CSS_WRITING_MODE_PROPERTY);
s = v.getStringValue();
@@ -1050,10 +1049,11 @@
TextAttribute.WRITING_MODE_RTL);
break;
case 't':
- result.put(GVTAttributedCharacterIterator.
+ result.put(GVTAttributedCharacterIterator.
TextAttribute.WRITING_MODE,
GVTAttributedCharacterIterator.
TextAttribute.WRITING_MODE_TTB);
+ horizontal = false;
break;
}
@@ -1142,12 +1142,13 @@
(CSS_LETTER_SPACING_PROPERTY);
t = v.getPrimitiveType();
if (t != CSSPrimitiveValue.CSS_IDENT) {
- f = UnitProcessor.cssHorizontalCoordinateToUserSpace
- (v, CSS_LETTER_SPACING_PROPERTY, uctx);
-
- // XXX: HACK: Assuming horizontal length units is wrong,
- // layout might be vertical!
-
+ if (horizontal) {
+ f = UnitProcessor.cssHorizontalCoordinateToUserSpace
+ (v, CSS_LETTER_SPACING_PROPERTY, uctx);
+ } else {
+ f = UnitProcessor.cssVerticalCoordinateToUserSpace
+ (v, CSS_LETTER_SPACING_PROPERTY, uctx);
+ }
result.put(GVTAttributedCharacterIterator.
TextAttribute.LETTER_SPACING,
new Float(f));
@@ -1161,12 +1162,13 @@
(CSS_WORD_SPACING_PROPERTY);
t = v.getPrimitiveType();
if (t != CSSPrimitiveValue.CSS_IDENT) {
- f = UnitProcessor.cssHorizontalCoordinateToUserSpace
- (v, CSS_WORD_SPACING_PROPERTY, uctx);
-
- // XXX: HACK: Assuming horizontal length units is wrong,
- // layout might be vertical!
-
+ if (horizontal) {
+ f = UnitProcessor.cssHorizontalCoordinateToUserSpace
+ (v, CSS_WORD_SPACING_PROPERTY, uctx);
+ } else {
+ f = UnitProcessor.cssVerticalCoordinateToUserSpace
+ (v, CSS_WORD_SPACING_PROPERTY, uctx);
+ }
result.put(GVTAttributedCharacterIterator.TextAttribute.WORD_SPACING,
new Float(f));
result.put(GVTAttributedCharacterIterator.
@@ -1177,12 +1179,13 @@
// Kerning
s = element.getAttributeNS(null, SVG_KERNING_ATTRIBUTE);
if (s.length() != 0) {
- f = UnitProcessor.svgHorizontalLengthToUserSpace
- (s, SVG_KERNING_ATTRIBUTE, uctx);
-
- // XXX: Assuming horizontal length units is wrong,
- // layout might be vertical!
-
+ if (horizontal) {
+ f = UnitProcessor.svgHorizontalLengthToUserSpace
+ (s, SVG_KERNING_ATTRIBUTE, uctx);
+ } else {
+ f = UnitProcessor.svgVerticalLengthToUserSpace
+ (s, SVG_KERNING_ATTRIBUTE, uctx);
+ }
result.put(GVTAttributedCharacterIterator.TextAttribute.KERNING,
new Float(f));
result.put(GVTAttributedCharacterIterator.
@@ -1193,14 +1196,16 @@
// textLength
s = element.getAttributeNS(null, SVG_TEXT_LENGTH_ATTRIBUTE);
if (s.length() != 0) {
- f = UnitProcessor.svgHorizontalLengthToUserSpace
- (s, SVG_TEXT_LENGTH_ATTRIBUTE, uctx);
-
- // XXX: Assuming horizontal length units is wrong,
- // layout might be vertical!
-
+ if (horizontal) {
+ f = UnitProcessor.svgHorizontalLengthToUserSpace
+ (s, SVG_TEXT_LENGTH_ATTRIBUTE, uctx);
+ } else {
+ f = UnitProcessor.svgVerticalLengthToUserSpace
+ (s, SVG_TEXT_LENGTH_ATTRIBUTE, uctx);
+ }
result.put(GVTAttributedCharacterIterator.TextAttribute.BBOX_WIDTH,
new Float(f));
+
// lengthAdjust
s = element.getAttributeNS(null, SVG_LENGTH_ADJUST_ATTRIBUTE);
@@ -1216,7 +1221,6 @@
TextAttribute.LENGTH_ADJUST,
GVTAttributedCharacterIterator.TextAttribute.ADJUST_ALL);
}
-
}
return result;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]