--- SvgExporterPG.js~ 2011-08-19 15:58:00.000000000 +0200 +++ SvgExporterPG.js 2011-08-27 09:35:52.669517061 +0200 @@ -302,12 +302,29 @@ var y = this.convert(pos.y) * -1; this.writeAttribute("y", y); var h = this.text.getTextHeight(); - // this.writeAttribute("dy", h / 2); - this.writeAttribute("dy", h); + if (this.text.getVAlign() == RS.VAlignTop) { + this.writeAttribute("dy", this.convert(h)); + } else if (this.text.getVAlign() == RS.VAlignMiddle) { + this.writeAttribute("dy", this.convert(h / 2)); + } else if (this.text.getVAlign() == RS.VAlignBase) { + this.writeAttribute("dy", 0); + } else if (this.text.getVAlign() == RS.VAlignBottom) { + this.writeAttribute("dy", 0); + } this.writeFontAttributes(); var a = 360 - RMath.rad2deg(this.text.getAngle()); this.writeAttribute("transform", "scale(1,-1) rotate(" + a + " " + x + "," + y + ")"); + if (this.text.getHAlign() == RS.HAlignLeft + || this.text.getHAlign() == RS.HAlignAlign + || this.text.getHAlign() == RS.HAlignFit) { + this.writeAttribute("text-anchor", "start"); + } else if (this.text.getHAlign() == RS.HAlignRight) { + this.writeAttribute("text-anchor", "end"); + } else if (this.text.getHAlign() == RS.HAlignCenter + || this.text.getHAlign() == RS.HAlignMid) { + this.writeAttribute("text-anchor", "middle"); + } this.exportLineText(this.text.getPlainText()); this.writeEndElement("text"); // }; @@ -319,7 +336,7 @@ SvgExporterPG.prototype.writeFontAttributes = function() { this.writeAttribute("font-family", this.text.getFontName()); - var h = this.text.getTextHeight(); + var h = this.convert(this.text.getTextHeight()); // this.writeAttribute("font-size", h); this.writeAttribute("font-size", h * 1.4); // why 1.4? // this.writeAttribute("line-height", this.text.getLineSpacingFactor() * 1.1);