diff -Naubr SvgNet-master/SvgNet/AbstractGraphics.cs src/SvgNet/AbstractGraphics.cs
--- SvgNet-master/SvgNet/AbstractGraphics.cs	2015-04-21 01:30:54.000000000 +0300
+++ src/SvgNet/AbstractGraphics.cs	2015-10-06 17:47:34.438070376 +0300
@@ -13,6 +13,8 @@
 using System.Drawing.Imaging;
 using System.Drawing.Text;
 
+using SvgNet.SvgTypes;
+
 //C# code generated by Asmex
 //http://www.jbrowse.com/products/asmex
 
@@ -29,6 +31,89 @@
 	/// </summary>
 	public interface IGraphics
 	{
+		// Draw with SVG colors, pen and brushes
+		void DrawLine (SvgPen pen, Single x1, Single y1, Single x2, Single y2);
+		void DrawLine (SvgPen pen, PointF pt1, PointF pt2);
+		void DrawLines (SvgPen pen, PointF[] points);
+		void DrawLine (SvgPen pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2);
+		void DrawLine (SvgPen pen, Point pt1, Point pt2);
+		void DrawLines (SvgPen pen, Point[] points);
+		void DrawArc (SvgPen pen, Single x, Single y, Single width, Single height, Single startAngle, Single sweepAngle);
+		void DrawArc (SvgPen pen, RectangleF rect, Single startAngle, Single sweepAngle);
+		void DrawArc (SvgPen pen, Int32 x, Int32 y, Int32 width, Int32 height, Int32 startAngle, Int32 sweepAngle);
+		void DrawArc (SvgPen pen, Rectangle rect, Single startAngle, Single sweepAngle);
+		void DrawBezier (SvgPen pen, Single x1, Single y1, Single x2, Single y2, Single x3, Single y3, Single x4, Single y4);
+		void DrawBezier (SvgPen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4);
+		void DrawBeziers (SvgPen pen, PointF[] points);
+		void DrawBezier (SvgPen pen, Point pt1, Point pt2, Point pt3, Point pt4);
+		void DrawBeziers (SvgPen pen, Point[] points);
+		void DrawRectangle (SvgPen pen, Rectangle rect);
+		void DrawRectangle (SvgPen pen, Single x, Single y, Single width, Single height);
+		void DrawRectangles (SvgPen pen, RectangleF[] rects);
+		void DrawRectangle (SvgPen pen, Int32 x, Int32 y, Int32 width, Int32 height);
+		void DrawRectangles (SvgPen pen, Rectangle[] rects);
+		void DrawEllipse (SvgPen pen, RectangleF rect);
+		void DrawEllipse (SvgPen pen, Single x, Single y, Single width, Single height);
+		void DrawEllipse (SvgPen pen, Rectangle rect);
+		void DrawEllipse (SvgPen pen, Int32 x, Int32 y, Int32 width, Int32 height);
+		void DrawPie (SvgPen pen, RectangleF rect, Single startAngle, Single sweepAngle);
+		void DrawPie (SvgPen pen, Single x, Single y, Single width, Single height, Single startAngle, Single sweepAngle);
+		void DrawPie (SvgPen pen, Rectangle rect, Single startAngle, Single sweepAngle);
+		void DrawPie (SvgPen pen, Int32 x, Int32 y, Int32 width, Int32 height, Int32 startAngle, Int32 sweepAngle);
+		void DrawPolygon (SvgPen pen, PointF[] points);
+		void DrawPolygon (SvgPen pen, Point[] points);
+		void DrawPath (SvgPen pen, GraphicsPath path);
+		void DrawCurve (SvgPen pen, PointF[] points);
+		void DrawCurve (SvgPen pen, PointF[] points, Single tension);
+		void DrawCurve (SvgPen pen, PointF[] points, Int32 offset, Int32 numberOfSegments);
+		void DrawCurve (SvgPen pen, PointF[] points, Int32 offset, Int32 numberOfSegments, Single tension);
+		void DrawCurve (SvgPen pen, Point[] points);
+		void DrawCurve (SvgPen pen, Point[] points, Single tension);
+		void DrawCurve (SvgPen pen, Point[] points, Int32 offset, Int32 numberOfSegments, Single tension);
+		void DrawClosedCurve (SvgPen pen, PointF[] points);
+		void DrawClosedCurve (SvgPen pen, PointF[] points, Single tension, FillMode fillmode);
+		void DrawClosedCurve (SvgPen pen, Point[] points);
+		void DrawClosedCurve (SvgPen pen, Point[] points, Single tension, FillMode fillmode);
+
+		// fill
+		void FillRectangle (SvgBrush brush, RectangleF rect);
+		void FillRectangle (SvgBrush brush, Single x, Single y, Single width, Single height);
+		void FillRectangles (SvgBrush brush, RectangleF[] rects);
+		void FillRectangle (SvgBrush brush, Rectangle rect);
+		void FillRectangle (SvgBrush brush, Int32 x, Int32 y, Int32 width, Int32 height);
+		void FillRectangles (SvgBrush brush, Rectangle[] rects);
+		void FillPolygon (SvgBrush brush, PointF[] points);
+		void FillPolygon (SvgBrush brush, PointF[] points, FillMode fillMode);
+		void FillPolygon (SvgBrush brush, Point[] points);
+		void FillPolygon (SvgBrush brush, Point[] points, FillMode fillMode);
+		void FillEllipse (SvgBrush brush, RectangleF rect);
+		void FillEllipse (SvgBrush brush, Single x, Single y, Single width, Single height);
+		void FillEllipse (SvgBrush brush, Rectangle rect);
+		void FillEllipse (SvgBrush brush, Int32 x, Int32 y, Int32 width, Int32 height);
+		void FillPie (SvgBrush brush, Rectangle rect, Single startAngle, Single sweepAngle);
+		void FillPie (SvgBrush brush, Single x, Single y, Single width, Single height, Single startAngle, Single sweepAngle);
+		void FillPie (SvgBrush brush, Int32 x, Int32 y, Int32 width, Int32 height, Int32 startAngle, Int32 sweepAngle);
+		void FillPath (SvgBrush brush, GraphicsPath path);
+		void FillClosedCurve (SvgBrush brush, PointF[] points);
+		void FillClosedCurve (SvgBrush brush, PointF[] points, FillMode fillmode);
+		void FillClosedCurve (SvgBrush brush, PointF[] points, FillMode fillmode, Single tension);
+		void FillClosedCurve (SvgBrush brush, Point[] points);
+		void FillClosedCurve (SvgBrush brush, Point[] points, FillMode fillmode);
+		void FillClosedCurve (SvgBrush brush, Point[] points, FillMode fillmode, Single tension);
+		void FillRegion (SvgBrush brush, Region region);
+
+		// texts
+		void DrawString (String s, Font font, SvgBrush brush, Single x, Single y);
+		void DrawString (String s, Font font, SvgBrush brush, PointF point);
+		void DrawString (String s, Font font, SvgBrush brush, Single x, Single y, StringFormat format);
+		void DrawString (String s, Font font, SvgBrush brush, PointF point, StringFormat format);
+		void DrawString (String s, Font font, SvgBrush brush, RectangleF layoutRectangle);
+		void DrawString (String s, Font font, SvgBrush brush, RectangleF layoutRectangle, StringFormat format);
+
+		// clear
+		void Clear (SvgColor color);
+
+		// Old methods
 		void Flush ();
 		void Flush (FlushIntention intention);
 		void ResetTransform ();
@@ -250,6 +335,5 @@
 		System.Boolean IsClipEmpty {get; }
 		System.Drawing.RectangleF VisibleClipBounds {get; }
 		System.Boolean IsVisibleClipEmpty {get; }
-
 	}
 }
\ No newline at end of file
diff -Naubr SvgNet-master/SvgNet/FontDef.cs src/SvgNet/FontDef.cs
--- SvgNet-master/SvgNet/FontDef.cs	1970-01-01 03:00:00.000000000 +0300
+++ src/SvgNet/FontDef.cs	2015-10-06 17:40:08.941048823 +0300
@@ -0,0 +1,31 @@
+/*
+	Copyright © 2003 RiskCare Ltd. All rights reserved.
+	Copyright © 2010 SvgNet & SvgGdi Bridge Project. All rights reserved.
+	Copyright © 2015 Rafael Teixeira, Mojmír Němeček, Benjamin Peterson and Other Contributors
+
+	Original source code licensed with BSD-2-Clause spirit, treat it thus, see accompanied LICENSE for more
+*/
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace SvgNet
+{
+	public class GlyphDefInfo {
+		public float advance;
+		public string d;
+		public char u;
+	}
+
+	public class FontDefInfo {
+		public List<GlyphDefInfo> gly;
+		public GlyphDefInfo missing_gly;
+		public float advance;
+		public float units_per_em;
+		public string style;
+		public float ascent;
+		public float descent;
+		public string family;
+		public string weight;
+	}
+}
diff -Naubr SvgNet-master/SvgNet/GDIGraphics.cs src/SvgNet/GDIGraphics.cs
--- SvgNet-master/SvgNet/GDIGraphics.cs	2015-04-21 01:30:54.000000000 +0300
+++ src/SvgNet/GDIGraphics.cs	2015-10-06 18:23:50.210175641 +0300
@@ -13,6 +13,8 @@
 using System.Drawing.Imaging;
 using System.Drawing.Text;
 
+using SvgNet.SvgTypes;
+
 namespace SvgNet.SvgGdi
 {
 	/// <summary>
@@ -41,6 +43,8 @@
 		public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, PointF[] pts){_g.TransformPoints(destSpace, srcSpace, pts) ;}
 		public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, Point[] pts){_g.TransformPoints(destSpace, srcSpace, pts) ;}
 		public System.Drawing.Color GetNearestColor (Color color){return _g.GetNearestColor(color) ;}
+
+		// GDI implementation
 		public void DrawLine (Pen pen, Single x1, Single y1, Single x2, Single y2){_g.DrawLine(pen,x1,y1,x2,y2) ;}
 		public void DrawLine (Pen pen, PointF pt1, PointF pt2){_g.DrawLine(pen, pt1, pt2) ;}
 		public void DrawLines (Pen pen, PointF[] points){_g.DrawLines(pen, points) ;}
@@ -115,6 +119,87 @@
 		public void DrawString (String s, Font font, Brush brush, PointF point, StringFormat format){_g.DrawString(s,font,brush,point,format) ;}
 		public void DrawString (String s, Font font, Brush brush, RectangleF layoutRectangle){_g.DrawString(s,font,brush,layoutRectangle) ;}
 		public void DrawString (String s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format){_g.DrawString(s,font,brush,layoutRectangle,format) ;}
+
+		// SVG implementation
+		public void DrawLine (SvgPen pen, Single x1, Single y1, Single x2, Single y2){_g.DrawLine(pen.Pen,x1,y1,x2,y2) ;}
+		public void DrawLine (SvgPen pen, PointF pt1, PointF pt2){_g.DrawLine(pen.Pen, pt1, pt2) ;}
+		public void DrawLines (SvgPen pen, PointF[] points){_g.DrawLines(pen.Pen, points) ;}
+		public void DrawLine (SvgPen pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2){_g.DrawLine(pen.Pen, x1, y1, x2, y2) ;}
+		public void DrawLine (SvgPen pen, Point pt1, Point pt2){_g.DrawLine(pen.Pen, pt1, pt2) ;}
+		public void DrawLines (SvgPen pen, Point[] points){_g.DrawLines(pen.Pen, points) ;}
+		public void DrawArc (SvgPen pen, Single x, Single y, Single width, Single height, Single startAngle, Single sweepAngle){_g.DrawArc(pen.Pen, x,y,width,height,startAngle, sweepAngle) ;}
+		public void DrawArc (SvgPen pen, RectangleF rect, Single startAngle, Single sweepAngle){_g.DrawArc(pen.Pen, rect, startAngle, sweepAngle) ;}
+		public void DrawArc (SvgPen pen, Int32 x, Int32 y, Int32 width, Int32 height, Int32 startAngle, Int32 sweepAngle){_g.DrawArc(pen.Pen, x,y,width,height,startAngle,sweepAngle) ;}
+		public void DrawArc (SvgPen pen, Rectangle rect, Single startAngle, Single sweepAngle){_g.DrawArc(pen.Pen, rect, startAngle, sweepAngle) ;}
+		public void DrawBezier (SvgPen pen, Single x1, Single y1, Single x2, Single y2, Single x3, Single y3, Single x4, Single y4){_g.DrawBezier(pen.Pen,x1,y1,x2,y2,x3,y3,x4,y4) ;}
+		public void DrawBezier (SvgPen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4){_g.DrawBezier(pen.Pen, pt1,pt2,pt3,pt4) ;}
+		public void DrawBeziers (SvgPen pen, PointF[] points){_g.DrawBeziers(pen.Pen, points) ;}
+		public void DrawBezier (SvgPen pen, Point pt1, Point pt2, Point pt3, Point pt4){_g.DrawBezier(pen.Pen, pt1,pt2,pt3,pt4) ;}
+		public void DrawBeziers (SvgPen pen, Point[] points){_g.DrawBeziers(pen.Pen, points) ;}
+		public void DrawRectangle (SvgPen pen, Rectangle rect){_g.DrawRectangle(pen.Pen, rect) ;}
+		public void DrawRectangle (SvgPen pen, Single x, Single y, Single width, Single height){_g.DrawRectangle(pen.Pen, x,y,width,height) ;}
+		public void DrawRectangles (SvgPen pen, RectangleF[] rects){_g.DrawRectangles(pen.Pen,rects) ;}
+		public void DrawRectangle (SvgPen pen, Int32 x, Int32 y, Int32 width, Int32 height){_g.DrawRectangle(pen.Pen,x,y,width,height) ;}
+		public void DrawRectangles (SvgPen pen, Rectangle[] rects){_g.DrawRectangles(pen.Pen, rects) ;}
+		public void DrawEllipse (SvgPen pen, RectangleF rect){_g.DrawEllipse(pen.Pen, rect) ;}
+		public void DrawEllipse (SvgPen pen, Single x, Single y, Single width, Single height){_g.DrawEllipse(pen.Pen,x,y,width,height) ;}
+		public void DrawEllipse (SvgPen pen, Rectangle rect){_g.DrawEllipse(pen.Pen,rect) ;}
+		public void DrawEllipse (SvgPen pen, Int32 x, Int32 y, Int32 width, Int32 height){_g.DrawEllipse(pen.Pen,x,y,width,height) ;}
+		public void DrawPie (SvgPen pen, RectangleF rect, Single startAngle, Single sweepAngle){_g.DrawPie(pen.Pen,rect,startAngle,sweepAngle) ;}
+		public void DrawPie (SvgPen pen, Single x, Single y, Single width, Single height, Single startAngle, Single sweepAngle){_g.DrawPie(pen.Pen,x,y,width,height,startAngle,sweepAngle) ;}
+		public void DrawPie (SvgPen pen, Rectangle rect, Single startAngle, Single sweepAngle){_g.DrawPie(pen.Pen, rect, startAngle, sweepAngle) ;}
+		public void DrawPie (SvgPen pen, Int32 x, Int32 y, Int32 width, Int32 height, Int32 startAngle, Int32 sweepAngle){_g.DrawPie(pen.Pen,x,y,width,height,startAngle,sweepAngle) ;}
+		public void DrawPolygon (SvgPen pen, PointF[] points){_g.DrawPolygon(pen.Pen,points) ;}
+		public void DrawPolygon (SvgPen pen, Point[] points){_g.DrawPolygon(pen.Pen,points) ;}
+		public void DrawPath (SvgPen pen, GraphicsPath path){_g.DrawPath(pen.Pen, path) ;}
+		public void DrawCurve (SvgPen pen, PointF[] points){_g.DrawCurve(pen.Pen, points) ;}
+		public void DrawCurve (SvgPen pen, PointF[] points, Single tension){_g.DrawCurve(pen.Pen,points,tension) ;}
+		public void DrawCurve (SvgPen pen, PointF[] points, Int32 offset, Int32 numberOfSegments){_g.DrawCurve(pen.Pen, points,offset,numberOfSegments) ;}
+		public void DrawCurve (SvgPen pen, PointF[] points, Int32 offset, Int32 numberOfSegments, Single tension){_g.DrawCurve(pen.Pen, points,offset,numberOfSegments,tension) ;}
+		public void DrawCurve (SvgPen pen, Point[] points){_g.DrawCurve(pen.Pen, points) ;}
+		public void DrawCurve (SvgPen pen, Point[] points, Single tension){_g.DrawCurve(pen.Pen, points, tension) ;}
+		public void DrawCurve (SvgPen pen, Point[] points, Int32 offset, Int32 numberOfSegments, Single tension){_g.DrawCurve(pen.Pen, points, offset, numberOfSegments, tension) ;}
+		public void DrawClosedCurve (SvgPen pen, PointF[] points){_g.DrawClosedCurve(pen.Pen, points) ;}
+		public void DrawClosedCurve (SvgPen pen, PointF[] points, Single tension, FillMode fillmode){_g.DrawClosedCurve(pen.Pen, points, tension, fillmode) ;}
+		public void DrawClosedCurve (SvgPen pen, Point[] points){_g.DrawClosedCurve(pen.Pen, points) ;}
+		public void DrawClosedCurve (SvgPen pen, Point[] points, Single tension, FillMode fillmode){_g.DrawClosedCurve(pen.Pen, points, tension, fillmode) ;}
+
+		public void Clear (SvgColor color){_g.Clear(color.BrushColor) ;}
+		
+		public void FillRectangle (SvgBrush brush, RectangleF rect){_g.FillRectangle(brush.Brush,rect) ;}
+		public void FillRectangle (SvgBrush brush, Single x, Single y, Single width, Single height){_g.FillRectangle(brush.Brush,x,y,width,height) ;}
+		public void FillRectangles (SvgBrush brush, RectangleF[] rects){_g.FillRectangles(brush.Brush,rects) ;}
+		public void FillRectangle (SvgBrush brush, Rectangle rect){_g.FillRectangle(brush.Brush,rect) ;}
+		public void FillRectangle (SvgBrush brush, Int32 x, Int32 y, Int32 width, Int32 height){_g.FillRectangle(brush.Brush,x,y,width,height) ;}
+		public void FillRectangles (SvgBrush brush, Rectangle[] rects){_g.FillRectangles(brush.Brush,rects) ;}
+		public void FillPolygon (SvgBrush brush, PointF[] points){_g.FillPolygon(brush.Brush,points) ;}
+		public void FillPolygon (SvgBrush brush, PointF[] points, FillMode fillMode){_g.FillPolygon(brush.Brush,points,fillMode) ;}
+		public void FillPolygon (SvgBrush brush, Point[] points){_g.FillPolygon(brush.Brush,points) ;}
+		public void FillPolygon (SvgBrush brush, Point[] points, FillMode fillMode){_g.FillPolygon(brush.Brush,points,fillMode) ;}
+		public void FillEllipse (SvgBrush brush, RectangleF rect){_g.FillEllipse(brush.Brush,rect) ;}
+		public void FillEllipse (SvgBrush brush, Single x, Single y, Single width, Single height){_g.FillEllipse(brush.Brush,x,y,width,height) ;}
+		public void FillEllipse (SvgBrush brush, Rectangle rect){_g.FillEllipse(brush.Brush,rect) ;}
+		public void FillEllipse (SvgBrush brush, Int32 x, Int32 y, Int32 width, Int32 height){_g.FillEllipse(brush.Brush,x,y,width,height) ;}
+		public void FillPie (SvgBrush brush, Rectangle rect, Single startAngle, Single sweepAngle){_g.FillPie(brush.Brush,rect,startAngle,sweepAngle) ;}
+		public void FillPie (SvgBrush brush, Single x, Single y, Single width, Single height, Single startAngle, Single sweepAngle){_g.FillPie(brush.Brush,x,y,width,height,startAngle,sweepAngle) ;}
+		public void FillPie (SvgBrush brush, Int32 x, Int32 y, Int32 width, Int32 height, Int32 startAngle, Int32 sweepAngle){_g.FillPie(brush.Brush,x,y,width,height,startAngle,sweepAngle) ;}
+		public void FillPath (SvgBrush brush, GraphicsPath path){_g.FillPath(brush.Brush,path) ;}
+		public void FillClosedCurve (SvgBrush brush, PointF[] points){_g.FillClosedCurve(brush.Brush,points) ;}
+		public void FillClosedCurve (SvgBrush brush, PointF[] points, FillMode fillmode){_g.FillClosedCurve(brush.Brush,points,fillmode) ;}
+		public void FillClosedCurve (SvgBrush brush, PointF[] points, FillMode fillmode, Single tension){_g.FillClosedCurve(brush.Brush,points,fillmode,tension) ;}
+		public void FillClosedCurve (SvgBrush brush, Point[] points){_g.FillClosedCurve(brush.Brush,points) ;}
+		public void FillClosedCurve (SvgBrush brush, Point[] points, FillMode fillmode){_g.FillClosedCurve(brush.Brush,points,fillmode) ;}
+		public void FillClosedCurve (SvgBrush brush, Point[] points, FillMode fillmode, Single tension){_g.FillClosedCurve(brush.Brush,points,fillmode,tension) ;}
+		public void FillRegion (SvgBrush brush, Region region){_g.FillRegion(brush.Brush,region) ;}
+
+		public void DrawString (String s, Font font, SvgBrush brush, Single x, Single y){_g.DrawString(s,font,brush.Brush,x,y) ;}
+		public void DrawString (String s, Font font, SvgBrush brush, PointF point){_g.DrawString(s,font,brush.Brush,point) ;}
+		public void DrawString (String s, Font font, SvgBrush brush, Single x, Single y, StringFormat format){_g.DrawString(s,font,brush.Brush,x,y,format) ;}
+		public void DrawString (String s, Font font, SvgBrush brush, PointF point, StringFormat format){_g.DrawString(s,font,brush.Brush,point,format) ;}
+		public void DrawString (String s, Font font, SvgBrush brush, RectangleF layoutRectangle){_g.DrawString(s,font,brush.Brush,layoutRectangle) ;}
+		public void DrawString (String s, Font font, SvgBrush brush, RectangleF layoutRectangle, StringFormat format){_g.DrawString(s,font,brush.Brush,layoutRectangle,format) ;}
+
+		// other methods
 		public System.Drawing.SizeF MeasureString (String text, Font font, SizeF layoutArea, StringFormat stringFormat, out Int32 charactersFitted, out Int32 linesFilled){int a, b; SizeF siz = _g.MeasureString(text,font,layoutArea,stringFormat,out a,out b); charactersFitted = a; linesFilled = b; return siz;}
 		public System.Drawing.SizeF MeasureString (String text, Font font, PointF origin, StringFormat stringFormat){return _g.MeasureString(text,font,origin,stringFormat) ;}
 		public System.Drawing.SizeF MeasureString (String text, Font font, SizeF layoutArea){return _g.MeasureString(text,font,layoutArea) ;}
@@ -122,6 +207,7 @@
 		public System.Drawing.SizeF MeasureString (String text, Font font){return _g.MeasureString(text,font) ;}
 		public System.Drawing.SizeF MeasureString (String text, Font font, Int32 width){return _g.MeasureString(text,font,width) ;}
 		public System.Drawing.SizeF MeasureString (String text, Font font, Int32 width, StringFormat format){return _g.MeasureString(text,font,width,format) ;}
+
 		public System.Drawing.Region[] MeasureCharacterRanges (String text, Font font, RectangleF layoutRect, StringFormat stringFormat){return _g.MeasureCharacterRanges(text,font,layoutRect,stringFormat) ;}
 		public void DrawIcon (Icon icon, Int32 x, Int32 y){_g.DrawIcon(icon,x,y) ;}
 		public void DrawIcon (Icon icon, Rectangle targetRect){_g.DrawIcon(icon,targetRect) ;}
diff -Naubr SvgNet-master/SvgNet/SvgColors.cs src/SvgNet/SvgColors.cs
--- SvgNet-master/SvgNet/SvgColors.cs	1970-01-01 03:00:00.000000000 +0300
+++ src/SvgNet/SvgColors.cs	2015-10-06 21:44:53.762759282 +0300
@@ -0,0 +1,559 @@
+/*
+	Copyright © 2003 RiskCare Ltd. All rights reserved.
+	Copyright © 2010 SvgNet & SvgGdi Bridge Project. All rights reserved.
+	Copyright © 2015 Rafael Teixeira, Mojmír Němeček, Benjamin Peterson and Other Contributors
+
+	Original source code licensed with BSD-2-Clause spirit, treat it thus, see accompanied LICENSE for more
+*/
+using System;
+using System.Collections;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+using System.Globalization;
+using System.Text.RegularExpressions;
+using System.Drawing.Imaging;
+
+namespace SvgNet.SvgTypes
+{
+	public class SvgPen : ICloneable
+	{
+		public SvgBrush Brush { get; set; }
+		public SvgColor Color { get { return new SvgColor(Brush); } }
+		public float Width { get; set; }
+
+		public SvgPen(SvgBrush b, float w = 1.0f, 
+			DashStyle style = System.Drawing.Drawing2D.DashStyle.Solid,
+			DashCap cap = System.Drawing.Drawing2D.DashCap.Flat,
+			float offset = 0, float[] pattern = null,
+			PenAlignment align = System.Drawing.Drawing2D.PenAlignment.Center,
+			LineJoin join = System.Drawing.Drawing2D.LineJoin.Miter, 
+			LineCap scap = System.Drawing.Drawing2D.LineCap.Flat,
+			LineCap ecap = System.Drawing.Drawing2D.LineCap.Flat,
+			CustomLineCap cscap = null,
+			CustomLineCap cecap = null,
+			Matrix at = null) 
+		{  
+			Brush = b;
+			Width = w;
+			Alignment = align;
+			DashCap = cap;
+			DashPattern = pattern;
+			DashStyle = style;
+			LineJoin = join;
+			Transform = at;
+			StartCap = scap;
+			EndCap = ecap;
+			CustomStartCap = cscap;
+			CustomEndCap = cecap;
+		}
+
+		public SvgPen(Pen pen) {
+			Brush = new SvgBrush(((SolidBrush)pen.Brush).Color);
+			Width = pen.Width;
+			Alignment = pen.Alignment;
+			DashCap = pen.DashCap;
+			DashPattern = pen.DashPattern;
+			DashStyle = pen.DashStyle;
+			LineJoin = pen.LineJoin;
+			Transform = pen.Transform;
+			StartCap = pen.StartCap;
+			EndCap = pen.EndCap;
+			try {
+				CustomStartCap = pen.CustomStartCap;
+				CustomEndCap = pen.CustomEndCap;
+			}
+			catch {
+			}
+		}
+		
+		public virtual object Clone() {
+			return new SvgPen((SvgBrush)Brush.Clone(), Width, DashStyle,
+				DashCap, DashOffset, DashPattern, Alignment,
+				LineJoin, StartCap, EndCap, 
+				CustomStartCap, CustomEndCap,
+				(Matrix)Transform.Clone() );
+		}
+ 
+		public Pen Pen { 
+			get { 
+				Pen pen = new Pen(Brush.Brush, Width); 
+    			pen.Alignment = Alignment;
+    			pen.DashCap = DashCap;
+    			pen.DashPattern = DashPattern;
+    			pen.DashStyle = DashStyle;
+    			pen.LineJoin = LineJoin;
+    			pen.Transform = Transform;
+    			pen.StartCap = StartCap;
+    			pen.EndCap = EndCap;
+				pen.CustomEndCap = CustomEndCap;
+				pen.CustomStartCap = CustomStartCap;
+				return pen;
+			} 
+		}
+
+		public PenAlignment Alignment { get; set; }
+		public DashCap DashCap { get; set; }
+		public float DashOffset { get; set; }
+		public float[] DashPattern { get; set; }
+		public DashStyle DashStyle { get; set; }
+		public LineJoin LineJoin { get; set; }
+		public float MiterLimit { get; set; }
+		public PenType PenType { get { return System.Drawing.Drawing2D.PenType.SolidColor; } }
+		public LineCap EndCap { get; set; }
+		public LineCap StartCap { get; set; }
+		public Matrix Transform { get; set; }
+		public CustomLineCap CustomEndCap { get; set; }
+		public CustomLineCap CustomStartCap { get; set; }
+	}
+	
+	public class SvgBrush : ICloneable 
+	{
+		public int R { get; set; }
+		public int G { get; set; }
+		public int B { get; set; }
+		public int A { get; set; }
+
+		public float C { get; set; }
+		public float M { get; set; }
+		public float Y { get; set; }
+		public float K { get; set; }
+
+		public bool HasCmyk { get; set; }
+
+		public SvgBrush (int r, int g, int b, int a = 255) {
+			R = r;
+			G = g;
+			B = b;
+			A = a;
+
+			C = M = Y = K = 0;
+			HasCmyk = false;
+
+			checkIfWhiteOrBlack();
+		}
+
+		public SvgBrush (
+			float c, float m, float y, float k,
+			int r, int g, int b, int a = 255) 
+		{
+			C = c;
+			M = m;
+			Y = y;
+			K = k;
+
+			R = r;
+			G = g;
+			B = b;
+			A = a;
+
+			HasCmyk = true;
+		}
+		
+		private const int K_EOF = 0;
+		private const int K_LBR = 1;
+		private const int K_RBR = 2;
+		private const int K_NUM = 3;
+		private const int K_RGB = 4;
+		private const int K_COM = 5;
+		private const int K_CMY = 6;
+		private const int K_UNK = 7;
+		private const int K_HNM = 8;
+		private const int K_FLN = 9;
+		private const int K_ICC = 10;
+
+		private static string ackTok(string s, ref int j) {
+			int k = j;
+			while(j < s.Length && (s[j] == '-' || Char.IsLetterOrDigit(s[j]) )) ++j;
+			string z = s.Substring(k, j - k);
+			return z;
+		}
+
+		private static void skipSpaces(string s, ref int j) {
+			while(j < s.Length && (Char.IsWhiteSpace(s[j]) || s[j] == '-')) ++j;
+		}
+
+		private static string nextToken(string s, ref int j, out int kind) {
+			if(j >= s.Length) {
+				kind = K_EOF;
+				return "";
+			}
+			
+			skipSpaces(s, ref j);
+			if(s[j] == '#' || 
+					(s.Length > j + 2 && s[j] == '0' && s[j+1] == 'x')) { 
+				// hex num
+				kind = K_HNM;
+				j += s[j] == '#' ? 1 : 2;
+				return ackTok(s, ref j);
+			}
+			else if(Char.IsDigit(s[j])) { 
+				// just number
+				kind = K_NUM;
+				string z0 = ackTok(s, ref j);
+				if(s[j] == '.') {
+					++j;
+					string z1 = ackTok(s, ref j);
+					kind = K_FLN;
+					z0 += '.' + z1;
+				}
+				return z0;
+			}
+			else if(s[j] == ',' || s[j] == ';') {
+				kind = K_COM;
+				++j;
+				return ",";
+			}
+			else if(s[j] == 'r' || s[j] == 'R') {
+				kind = K_RGB;
+				return ackTok(s, ref j);
+			}
+			else if(s[j] == 'i' || s[j] == 'I') { // icc-color
+				kind = K_ICC;
+				return ackTok(s, ref j);
+			}
+			else if(s[j] == 'c' || s[j] == 'C') {
+				kind = K_CMY;
+				return ackTok(s, ref j);
+			}
+			else if(s[j] == '(' || s[j] == '[') {
+				kind = K_LBR;
+				++j;
+				return "(";
+			}
+			else if(s[j] == ')' || s[j] == ']') {
+				kind = K_RBR;
+				++j;
+				return "(";
+			}
+			else {
+				kind = K_UNK;
+				return ackTok(s, ref j);
+			}
+		}
+
+		public SvgBrush (String colorString) {
+			// possible forms are
+			// [#|0x]xxxxxxxx | rgb(x,y,z) | rgba (x,y,z,a) [, cmyk(x,y,z,a)]
+			// black | white
+
+			if (string.IsNullOrEmpty(colorString))
+			{
+				throw new ArgumentException("Color value cannot be empty", "colorString");
+			}
+
+			int k;
+			int j = 0;
+			long argb, cp;
+			float[] f = new float[4];
+			int t;
+			for(t = 0; t < 4; ++t) f[t] = 0.0f;
+			HasCmyk = false;
+
+ 			string tok = nextToken(colorString, ref j, out k);
+
+ 			if (k == K_EOF) // empty string
+ 				throw new ArgumentException(colorString + ": unexpected EOF");
+
+ 			// named colors
+ 			if(colorString.ToLower().Trim().Equals("white") || colorString.ToLower().Trim().Equals("control")) {
+				C = White.C;
+				M = White.M;
+				Y = White.Y;
+				K = White.K;
+
+				R = White.R;
+				G = White.G;
+				B = White.B;
+				A = White.A;
+
+				HasCmyk = true;
+				//Console.WriteLine("SvgBrush('"+colorString+"') => " + this);
+ 				return;	
+ 			}
+
+ 			if(colorString.ToLower().Trim().Equals("black")) {
+				C = Black.C;
+				M = Black.M;
+				Y = Black.Y;
+				K = Black.K;
+
+				R = Black.R;
+				G = Black.G;
+				B = Black.B;
+				A = Black.A;
+
+				HasCmyk = true;
+				//Console.WriteLine("SvgBrush('"+colorString+"') => " + this);
+ 				return;	
+ 			}
+
+ 			switch(k) {
+ 			case K_HNM: // classic ARGB
+ 				argb = Int32.Parse(tok, NumberStyles.HexNumber) | unchecked((int)0xFF000000);
+ 				B = (int)( argb        & 0xFF);
+ 				G = (int)((argb >>  8) & 0xFF);
+ 				R = (int)((argb >> 16) & 0xFF);
+ 				A = (int)((argb >> 24) & 0xFF);
+				checkIfWhiteOrBlack();
+ 				break;
+ 			case K_RGB:  // Note: it composes to ABGR not ARGB
+ 				argb = 0;
+ 				tok = nextToken(colorString, ref j, out k);
+ 				if(k != K_LBR)
+ 					throw new ArgumentException(
+ 						colorString + ": unexpected token `" + tok + "` before pos " + j + 
+ 						", expected `(` after rgb/rgba");
+ 				for(t = 0; t < 4;) {
+	 				tok = nextToken(colorString, ref j, out k);
+	 				if(k == K_RBR) break;
+	 				if(k == K_COM) continue;
+	 				if(k == K_EOF)
+		 				throw new ArgumentException(
+ 							colorString + ": unexpected EOF within rgb(...) specification, `)` expected");
+
+	 				switch(k) {
+	 				case K_NUM:
+	 					cp = Int32.Parse(tok);
+	 					break;
+	 				case K_HNM:
+	 					cp = Int32.Parse(tok, NumberStyles.HexNumber);
+	 					break;
+	 				case K_FLN:
+	 					cp = (int)(Single.Parse(tok, CultureInfo.InvariantCulture) * 255.0);
+	 					break;
+	 				default:
+		 				throw new ArgumentException(
+ 							colorString + ": unexpected token `" + tok + "` before pos " + j + 
+		 					"within RGB spec, expected comma-separated list of numbers");
+	 				}
+	 				if(t > 0) cp <<= 8 * t;
+	 				argb |= cp;
+	 				++t;
+ 				}
+
+ 				if(t < 4) argb |= 0xFF000000;
+ 				if(k != K_RBR) 
+ 					tok = nextToken(colorString, ref j, out k);
+ 				if(k != K_RBR)
+ 					throw new ArgumentException(
+ 						colorString + ": unexpected token `" + tok + "` before pos " + j + 
+ 						", expected `)` after rgb/rgba");
+ 			
+ 			    // abgr
+ 				R = (int)( argb        & 0xFF);
+ 				G = (int)((argb >>  8) & 0xFF);
+ 				B = (int)((argb >> 16) & 0xFF);
+ 				A = (int)((argb >> 24) & 0xFF);
+				checkIfWhiteOrBlack();
+ 				break;
+ 			case K_UNK:
+ 			default:
+ 				throw new ArgumentException(
+ 					colorString + ": unexpected token `" + tok + "` before pos " + j + 
+ 					", expected one of rgb(...), rgba (...), #RRGGBB, 0xRRGGBB");
+ 			}
+
+			tok = nextToken(colorString, ref j, out k);
+			if(k == K_EOF){ 
+				checkIfWhiteOrBlack();
+				//Console.WriteLine("SvgBrush('"+colorString+"') => " + this);
+				return;
+			}
+			if(k == K_COM) 
+				tok = nextToken(colorString, ref j, out k);
+			if(k != K_CMY && k != K_ICC)
+ 				throw new ArgumentException(
+ 					colorString + ": unexpected token `" + tok + "` before pos " + j + 
+ 					", expected cmyk(...) | icc-color(CMYK,...) specification");
+			tok = nextToken(colorString, ref j, out k);
+			if(k != K_LBR)
+				throw new ArgumentException(
+					colorString + ": unexpected token `" + tok + "` before pos " + j + 
+					", expected `(` after cmyk");
+
+			for(t = 0; t < 4;) {
+ 				tok = nextToken(colorString, ref j, out k);
+ 				if(k == K_RBR)
+	 				throw new ArgumentException(
+						colorString + ": unexpected ')' within cmyk(...) specification, " + t + " of 4 parts are found");
+ 				if(k == K_COM) continue;
+ 				if(k == K_CMY) continue; // icc-color(CMYK,...
+ 				if(k == K_EOF)
+	 				throw new ArgumentException(
+						colorString + ": unexpected EOF within cmyk(...) specification, `)` expected");
+
+ 				switch(k) {
+ 				case K_NUM:
+					f[t] = Single.Parse(tok, CultureInfo.InvariantCulture);
+ 					if(f[t] > 1) f[t] /= 255.0f;
+ 					break;
+ 				case K_HNM:
+ 					f[t] = Int32.Parse(tok, NumberStyles.HexNumber) / 255.0f;
+ 					break;
+ 				case K_FLN:
+					f[t] = Single.Parse(tok, CultureInfo.InvariantCulture);
+ 					break;
+ 				default:
+	 				throw new ArgumentException(
+						colorString + ": unexpected token `" + tok + "` before pos " + j + 
+	 					"within cmyk spec, expected comma-separated list of numbers");
+ 				}
+ 				++t;
+			}
+
+			tok = nextToken(colorString, ref j, out k);
+			if(k == K_COM) 
+				tok = nextToken(colorString, ref j, out k);
+			if(k != K_RBR)
+				throw new ArgumentException(
+					colorString + ": unexpected token `" + tok + "` before pos " + j + 
+					", expected `)` after cmyk(...");
+			tok = nextToken(colorString, ref j, out k);
+			if(k == K_COM) 
+				tok = nextToken(colorString, ref j, out k);
+			if(k != K_EOF)
+				throw new ArgumentException(
+					colorString + ": unexpected token `" + tok + "` before pos " + j + 
+					", expected EOF");
+			C = f[0];
+			M = f[1];
+			Y = f[2];
+			K = f[3];
+			HasCmyk = true;
+			A = 255;
+			//Console.WriteLine("SvgBrush('"+colorString+"') => " + this);
+		}
+
+		private void checkIfWhiteOrBlack() {
+			if(this.Equals(White) && !HasCmyk) { // Alpha is not used in comparisons
+				C = White.C;
+				M = White.M;
+				Y = White.Y;
+				K = White.K;
+				HasCmyk = true;
+			}
+			else if(this.Equals(Black) && !HasCmyk) {
+				C = Black.C;
+				M = Black.M;
+				Y = Black.Y;
+				K = Black.K;
+				HasCmyk = true;
+			}
+		}
+
+		public static readonly SvgBrush Black = new SvgBrush(0.0f, 0.0f, 0.0f, 1.0f, 0, 0, 0);
+		public static readonly SvgBrush White = new SvgBrush(0.0f, 0.0f, 0.0f, 0.0f, 255, 255, 255);
+		public static readonly SvgBrush None  = new SvgBrush(128, 0, 0, 1); // indesign uses it!
+
+		public SvgBrush (SolidBrush b) : this(b.Color.R, b.Color.G, b.Color.B, b.Color.A) {}
+		public SvgBrush (Color b) : this(b.R, b.G, b.B, b.A) {}
+
+		public virtual object Clone() {
+			return HasCmyk ? new SvgBrush(C, M, Y, K, R, G, B, A) : new SvgBrush(R, G, B, A);
+		}
+
+		private String format(float f) {
+			return String.Format(CultureInfo.InvariantCulture, "{0:0.0###}", f);
+		}
+
+		public override string ToString () {
+			if(this.Equals(Black)) return "black";
+			if(this.Equals(None)) return "none";
+
+			string s = "rgb(";
+			s += R.ToString(CultureInfo.InvariantCulture);
+			s += ",";
+			s += G.ToString(CultureInfo.InvariantCulture);
+			s += ",";
+			s += B.ToString(CultureInfo.InvariantCulture);
+			s += ")";
+
+			if(false && HasCmyk) { /* VK: disable icc for browsers */
+				s += " icc-color(CMYK,";
+				s += format(C);
+				s += ",";
+				s += format(M);
+				s += ",";
+				s += format(Y);
+				s += ",";
+				s += format(K);
+				s += ")";
+			}
+			return s;
+		}
+
+		public override int GetHashCode() {
+			return (int)(R << 16 + G << 8 + B);
+		}
+
+		public override bool Equals(object o) {
+			if(o == null) return false;
+			if(o is SvgPen) o = ((SvgPen)o).Brush;
+			if(o is SvgColor) o = ((SvgColor)o).Brush;
+			if(!(o is SvgBrush)) return false;
+			SvgBrush b = (SvgBrush)o;
+			return R == b.R && G == b.G && B == b.B;
+		}
+
+		public Brush Brush { get { return new SolidBrush(System.Drawing.Color.FromArgb(A, R, G, B)); } }
+		public SvgColor Color { get { return new SvgColor(this); } }
+	}
+
+	public class SvgColor : ICloneable
+	{
+		private SvgBrush _col;
+		private string _original_string;
+
+		private static Hashtable _stdcols = new Hashtable();
+
+		public int A { get { return _col.A; } }
+
+		public SvgColor(SvgBrush c) {
+	    	_col = c;
+		}
+
+		public SvgColor(string s) {
+	    	_col = new SvgBrush(s);
+			_original_string = s;
+		}
+
+		public SvgColor(SvgBrush c, string s) {
+	    	_col = c;
+			_original_string = s;
+		}
+
+		public SvgColor(Brush c) {
+	    	_col = new SvgBrush((SolidBrush)c);
+		}
+
+		public SvgColor(Brush c, string s) {
+	    	_col = new SvgBrush((SolidBrush)c);
+			_original_string = s;
+		}
+
+		public SvgBrush Brush {
+			get{return _col;}
+			set{_col = value;}
+		}
+
+		public System.Drawing.Color BrushColor { get { return System.Drawing.Color.FromArgb(_col.A, _col.R, _col.G, _col.B); } }
+
+		public static SvgColor FromName(String name) { return new SvgColor( name );	}
+		public virtual object Clone() {	return new SvgColor((SvgBrush)_col.Clone(), _original_string); }
+
+		public override string ToString()
+		{
+			return _col.ToString();
+		}
+
+		public static implicit operator SvgColor(SvgBrush c)
+		{
+			return new SvgColor(c);
+		}
+
+		public static implicit operator SvgColor(string s)
+		{
+			return new SvgColor(s);
+		}
+	}
+}
diff -Naubr SvgNet-master/SvgNet/SvgElement.cs src/SvgNet/SvgElement.cs
--- SvgNet-master/SvgNet/SvgElement.cs	2015-04-21 01:30:54.000000000 +0300
+++ src/SvgNet/SvgElement.cs	2015-10-06 17:40:22.973049502 +0300
@@ -60,7 +60,7 @@
 		{
 			_children = new ArrayList();
 			_atts = new Hashtable();
-			Id = _idcounter.ToString();
+			Id = _idcounter.ToString(System.Globalization.CultureInfo.InvariantCulture);
 			_idcounter++;
 		}
 
@@ -149,23 +134,20 @@
 
 			XmlDocument doc = new XmlDocument();
 
-			var declaration = doc.CreateXmlDeclaration("1.0", null, "yes");
-			doc.AppendChild(declaration);
-
 			//write out our SVG tree to the new XmlDocument
 			WriteXmlElements(doc, null);
 
-			doc.DocumentElement.SetAttribute("xmlns", "http://www.w3.org/2000/svg");
-
 			if (compressAttributes)
 				ents = SvgFactory.CompressXML(doc, doc.DocumentElement);
 
 			doc.XmlResolver = new DummyXmlResolver();
+			/*
 			doc.InsertAfter(
 				doc.CreateDocumentType("svg", "-//W3C//DTD SVG 1.1//EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd", ents),
 				declaration
 			);
+			*/

 			//This complicated business of writing to a memory stream and then reading back out to a string
 			//is necessary in order to specify UTF8 -- for some reason the default is UTF16 (which makes most renderers
 			//give up)
@@ -173,7 +172,9 @@
 			MemoryStream ms = new MemoryStream();
 			XmlTextWriter wr = new XmlTextWriter(ms, new UTF8Encoding());
 
			wr.Formatting = Formatting.None; // Indented formatting would be nice for debugging but causes unwanted trailing white spaces between <text> and <tspan> elements in Internet Explorer
+			wr.WriteStartDocument(true);
+			wr.WriteDocType("svg", "-//W3C//DTD SVG 1.1//EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd", ents);
 			doc.Save(wr);
 
 			byte[] buf = ms.ToArray();
diff -Naubr SvgNet-master/SvgNet/SvgElementFactory.cs src/SvgNet/SvgElementFactory.cs
--- SvgNet-master/SvgNet/SvgElementFactory.cs	2015-04-21 01:30:54.000000000 +0300
+++ src/SvgNet/SvgElementFactory.cs	2015-10-06 17:40:22.973049502 +0300
@@ -228,16 +209,16 @@
 					if(entities[val] == null)
 					{
 						idx += 1;
-						entname = "E"+idx.ToString();
+						entname = "E" + idx.ToString(System.Globalization.CultureInfo.InvariantCulture);
 						entities[val] = entname;

						singletons[val] = new EntitySingleton() { Element = el, AttributeName = s };
 					}
 					else
 					{
 						entname = (string)entities[val];

						singletons.Remove(val);
 					}
 
 					XmlAttribute attr = doc.CreateAttribute(s);
diff -Naubr SvgNet-master/SvgNet/SvgFontElement.cs src/SvgNet/SvgFontElement.cs
--- SvgNet-master/SvgNet/SvgFontElement.cs	1970-01-01 03:00:00.000000000 +0300
+++ src/SvgNet/SvgFontElement.cs	2015-10-06 17:40:46.656050648 +0300
@@ -0,0 +1,71 @@
+/*
+	Copyright © 2003 RiskCare Ltd. All rights reserved.
+	Copyright © 2010 SvgNet & SvgGdi Bridge Project. All rights reserved.
+	Copyright © 2015 Rafael Teixeira, Mojmír Němeček, Benjamin Peterson and Other Contributors
+
+	Original source code licensed with BSD-2-Clause spirit, treat it thus, see accompanied LICENSE for more
+*/
+using System;
+using System.Collections;
+using System.Xml;
+using System.Text;
+using System.IO;
+using SvgNet.SvgTypes;
+
+namespace SvgNet
+{
+	public class SvgFontElement : SvgElement
+	{
+		public SvgFontElement() {}
+		public SvgFontElement(string id) : base(id)	{}
+
+		private FontDefInfo info;
+
+		public FontDefInfo Font 
+		{
+			get { return info; }
+			set { info = value; }
+		}
+		
+		public override void ReadXmlElement(XmlDocument doc, XmlElement el)	{ }
+
+		public override void WriteXmlElements(XmlDocument doc, XmlElement parent)
+		{
+			XmlElement font = doc.CreateElement("font");
+			//font.SetAttribute("horiz-adv-x", "" + info.advance); /* not configured and optional as evbery glyph has right one */
+			font.SetAttribute("id", Id);
+
+			XmlElement face = doc.CreateElement("font-face");
+			face.SetAttribute("ascent",  "" + info.ascent);
+			face.SetAttribute("font-style", info.style);
+			face.SetAttribute("descent", "" + info.descent);
+			face.SetAttribute("units-per-em", "" + info.units_per_em);
+			face.SetAttribute("font-family", info.family);
+			face.SetAttribute("font-weight", info.weight);
+			font.AppendChild(face);
+			
+			XmlElement mg = doc.CreateElement("missing-glyph");
+			mg.SetAttribute("horiz-adv-x", "" + info.missing_gly.advance);
+			mg.SetAttribute("d", info.missing_gly.d);
+			font.AppendChild(mg);
+
+			foreach(var k in info.gly) {
+				XmlElement g = doc.CreateElement("glyph");
+				g.SetAttribute("unicode", "" + k.u);
+				g.SetAttribute("horiz-adv-x", "" + k.advance);
+				g.SetAttribute("d", k.d);
+				font.AppendChild(g);
+			}
+
+			if(parent == null)
+				doc.AppendChild(font);
+			else
+				parent.AppendChild(font);
+			
+			foreach(SvgElement el in _children)
+			{
+				el.WriteXmlElements(doc, font);
+			}
+		}
+	}
+}
diff -Naubr SvgNet-master/SvgNet/SVGGDINotImpl.cs src/SvgNet/SVGGDINotImpl.cs
--- SvgNet-master/SvgNet/SVGGDINotImpl.cs	2015-04-21 01:30:54.000000000 +0300
+++ src/SvgNet/SVGGDINotImpl.cs	2015-10-06 17:40:51.751050894 +0300
@@ -6,7 +6,6 @@
 	Original source code licensed with BSD-2-Clause spirit, treat it thus, see accompanied LICENSE for more
 */
 
-
 using System;
 
 namespace SvgNet.SvgGdi
diff -Naubr SvgNet-master/SvgNet/SVGGraphics.cs src/SvgNet/SVGGraphics.cs
--- SvgNet-master/SvgNet/SVGGraphics.cs	2015-04-21 01:30:54.000000000 +0300
+++ src/SvgNet/SVGGraphics.cs	2015-10-06 21:44:33.230758289 +0300
@@ -13,6 +13,7 @@
 using System.Drawing.Drawing2D;
 using System.Drawing.Imaging;
 using System.Drawing.Text;
+using System.Globalization;
 using SvgNet.SvgElements;
 using SvgNet.SvgTypes;
 using System.Collections;
@@ -1213,23 +1213,73 @@
		//a default graphics so that we can make a guess as to functions like MeasureString
		static Graphics _g;
 
+		public float? Width
+		{
+			get { return _root.Attributes.ContainsKey("width") ? (float?)_root.Width.Value : null; }
+			set
+			{
+				if (value.HasValue)
+				{
+					_root.Width = new SvgLength(value.Value);
+				}
+				else
+				{
+					_root.Attributes.Remove("width");
+				}
+				_root.ViewBox = _root.Width != null && _root.Height != null ? 
+					new SvgNumList(new float[] { 0f, 0f, (float)_root.Width.Value, (float)_root.Height.Value }) :
+					null;
+			}
+		}
+
+		public float? Height
+		{
+			get
+			{
+				if (_root.Attributes.ContainsKey("height"))
+				{
+					return _root.Height.Value;
+				}
+				return null;
+			}
+			set
+			{
+				if (value.HasValue)
+				{
+					_root.Height = new SvgLength(value.Value);
+				}
+				else
+				{
+					_root.Attributes.Remove("height");
+				}
+				_root.ViewBox = _root.Width != null && _root.Height != null ? 
+					new SvgNumList(new float[] { 0f, 0f, (float)_root.Width.Value, (float)_root.Height.Value }) :
+					null;
+			}
+		}
+
+		public SvgGraphics(float width, float height)
+			: this()
+		{
+			_root.Width = new SvgLength(width, SvgLengthType.SVG_LENGTHTYPE_PT);
+			_root.Height = new SvgLength(height, SvgLengthType.SVG_LENGTHTYPE_PT);
+			_root.ViewBox = new SvgNumList(new float[] { 0f, 0f, width, height });
+		}
+
 		public SvgGraphics()
 		{
 			_root = new SvgSvgElement();
 			_root.Id = "SvgGdi_output";
+			_root.Version = "1.2";
+
+			_defs = new SvgDefsElement("clips_hatches_and_gradients");
+			_root.AddChild(_defs);
 
-			_bg = new SvgRectElement(0, 0, "100%", "100%");
-			_bg.Style.Set("fill", new SvgColor(Color.FromName("Control")));
-			_bg.Id = "background";
-			_root.AddChild(_bg);
 
 			_topgroup = new SvgGroupElement("root_group");
 			_topgroup.Style.Set("shape-rendering", "crispEdges");
 			_cur = _topgroup;
 			_root.AddChild(_topgroup);
 
-			_defs = new SvgDefsElement("clips_hatches_and_gradients");
-			_root.AddChild(_defs);
-
 			_transforms = new MatrixStack();
 		}
@@ -1239,6 +1295,11 @@
 		/// </summary>
 		public string WriteSVGString()
 		{
+			if(_root.Width != null && _root.Height != null) {
+			    _root.ViewBox = new SvgNumList(new float[] { 0f, 0f, _root.Width.Value, _root.Height.Value });
+
+			}
+		    _root.Attributes["overflow"] = "visible";
 			return _root.WriteSVGString(true);
 		}
 
@@ -1350,9 +1411,16 @@
 		/// </summary>
 		public void DrawLine(Pen pen, Single x1, Single y1, Single x2, Single y2)
 		{
+		    DrawLine(new SvgPen(pen), x1, y1, x2, y2);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawLine(SvgPen pen, Single x1, Single y1, Single x2, Single y2)
+		{
 			if (IsEndAnchorSimple(pen.StartCap) && IsEndAnchorSimple(pen.EndCap))
 			{
-				// This code works, but not for CustomLineCup style
 				SvgLineElement lin = new SvgLineElement(x1, y1, x2, y2);
 				lin.Style = new SvgStyle(pen);
 				if (!_transforms.Result.IsIdentity)
@@ -1378,25 +1446,23 @@
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void DrawLines(Pen pen, PointF[] points)
+		public void DrawLine(SvgPen pen, PointF pt1, PointF pt2)
 		{
-			if (points.Length <= 1)
-				return;
+			DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y);
+		}
 
-			if (IsEndAnchorSimple(pen.StartCap) && IsEndAnchorSimple(pen.EndCap))
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawLines(Pen pen, PointF[] points)
 			{
-				// This code works, but not for CustomLineCap style
-				SvgPolylineElement pl = new SvgPolylineElement(points);
-				pl.Style = new SvgStyle(pen);
-				if (!_transforms.Result.IsIdentity)
-					pl.Transform = new SvgTransformList(_transforms.Top.Clone());
-				_cur.AddChild(pl);
-
-				DrawEndAnchors(pen, points[0], points[points.Length - 1]);
-
-				return;
+			DrawLines(new SvgPen(pen), points);
 			}
 
+		private void DrawCustomLines(SvgPen svgPen, PointF[] points)
+		{
+			Pen pen = svgPen.Pen;
+
 			// GraphicsPaths used in the constructor of CustomLineCap
 			// are private to the native GDI+ and for example the shape of AdjustableArrowCap
 			// is completely private to the native GDI+
@@ -1477,7 +1543,7 @@
 					metafileIsEmpty = false;
 
 					SvgPolylineElement pl = new SvgPolylineElement(linePoints);
-					pl.Style = new SvgStyle(pen);
+					pl.Style = new SvgStyle(svgPen);
 
 					// Make it pretty
 					pl.Style.Set("stroke-linecap", "round");
@@ -1506,12 +1572,12 @@
 					}
 
 					SvgPolylineElement pl = new SvgPolylineElement(points);
-					pl.Style = new SvgStyle(pen);
+					pl.Style = new SvgStyle(svgPen);
 					if (!_transforms.Result.IsIdentity)
 						pl.Transform = new SvgTransformList(_transforms.Top.Clone());
 					_cur.AddChild(pl);
 
-					DrawEndAnchors(pen, points[0], points[points.Length - 1], ignoreUnsupportedLineCaps: true);
+					DrawEndAnchors(svgPen, points[0], points[points.Length - 1], true);
 				}
 			}
 		}
@@ -1519,8 +1585,38 @@
 		/// <summary>
 		/// Implemented
 		/// </summary>
+		public void DrawLines(SvgPen pen, PointF[] points)
+		{
+			if (points.Length <= 1)
+				return;
+
+			if (IsEndAnchorSimple(pen.StartCap) && IsEndAnchorSimple(pen.EndCap))
+			{
+    			SvgPolylineElement pl = new SvgPolylineElement(points);
+    			pl.Style = new SvgStyle(pen);
+    			if (!_transforms.Result.IsIdentity)
+    				pl.Transform = new SvgTransformList(_transforms.Top.Clone());
+    			_cur.AddChild(pl);
+
+    			DrawEndAnchors(pen, points[0], points[points.Length - 1]);
+			}
+
+			DrawCustomLines(pen, points);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
 		public void DrawLine(Pen pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2)
 		{
+			DrawLine(new SvgPen(pen), (Single)x1, (Single)y1, (Single)x2, (Single)y2);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawLine(SvgPen pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2)
+		{
 			DrawLine(pen, (Single)x1, (Single)y1, (Single)x2, (Single)y2);
 		}
 
@@ -1529,6 +1625,14 @@
 		/// </summary>
 		public void DrawLine(Pen pen, Point pt1, Point pt2)
 		{
+			DrawLine(new SvgPen(pen), (Single)pt1.X, (Single)pt1.Y, (Single)pt2.X, (Single)pt2.Y);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawLine(SvgPen pen, Point pt1, Point pt2)
+		{
 			DrawLine(pen, (Single)pt1.X, (Single)pt1.Y, (Single)pt2.X, (Single)pt2.Y);
 		}
 
@@ -1538,6 +1642,15 @@
 		public void DrawLines(Pen pen, Point[] points)
 		{
 			PointF[] pts = Point2PointF(points);
+			DrawLines(new SvgPen(pen), pts);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawLines(SvgPen pen, Point[] points)
+		{
+			PointF[] pts = Point2PointF(points);
 			DrawLines(pen, pts);
 		}
 
@@ -1546,6 +1659,14 @@
 		/// </summary>
 		public void DrawArc(Pen pen, Single x, Single y, Single width, Single height, Single startAngle, Single sweepAngle)
 		{
+			DrawArc(new SvgPen(pen), x, y, width, height, startAngle, sweepAngle);
+		}
+
+		/// <summary>
+		/// Implemented.  <c>DrawArc</c> functions work correctly and thus produce different output from GDI+ if the ellipse is not circular.
+		/// </summary>
+		public void DrawArc(SvgPen pen, Single x, Single y, Single width, Single height, Single startAngle, Single sweepAngle)
+		{
 			string s = GDIArc2SVGPath(x, y, width, height, startAngle, sweepAngle, false);
 
 			SvgPathElement arc = new SvgPathElement();
@@ -1583,14 +1704,46 @@
 		/// <summary>
 		/// Implemented
 		/// </summary>
+		public void DrawArc(SvgPen pen, RectangleF rect, Single startAngle, Single sweepAngle)
+		{
+			DrawArc(pen, rect.X, rect.X, rect.Width, rect.Height, startAngle, sweepAngle);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawArc(SvgPen pen, Int32 x, Int32 y, Int32 width, Int32 height, Int32 startAngle, Int32 sweepAngle)
+		{
+			DrawArc(pen, (Single)x, (Single)y, (Single)width, (Single)height, (Single)startAngle, (Single)sweepAngle);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawArc(SvgPen pen, Rectangle rect, Single startAngle, Single sweepAngle)
+		{
+			DrawArc(pen, (Single)rect.X, (Single)rect.X, (Single)rect.Width, (Single)rect.Height, (Single)startAngle, (Single)sweepAngle);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
 		public void DrawBezier(Pen pen, Single x1, Single y1, Single x2, Single y2, Single x3, Single y3, Single x4, Single y4)
 		{
+			DrawBezier(new SvgPen(pen), x1, y1, x2, y2, x3, y3, x4, y4);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawBezier(SvgPen pen, Single x1, Single y1, Single x2, Single y2, Single x3, Single y3, Single x4, Single y4)
+		{
 			SvgPathElement bez = new SvgPathElement();
 
-			bez.D = "M " + x1.ToString("F", System.Globalization.CultureInfo.InvariantCulture) + " " + y1.ToString("F", System.Globalization.CultureInfo.InvariantCulture) + " C " +
-				x2.ToString("F", System.Globalization.CultureInfo.InvariantCulture) + " " + y2.ToString("F", System.Globalization.CultureInfo.InvariantCulture) + " " +
-				x3.ToString("F", System.Globalization.CultureInfo.InvariantCulture) + " " + y3.ToString("F", System.Globalization.CultureInfo.InvariantCulture) + " " +
-				x4.ToString("F", System.Globalization.CultureInfo.InvariantCulture) + " " + y4.ToString("F", System.Globalization.CultureInfo.InvariantCulture);
+			bez.D = "M " + x1.ToString(CultureInfo.InvariantCulture) + " " + y1.ToString(CultureInfo.InvariantCulture) + " C " +
+				x2.ToString(CultureInfo.InvariantCulture) + " " + y2.ToString(CultureInfo.InvariantCulture) + " " +
+				x3.ToString(CultureInfo.InvariantCulture) + " " + y3.ToString(CultureInfo.InvariantCulture) + " " +
+				x4.ToString(CultureInfo.InvariantCulture) + " " + y4.ToString(CultureInfo.InvariantCulture);
 
 			bez.Style = new SvgStyle(pen);
 			if (!_transforms.Result.IsIdentity)
@@ -1609,14 +1762,48 @@
 		/// <summary>
 		/// Implemented
 		/// </summary>
+		public void DrawBezier(SvgPen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4)
+		{
+			DrawBezier(pen, pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
 		public void DrawBeziers(Pen pen, PointF[] points)
 		{
+			DrawBeziers(new SvgPen(pen), points);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawBezier(Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)
+		{
+			DrawBezier(pen, (Single)pt1.X, (Single)pt1.Y, (Single)pt2.X, (Single)pt2.Y, (Single)pt3.X, (Single)pt3.Y, (Single)pt4.X, (Single)pt4.Y);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawBeziers(Pen pen, Point[] points)
+		{
+			PointF[] pts = Point2PointF(points);
+			DrawBeziers(new SvgPen(pen), pts);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawBeziers(SvgPen pen, PointF[] points)
+		{
 			SvgPathElement bez = new SvgPathElement();
 
-			string s = "M " + points[0].X.ToString("F", System.Globalization.CultureInfo.InvariantCulture) + " " + points[0].Y.ToString("F", System.Globalization.CultureInfo.InvariantCulture) + " C ";
+			string s = "M " + points[0].X.ToString(CultureInfo.InvariantCulture) + " " + points[0].Y.ToString(CultureInfo.InvariantCulture) + " C ";
 
-			for (int i = 1; i < points.Length; ++i) {
-				s += points[i].X.ToString("F", System.Globalization.CultureInfo.InvariantCulture) + " " + points[i].Y.ToString("F", System.Globalization.CultureInfo.InvariantCulture) + " ";
+			for (int i = 1; i < points.Length; ++i)
+			{
+				s += points[i].X.ToString(CultureInfo.InvariantCulture) + " " + points[i].Y.ToString(CultureInfo.InvariantCulture) + " ";
 			}
 
 			bez.D = s;
@@ -1630,7 +1817,7 @@
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void DrawBezier(Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)
+		public void DrawBezier(SvgPen pen, Point pt1, Point pt2, Point pt3, Point pt4)
 		{
 			DrawBezier(pen, (Single)pt1.X, (Single)pt1.Y, (Single)pt2.X, (Single)pt2.Y, (Single)pt3.X, (Single)pt3.Y, (Single)pt4.X, (Single)pt4.Y);
 		}
@@ -1638,7 +1825,7 @@
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void DrawBeziers(Pen pen, Point[] points)
+		public void DrawBeziers(SvgPen pen, Point[] points)
 		{
 			PointF[] pts = Point2PointF(points);
 			DrawBeziers(pen, pts);
@@ -1657,11 +1844,7 @@
 		/// </summary>
 		public void DrawRectangle(Pen pen, Single x, Single y, Single width, Single height)
 		{
-			SvgRectElement rc = new SvgRectElement(x, y, width, height);
-			rc.Style = new SvgStyle(pen);
-			if (!_transforms.Result.IsIdentity)
-				rc.Transform = new SvgTransformList(_transforms.Result.Clone());
-			_cur.AddChild(rc);
+			DrawRectangle(new SvgPen(pen), x, y, width, height);
 		}
 
 		/// <summary>
@@ -1695,110 +1878,250 @@
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void DrawEllipse(Pen pen, RectangleF rect)
+		public void DrawRectangle(SvgPen pen, Rectangle rect)
 		{
-			DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height);
+			DrawRectangle(pen, (Single)rect.Left, (Single)rect.Top, (Single)rect.Width, (Single)rect.Height);
+		}
+
+		public void DrawRectangle(SvgPen pen, RectangleF rect)
+		{
+			DrawRectangle(pen, (Single)rect.Left, (Single)rect.Top, (Single)rect.Width, (Single)rect.Height);
 		}
 
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void DrawEllipse(Pen pen, Single x, Single y, Single width, Single height)
+		public void DrawRectangle(SvgPen pen, Single x, Single y, Single width, Single height)
 		{
-			SvgEllipseElement el = new SvgEllipseElement(x + width / 2, y + height / 2, width / 2, height / 2);
-			el.Style = new SvgStyle(pen);
+			SvgRectElement rc = new SvgRectElement(x, y, width, height);
+			rc.Style = new SvgStyle(pen);
 			if (!_transforms.Result.IsIdentity)
-				el.Transform = new SvgTransformList(_transforms.Result.Clone());
-			_cur.AddChild(el);
+				rc.Transform = new SvgTransformList(_transforms.Result.Clone());
+			_cur.AddChild(rc);
 		}
 
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void DrawEllipse(Pen pen, Rectangle rect)
+		public void DrawRectangles(SvgPen pen, RectangleF[] rects)
 		{
-			DrawEllipse(pen, (Single)rect.X, (Single)rect.Y, (Single)rect.Width, (Single)rect.Height);
+			foreach (RectangleF rc in rects)
+			{
+				DrawRectangle(pen, rc.Left, rc.Top, rc.Width, rc.Height);
+			}
 		}
 
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void DrawEllipse(Pen pen, Int32 x, Int32 y, Int32 width, Int32 height)
+		public void DrawRectangle(SvgPen pen, Int32 x, Int32 y, Int32 width, Int32 height)
 		{
-			DrawEllipse(pen, (Single)x, (Single)y, (Single)width, (Single)height);
+			DrawRectangle(pen, (Single)x, (Single)y, (Single)width, (Single)height);
 		}
 
 		/// <summary>
-		/// Implemented.  <c>DrawPie</c> functions work correctly and thus produce different output from GDI+ if the ellipse is not circular.
+		/// Implemented
 		/// </summary>
-		public void DrawPie(Pen pen, Single x, Single y, Single width, Single height, Single startAngle, Single sweepAngle)
+		public void DrawRectangles(SvgPen pen, Rectangle[] rects)
 		{
-			string s = GDIArc2SVGPath(x, y, width, height, startAngle, sweepAngle, true);
-
-			SvgPathElement pie = new SvgPathElement();
-			pie.D = s;
-			pie.Style = new SvgStyle(pen);
-			if (!_transforms.Result.IsIdentity)
-				pie.Transform = new SvgTransformList(_transforms.Result.Clone());
-
-			_cur.AddChild(pie);
+			foreach (Rectangle rc in rects)
+			{
+				DrawRectangle(pen, (Single)rc.Left, (Single)rc.Top, (Single)rc.Width, (Single)rc.Height);
+			}
 		}
 
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void DrawPie(Pen pen, RectangleF rect, Single startAngle, Single sweepAngle)
+		public void DrawEllipse(Pen pen, RectangleF rect)
 		{
-			DrawPie(pen, rect.X, rect.X, rect.Width, rect.Height, startAngle, sweepAngle);
+			DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height);
 		}
 
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void DrawPie(Pen pen, Int32 x, Int32 y, Int32 width, Int32 height, Int32 startAngle, Int32 sweepAngle)
+		public void DrawEllipse(Pen pen, Single x, Single y, Single width, Single height)
 		{
-			DrawPie(pen, (Single)x, (Single)y, (Single)width, (Single)height, (Single)startAngle, (Single)sweepAngle);
+			DrawEllipse(new SvgPen(pen), x, y, width, height);
 		}
 
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void DrawPie(Pen pen, Rectangle rect, Single startAngle, Single sweepAngle)
+		public void DrawEllipse(Pen pen, Rectangle rect)
 		{
-			DrawPie(pen, (Single)rect.X, (Single)rect.X, (Single)rect.Width, (Single)rect.Height, (Single)startAngle, (Single)sweepAngle);
+			DrawEllipse(pen, (Single)rect.X, (Single)rect.Y, (Single)rect.Width, (Single)rect.Height);
 		}
 
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void DrawPolygon(Pen pen, PointF[] points)
+		public void DrawEllipse(Pen pen, Int32 x, Int32 y, Int32 width, Int32 height)
 		{
-			SvgPolygonElement pl = new SvgPolygonElement(points);
-			pl.Style = new SvgStyle(pen);
-			if (!_transforms.Result.IsIdentity)
-				pl.Transform = new SvgTransformList(_transforms.Result.Clone());
-			_cur.AddChild(pl);
+			DrawEllipse(pen, (Single)x, (Single)y, (Single)width, (Single)height);
 		}
 
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void DrawPolygon(Pen pen, Point[] points)
+		public void DrawEllipse(SvgPen pen, RectangleF rect)
 		{
-			PointF[] pts = Point2PointF(points);
-			DrawPolygon(pen, pts);
+			DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height);
 		}
 
-
 		/// <summary>
-		/// Not implemented because GDI+ regions/paths are not emulated.
+		/// Implemented
 		/// </summary>
-		public void DrawPath(Pen pen, GraphicsPath path) { throw new SvgGdiNotImpl("DrawPath (Pen pen, GraphicsPath path)"); }
-
+		public void DrawEllipse(SvgPen pen, Single x, Single y, Single width, Single height)
+		{
+			SvgEllipseElement el = new SvgEllipseElement(x + width / 2, y + height / 2, width / 2, height / 2);
+			el.Style = new SvgStyle(pen);
+			if (!_transforms.Result.IsIdentity)
+				el.Transform = new SvgTransformList(_transforms.Result.Clone());
+			_cur.AddChild(el);
+		}
 
 		/// <summary>
-		/// Implemented.  The <c>DrawCurve</c> functions emulate GDI behavior by drawing a coaligned cubic bezier.  This seems to produce
-		/// a very good approximation so probably GDI+ does the same.
+		/// Implemented
+		/// </summary>
+		public void DrawEllipse(SvgPen pen, Rectangle rect)
+		{
+			DrawEllipse(pen, (Single)rect.X, (Single)rect.Y, (Single)rect.Width, (Single)rect.Height);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawEllipse(SvgPen pen, Int32 x, Int32 y, Int32 width, Int32 height)
+		{
+			DrawEllipse(pen, (Single)x, (Single)y, (Single)width, (Single)height);
+		}
+
+		/// <summary>
+		/// Implemented.  <c>DrawPie</c> functions work correctly and thus produce different output from GDI+ if the ellipse is not circular.
+		/// </summary>
+		public void DrawPie(Pen pen, Single x, Single y, Single width, Single height, Single startAngle, Single sweepAngle)
+		{
+			DrawPie(new SvgPen(pen), x, y, width, height, startAngle, sweepAngle);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawPie(Pen pen, RectangleF rect, Single startAngle, Single sweepAngle)
+		{
+			DrawPie(pen, rect.X, rect.X, rect.Width, rect.Height, startAngle, sweepAngle);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawPie(Pen pen, Int32 x, Int32 y, Int32 width, Int32 height, Int32 startAngle, Int32 sweepAngle)
+		{
+			DrawPie(pen, (Single)x, (Single)y, (Single)width, (Single)height, (Single)startAngle, (Single)sweepAngle);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawPie(Pen pen, Rectangle rect, Single startAngle, Single sweepAngle)
+		{
+			DrawPie(pen, (Single)rect.X, (Single)rect.X, (Single)rect.Width, (Single)rect.Height, (Single)startAngle, (Single)sweepAngle);
+		}
+
+		/// <summary>
+		/// Implemented.  <c>DrawPie</c> functions work correctly and thus produce different output from GDI+ if the ellipse is not circular.
+		/// </summary>
+		public void DrawPie(SvgPen pen, Single x, Single y, Single width, Single height, Single startAngle, Single sweepAngle)
+		{
+			string s = GDIArc2SVGPath(x, y, width, height, startAngle, sweepAngle, true);
+
+			SvgPathElement pie = new SvgPathElement();
+			pie.D = s;
+			pie.Style = new SvgStyle(pen);
+			if (!_transforms.Result.IsIdentity)
+				pie.Transform = new SvgTransformList(_transforms.Result.Clone());
+
+			_cur.AddChild(pie);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawPie(SvgPen pen, RectangleF rect, Single startAngle, Single sweepAngle)
+		{
+			DrawPie(pen, rect.X, rect.X, rect.Width, rect.Height, startAngle, sweepAngle);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawPie(SvgPen pen, Int32 x, Int32 y, Int32 width, Int32 height, Int32 startAngle, Int32 sweepAngle)
+		{
+			DrawPie(pen, (Single)x, (Single)y, (Single)width, (Single)height, (Single)startAngle, (Single)sweepAngle);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawPie(SvgPen pen, Rectangle rect, Single startAngle, Single sweepAngle)
+		{
+			DrawPie(pen, (Single)rect.X, (Single)rect.X, (Single)rect.Width, (Single)rect.Height, (Single)startAngle, (Single)sweepAngle);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawPolygon(Pen pen, PointF[] points)
+		{
+			DrawPolygon(new SvgPen(pen), points);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawPolygon(Pen pen, Point[] points)
+		{
+			PointF[] pts = Point2PointF(points);
+			DrawPolygon(new SvgPen(pen), pts);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawPolygon(SvgPen pen, PointF[] points)
+		{
+			SvgPolygonElement pl = new SvgPolygonElement(points);
+			pl.Style = new SvgStyle(pen);
+			if (!_transforms.Result.IsIdentity)
+				pl.Transform = new SvgTransformList(_transforms.Result.Clone());
+			_cur.AddChild(pl);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawPolygon(SvgPen pen, Point[] points)
+		{
+			PointF[] pts = Point2PointF(points);
+			DrawPolygon(pen, pts);
+		}
+
+		/// <summary>
+		/// Not implemented because GDI+ regions/paths are not emulated.
+		/// </summary>
+		public void DrawPath(Pen pen, GraphicsPath path) { throw new SvgGdiNotImpl("DrawPath (Pen pen, GraphicsPath path)"); }
+
+		/// <summary>
+		/// Not implemented because GDI+ regions/paths are not emulated.
+		/// </summary>
+		public void DrawPath(SvgPen pen, GraphicsPath path) { throw new SvgGdiNotImpl("DrawPath (SvgPen pen, GraphicsPath path)"); }
+
+
+		/// <summary>
+		/// Implemented.  The <c>DrawCurve</c> functions emulate GDI behavior by drawing a coaligned cubic bezier.  This seems to produce
+		/// a very good approximation so probably GDI+ does the same.
 		/// </summary>
 		public void DrawCurve(Pen pen, PointF[] points)
 		{
@@ -1898,12 +2221,121 @@
 		}
 
 		/// <summary>
+		/// Implemented.  The <c>DrawCurve</c> functions emulate GDI behavior by drawing a coaligned cubic bezier.  This seems to produce
+		/// a very good approximation so probably GDI+ does the same.
+		/// </summary>
+		public void DrawCurve(SvgPen pen, PointF[] points)
+		{
+			PointF[] pts = Spline2Bez(points, 0, points.Length - 1, false, .5f);
+			DrawBeziers(pen, pts);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawCurve(SvgPen pen, PointF[] points, Single tension)
+		{
+			PointF[] pts = Spline2Bez(points, 0, points.Length - 1, false, tension);
+			DrawBeziers(pen, pts);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawCurve(SvgPen pen, PointF[] points, Int32 offset, Int32 numberOfSegments)
+		{
+			PointF[] pts = Spline2Bez(points, offset, numberOfSegments, false, .5f);
+			DrawBeziers(pen, pts);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawCurve(SvgPen pen, PointF[] points, Int32 offset, Int32 numberOfSegments, Single tension)
+		{
+			PointF[] pts = Spline2Bez(points, offset, numberOfSegments, false, tension);
+			DrawBeziers(pen, pts);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawCurve(SvgPen pen, Point[] points)
+		{
+			PointF[] pts = Spline2Bez(Point2PointF(points), 0, points.Length - 1, false, .5f);
+			DrawBeziers(pen, pts);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawCurve(SvgPen pen, Point[] points, Single tension)
+		{
+			PointF[] pts = Spline2Bez(Point2PointF(points), 0, points.Length - 1, false, tension);
+			DrawBeziers(pen, pts);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawCurve(SvgPen pen, Point[] points, Int32 offset, Int32 numberOfSegments, Single tension)
+		{
+			PointF[] pts = Spline2Bez(Point2PointF(points), offset, numberOfSegments, false, tension);
+			DrawBeziers(pen, pts);
+		}
+
+		/// <summary>
+		/// Implemented.  The <c>DrawClosedCurve</c> functions emulate GDI behavior by drawing a coaligned cubic bezier.  This seems to produce
+		/// a very good approximation so probably GDI+ does the same thing -- a
+		/// </summary>
+		public void DrawClosedCurve(SvgPen pen, PointF[] points)
+		{
+			PointF[] pts = Spline2Bez(points, 0, points.Length - 1, true, .5f);
+			DrawBeziers(pen, pts);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawClosedCurve(SvgPen pen, PointF[] points, Single tension, FillMode fillmode)
+		{
+			PointF[] pts = Spline2Bez(points, 0, points.Length - 1, true, tension);
+			DrawBeziers(pen, pts);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawClosedCurve(SvgPen pen, Point[] points)
+		{
+			PointF[] pts = Spline2Bez(Point2PointF(points), 0, points.Length - 1, true, .5f);
+			DrawBeziers(pen, pts);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawClosedCurve(SvgPen pen, Point[] points, Single tension, FillMode fillmode)
+		{
+			PointF[] pts = Spline2Bez(Point2PointF(points), 0, points.Length - 1, true, tension);
+			DrawBeziers(pen, pts);
+		}
+
+		/// <summary>
 		/// Implemented
 		/// </summary>
 		public void Clear(Color color)
 		{
+			Clear(new SvgColor(new SvgBrush(color)));
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void Clear(SvgColor color)
+		{
 			_cur.Children.Clear();
-			_bg.Style.Set("fill", new SvgColor(color));
+			_bg.Style.Set("fill", color);
 		}
 
 		/// <summary>
@@ -1965,6 +2397,64 @@
 		/// <summary>
 		/// Implemented
 		/// </summary>
+		public void FillRectangle(SvgBrush brush, RectangleF rect)
+		{
+			FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillRectangle(SvgBrush brush, Single x, Single y, Single width, Single height)
+		{
+			SvgRectElement rc = new SvgRectElement(x, y, width, height);
+			rc.Style = HandleBrush(brush);
+			if (!_transforms.Result.IsIdentity)
+				rc.Transform = _transforms.Result.Clone();
+			_cur.AddChild(rc);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillRectangles(SvgBrush brush, RectangleF[] rects)
+		{
+			foreach (RectangleF rc in rects)
+			{
+				FillRectangle(brush, rc);
+			}
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillRectangle(SvgBrush brush, Rectangle rect)
+		{
+			FillRectangle(brush, (Single)rect.X, (Single)rect.Y, (Single)rect.Width, (Single)rect.Height);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillRectangle(SvgBrush brush, Int32 x, Int32 y, Int32 width, Int32 height)
+		{
+			FillRectangle(brush, (Single)x, (Single)y, (Single)width, (Single)height);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillRectangles(SvgBrush brush, Rectangle[] rects)
+		{
+			foreach (Rectangle rc in rects)
+			{
+				FillRectangle(brush, rc);
+			}
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
 		public void FillPolygon(Brush brush, PointF[] points)
 		{
 			FillPolygon(brush, points, FillMode.Alternate);
@@ -2009,6 +2499,53 @@
 		/// <summary>
 		/// Implemented
 		/// </summary>
+		public void FillPolygon(SvgBrush brush, PointF[] points)
+		{
+			FillPolygon(brush, points, FillMode.Alternate);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillPolygon(SvgBrush brush, Point[] points)
+		{
+			PointF[] pts = Point2PointF(points);
+			FillPolygon(brush, pts, FillMode.Alternate);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillPolygon(SvgBrush brush, PointF[] points, FillMode fillmode)
+		{
+			SvgPolygonElement pl = new SvgPolygonElement(points);
+			pl.Style = HandleBrush(brush);
+			if (fillmode == FillMode.Alternate)
+			{
+				pl.Style.Set("fill-rule", "evenodd");
+			}
+			else
+			{
+				pl.Style.Set("fill-rule", "nonzero");
+			}
+
+			if (!_transforms.Result.IsIdentity)
+				pl.Transform = new SvgTransformList(_transforms.Result.Clone());
+			_cur.AddChild(pl);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillPolygon(SvgBrush brush, Point[] points, FillMode fillmode)
+		{
+			PointF[] pts = Point2PointF(points);
+			FillPolygon(brush, pts, fillmode);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
 		public void FillEllipse(Brush brush, RectangleF rect)
 		{
 			FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height);
@@ -2043,47 +2580,174 @@
 		}
 
 		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillEllipse(SvgBrush brush, RectangleF rect)
+		{
+			FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillEllipse(SvgBrush brush, Single x, Single y, Single width, Single height)
+		{
+			SvgEllipseElement el = new SvgEllipseElement(x + width / 2, y + height / 2, width / 2, height / 2);
+			el.Style = HandleBrush(brush);
+			if (!_transforms.Result.IsIdentity)
+				el.Transform = new SvgTransformList(_transforms.Result.Clone());
+			_cur.AddChild(el);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillEllipse(SvgBrush brush, Rectangle rect)
+		{
+			FillEllipse(brush, (Single)rect.X, (Single)rect.Y, (Single)rect.Width, (Single)rect.Height);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillEllipse(SvgBrush brush, Int32 x, Int32 y, Int32 width, Int32 height)
+		{
+			FillEllipse(brush, (Single)x, (Single)y, (Single)width, (Single)height);
+		}
+
+		/// <summary>
 		/// Implemented <c>FillPie</c> functions work correctly and thus produce different output from GDI+ if the ellipse is not circular.
 		/// </summary>
-		public void FillPie(Brush brush, Rectangle rect, Single startAngle, Single sweepAngle)
+		public void FillPie(Brush brush, Rectangle rect, Single startAngle, Single sweepAngle)
+		{
+			FillPie(brush, (Single)rect.X, (Single)rect.Y, (Single)rect.Width, (Single)rect.Height, startAngle, sweepAngle);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillPie(Brush brush, Single x, Single y, Single width, Single height, Single startAngle, Single sweepAngle)
+		{
+			string s = GDIArc2SVGPath(x, y, width, height, startAngle, sweepAngle, true);
+
+			SvgPathElement pie = new SvgPathElement();
+			pie.D = s;
+			pie.Style = HandleBrush(brush);
+			if (!_transforms.Result.IsIdentity)
+				pie.Transform = new SvgTransformList(_transforms.Result.Clone());
+
+			_cur.AddChild(pie);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillPie(Brush brush, Int32 x, Int32 y, Int32 width, Int32 height, Int32 startAngle, Int32 sweepAngle)
+		{
+			FillPie(brush, (Single)x, (Single)y, (Single)width, (Single)height, startAngle, sweepAngle);
+		}
+
+		/// <summary>
+		/// Implemented <c>FillPie</c> functions work correctly and thus produce different output from GDI+ if the ellipse is not circular.
+		/// </summary>
+		public void FillPie(SvgBrush brush, Rectangle rect, Single startAngle, Single sweepAngle)
+		{
+			FillPie(brush, (Single)rect.X, (Single)rect.Y, (Single)rect.Width, (Single)rect.Height, startAngle, sweepAngle);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillPie(SvgBrush brush, Single x, Single y, Single width, Single height, Single startAngle, Single sweepAngle)
+		{
+			string s = GDIArc2SVGPath(x, y, width, height, startAngle, sweepAngle, true);
+
+			SvgPathElement pie = new SvgPathElement();
+			pie.D = s;
+			pie.Style = HandleBrush(brush);
+			if (!_transforms.Result.IsIdentity)
+				pie.Transform = new SvgTransformList(_transforms.Result.Clone());
+
+			_cur.AddChild(pie);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillPie(SvgBrush brush, Int32 x, Int32 y, Int32 width, Int32 height, Int32 startAngle, Int32 sweepAngle)
+		{
+			FillPie(brush, (Single)x, (Single)y, (Single)width, (Single)height, startAngle, sweepAngle);
+		}
+
+		/// <summary>
+		/// Not implemented, because GDI+ regions/paths are not emulated.
+		/// </summary>
+		public void FillPath(Brush brush, GraphicsPath path) { throw new SvgGdiNotImpl("FillPath (Brush brush, GraphicsPath path)"); }
+
+		/// <summary>
+		/// Not implemented, because GDI+ regions/paths are not emulated.
+		/// </summary>
+		public void FillPath(SvgBrush brush, GraphicsPath path) { throw new SvgGdiNotImpl("FillPath (SvgBrush brush, GraphicsPath path)"); }
+
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillClosedCurve(Brush brush, PointF[] points)
+		{
+			PointF[] pts = Spline2Bez(points, 0, points.Length - 1, true, .5f);
+			FillBeziers(brush, pts, FillMode.Alternate);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillClosedCurve(Brush brush, PointF[] points, FillMode fillmode)
+		{
+			PointF[] pts = Spline2Bez(points, 0, points.Length - 1, true, .5f);
+			FillBeziers(brush, pts, fillmode);
+		}
+
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void FillClosedCurve(Brush brush, PointF[] points, FillMode fillmode, Single tension)
 		{
-			FillPie(brush, (Single)rect.X, (Single)rect.Y, (Single)rect.Width, (Single)rect.Height, startAngle, sweepAngle);
+			PointF[] pts = Spline2Bez(points, 0, points.Length - 1, true, tension);
+			FillBeziers(brush, pts, fillmode);
 		}
 
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void FillPie(Brush brush, Single x, Single y, Single width, Single height, Single startAngle, Single sweepAngle)
+		public void FillClosedCurve(Brush brush, Point[] points)
 		{
-			string s = GDIArc2SVGPath(x, y, width, height, startAngle, sweepAngle, true);
-
-			SvgPathElement pie = new SvgPathElement();
-			pie.D = s;
-			pie.Style = HandleBrush(brush);
-			if (!_transforms.Result.IsIdentity)
-				pie.Transform = new SvgTransformList(_transforms.Result.Clone());
-
-			_cur.AddChild(pie);
+			PointF[] pts = Spline2Bez(Point2PointF(points), 0, points.Length - 1, true, .5f);
+			FillBeziers(brush, pts, FillMode.Alternate);
 		}
 
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void FillPie(Brush brush, Int32 x, Int32 y, Int32 width, Int32 height, Int32 startAngle, Int32 sweepAngle)
+		public void FillClosedCurve(Brush brush, Point[] points, FillMode fillmode)
 		{
-			FillPie(brush, (Single)x, (Single)y, (Single)width, (Single)height, startAngle, sweepAngle);
+			PointF[] pts = Spline2Bez(Point2PointF(points), 0, points.Length - 1, true, .5f);
+			FillBeziers(brush, pts, fillmode);
 		}
 
 		/// <summary>
-		/// Not implemented, because GDI+ regions/paths are not emulated.
+		/// Implemented
 		/// </summary>
-		public void FillPath(Brush brush, GraphicsPath path) { throw new SvgGdiNotImpl("FillPath (Brush brush, GraphicsPath path)"); }
-
+		public void FillClosedCurve(Brush brush, Point[] points, FillMode fillmode, Single tension)
+		{
+			PointF[] pts = Spline2Bez(Point2PointF(points), 0, points.Length - 1, true, tension);
+			FillBeziers(brush, pts, fillmode);
+		}
 
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void FillClosedCurve(Brush brush, PointF[] points)
+		public void FillClosedCurve(SvgBrush brush, PointF[] points)
 		{
 			PointF[] pts = Spline2Bez(points, 0, points.Length - 1, true, .5f);
 			FillBeziers(brush, pts, FillMode.Alternate);
@@ -2092,7 +2756,7 @@
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void FillClosedCurve(Brush brush, PointF[] points, FillMode fillmode)
+		public void FillClosedCurve(SvgBrush brush, PointF[] points, FillMode fillmode)
 		{
 			PointF[] pts = Spline2Bez(points, 0, points.Length - 1, true, .5f);
 			FillBeziers(brush, pts, fillmode);
@@ -2101,7 +2765,7 @@
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void FillClosedCurve(Brush brush, PointF[] points, FillMode fillmode, Single tension)
+		public void FillClosedCurve(SvgBrush brush, PointF[] points, FillMode fillmode, Single tension)
 		{
 			PointF[] pts = Spline2Bez(points, 0, points.Length - 1, true, tension);
 			FillBeziers(brush, pts, fillmode);
@@ -2110,7 +2774,7 @@
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void FillClosedCurve(Brush brush, Point[] points)
+		public void FillClosedCurve(SvgBrush brush, Point[] points)
 		{
 			PointF[] pts = Spline2Bez(Point2PointF(points), 0, points.Length - 1, true, .5f);
 			FillBeziers(brush, pts, FillMode.Alternate);
@@ -2119,7 +2783,7 @@
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void FillClosedCurve(Brush brush, Point[] points, FillMode fillmode)
+		public void FillClosedCurve(SvgBrush brush, Point[] points, FillMode fillmode)
 		{
 			PointF[] pts = Spline2Bez(Point2PointF(points), 0, points.Length - 1, true, .5f);
 			FillBeziers(brush, pts, fillmode);
@@ -2128,7 +2792,7 @@
 		/// <summary>
 		/// Implemented
 		/// </summary>
-		public void FillClosedCurve(Brush brush, Point[] points, FillMode fillmode, Single tension)
+		public void FillClosedCurve(SvgBrush brush, Point[] points, FillMode fillmode, Single tension)
 		{
 			PointF[] pts = Spline2Bez(Point2PointF(points), 0, points.Length - 1, true, tension);
 			FillBeziers(brush, pts, fillmode);
@@ -2140,6 +2804,11 @@
 		public void FillRegion(Brush brush, Region region) { throw new SvgGdiNotImpl("FillRegion (Brush brush, Region region)"); }
 
 		/// <summary>
+		/// Not implemented, because GDI+ regions/paths are not emulated.
+		/// </summary>
+		public void FillRegion(SvgBrush brush, Region region) { throw new SvgGdiNotImpl("FillRegion (SvgBrush brush, Region region)"); }
+
+		/// <summary>
 		/// Implemented
 		/// </summary>
 		public void DrawString(String s, Font font, Brush brush, Single x, Single y)
@@ -2194,113 +2863,189 @@
 			DrawText(s, font, brush, layoutRectangle, format, false);
 		}
 
-		private float GetFontDescentPercentage(Font font)
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawString(String s, Font font, SvgBrush brush, Single x, Single y)
 		{
-			return (float)font.FontFamily.GetCellDescent(font.Style) / font.FontFamily.GetEmHeight(font.Style);
+			DrawText(s, font, brush, new RectangleF(x, y, 0, 0), StringFormat.GenericDefault, true);
 		}
 
-		private void DrawText(String s, Font font, Brush brush, RectangleF rect, StringFormat fmt, bool ignoreRect)
+		/// <summary>
+		/// Implemented.
+		/// <para>In general, DrawString functions work, but it is impossible to guarantee that an SVG renderer will have a certain font and draw it in the 
+		/// same way as GDI+.
+		/// </para>
+		/// <para>
+		/// SVG does not do word wrapping and SvgGdi does not emulate it yet (although clipping is working).  The plan is to wait till SVG 1.2 becomes available, since 1.2 contains text
+		/// wrapping/flowing attributes.
+		/// </para>
+		/// </summary>
+		public void DrawString(String s, Font font, SvgBrush brush, PointF point)
 		{
-			if (s != null && s.Contains("\n"))
-				throw new SvgGdiNotImpl("DrawText multiline text");
+			DrawText(s, font, brush, new RectangleF(point.X, point.Y, 0, 0), StringFormat.GenericDefault, true);
+		}
 
-			SvgTextElement txt = new SvgTextElement(s, rect.X, rect.Y);
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawString(String s, Font font, SvgBrush brush, Single x, Single y, StringFormat format)
+		{
+			DrawText(s, font, brush, new RectangleF(x, y, 0, 0), format, true);
+		}
 
-			//GDI takes x and y as the upper left corner; svg takes them as the lower left.
-			//We must therefore move the text one line down, but SVG does not understand about lines,
-			//so we do as best we can, applying a downward translation before the current GDI translation.
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawString(String s, Font font, SvgBrush brush, PointF point, StringFormat format)
+		{
+			DrawText(s, font, brush, new RectangleF(point.X, point.Y, 0, 0), StringFormat.GenericDefault, true);
+		}
 
-			txt.Transform = new SvgTransformList(_transforms.Result.Clone());
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawString(String s, Font font, SvgBrush brush, RectangleF layoutRectangle)
+		{
+			DrawText(s, font, brush, layoutRectangle, StringFormat.GenericDefault, false);
+		}
 
-			txt.Style = HandleBrush(brush);
-			txt.Style += new SvgStyle(font);
+		/// <summary>
+		/// Implemented
+		/// </summary>
+		public void DrawString(String s, Font font, SvgBrush brush, RectangleF layoutRectangle, StringFormat format)
+		{
+			DrawText(s, font, brush, layoutRectangle, format, false);
+		}
 
-			switch (fmt.Alignment)
+		public void DrawString(String s, Font font, SvgBrush brush, RectangleF layoutRectangle, StringFormat format, bool useClip)
 			{
-				case StringAlignment.Near:
-					break;
+			DrawText(s, font, brush, layoutRectangle, format, !useClip);
+		}
 
-				case StringAlignment.Center:
+		public void DrawString(String s, SvgBrush brush, Single x, Single y, StringFormat format, String pathToFont, float emSize, FontStyle? style)
 					{
-						if (ignoreRect)
-							throw new SvgGdiNotImpl("DrawText automatic rect");
+			DrawText(s, brush, new RectangleF(x, y, 0, 0), format, true, pathToFont, null, emSize, style);
+		}
 
-						txt.Style.Set("text-anchor", "middle");
-						txt.X = rect.X + rect.Width / 2;
+		public void DrawString(String s, SvgBrush brush, PointF p, StringFormat format, String pathToFont, float emSize, FontStyle? style)
+		{
+			DrawText(s, brush, new RectangleF(p.X, p.Y, 0, 0), format, true, pathToFont, null, emSize, style);
 					}
-					break;
 
-				case StringAlignment.Far:
+		public void DrawString(String s, SvgBrush brush, Single x, Single y, StringFormat format, bool clip, String pathToFont, String fN, float emSize, FontStyle? style)
 					{
-						if (ignoreRect)
-							throw new SvgGdiNotImpl("DrawText automatic rect");
+			DrawText(s, brush, new RectangleF(x, y, 0, 0), format, clip, pathToFont, fN, emSize, style);
+		}
 
-						txt.Style.Set("text-anchor", "end");
-						txt.X = rect.Right;
+		public void DrawString(String s, SvgBrush brush, RectangleF layoutRect, StringFormat format, String pathToFont, float emSize, FontStyle? style) 
+		{
+			DrawText(s, brush, layoutRect, format, true, pathToFont, null, emSize, style);
 					}
-					break;
 
-				default:
-					throw new SvgGdiNotImpl("DrawText horizontal alignment");
+		public void DrawString(String s, SvgBrush brush, RectangleF layoutRect, StringFormat format, bool useClip, String pathToFont, float emSize, FontStyle? style) 
+		{
+			DrawText(s, brush, layoutRect, format, true, pathToFont, null, emSize, style);
 			}
 
-			if (!ignoreRect && ((fmt.FormatFlags & StringFormatFlags.NoClip) != StringFormatFlags.NoClip))
+		public void DrawString(String s, SvgBrush brush, RectangleF layoutRect, StringFormat format, bool useClip, String pathToFont, String fontName, float emSize, FontStyle? style) 
 			{
-				SvgClipPathElement clipper = new SvgClipPathElement();
-				clipper.Id += "_text_clipper";
-				SvgRectElement rc = new SvgRectElement(rect.X, rect.Y, rect.Width, rect.Height);
-				clipper.AddChild(rc);
-				_defs.AddChild(clipper);
+			DrawText(s, brush, layoutRect, format, true, pathToFont, fontName, emSize, style);
+		}
 
-				txt.Style.Set("clip-path", new SvgUriReference(clipper));
+		private void DrawText(String s, Font font, SvgBrush brush, RectangleF rect, StringFormat format, bool ignoreRect)
+		{
+			DrawText(s, brush, rect, format, ignoreRect, null, font.Name, font.SizeInPoints, font.Style);
 			}
 
-			switch (fmt.LineAlignment)
+		private void DrawText(String s, Font font, Brush brush, RectangleF rect, StringFormat fmt, bool ignoreRect)
 			{
-				case StringAlignment.Near:
+			DrawText(s, HandleBrush(brush), rect, fmt, ignoreRect, null, font.Name, font.SizeInPoints, font.Style);
+		}
+
+		private void DrawText(String s, SvgBrush brush, RectangleF rect, StringFormat fmt, bool ignoreRect, String pathToFont, String fontName, float emSize, FontStyle? style)
 					{
-						// TODO: ?? 
-						// txt.Style.Set("baseline-shift", "-86%");//a guess.
-						var span = new SvgTspanElement(s);
-						span.DY = new SvgLength(txt.Style.Get("font-size").ToString());
-						txt.Text = null;
-						txt.AddChild(span);
+			DrawText(s, HandleBrush(brush), rect, fmt, ignoreRect, pathToFont, fontName, emSize, style);
 					}
-					break;
 
-				case StringAlignment.Center:
+		private void DrawText(String s, SvgStyle brush, RectangleF rect, 
+			StringFormat fmt, bool ignoreRect, 
+			String pathToFont, 
+			String fontName, float emSize, FontStyle? style)
+		{
+			SvgTextElement txt = new SvgTextElement(s);
+			string subValue = "\n";
+			int idx = s.IndexOf(subValue);
+
+			if (idx != -1)
 					{
-						if (ignoreRect)
-							throw new SvgGdiNotImpl("DrawText automatic rect");
+				string newline = txt.Text.Substring(idx + subValue.Length);
+				SvgTspanElement tspan = new SvgTspanElement(newline);
 
-						txt.Y.Value = txt.Y.Value + (rect.Height / 2);
-						var span = new SvgTspanElement(s);
-						span.DY = new SvgLength(txt.Style.Get("font-size").ToString());
-						span.DY.Value = span.DY.Value * ((1 - GetFontDescentPercentage(font)) - 0.5f);
-						txt.Text = null;
-						txt.AddChild(span);
+				tspan.DY = "1em";
+				tspan.X = rect.Left;
+				txt.AddChild(tspan);
+				txt.Text = txt.Text.Substring(0, idx);
 					}
-					break;
 
-				case StringAlignment.Far:
+			//GDI takes x and y as the upper left corner; svg takes them as the lower left.
+			//We must therefore move the text one line down, but SVG does not understand about lines,
+			//so we do as best we can, applying a downward translation before the current GDI translation.
+
+			txt.Transform = new SvgTransformList(_transforms.Result.Clone());
+
+			txt.Style = brush;
+			txt.Style += new SvgStyle(pathToFont, fontName, emSize, style);
+
+			txt.Style.Set("text-rendering", "geometricPrecision");
+
+			if (pathToFont != null)
 					{
-						if (ignoreRect)
-							throw new SvgGdiNotImpl("DrawText automatic rect");
+				// src: url("foo.ttf")
+				txt.Style.Set("src", "url(\"file:///" + Path.GetFullPath(pathToFont).Replace('\\', '/') + "\")");
+			}
 
-						txt.Y.Value = txt.Y.Value + rect.Height;
-						// This would solve the alignment as well, but it's not supported by Internet Explorer
-						//
-						// txt.Attributes["dominant-baseline"] = "text-after-edge";
-						var span = new SvgTspanElement(s);
-						span.DY = new SvgLength(txt.Style.Get("font-size").ToString());
-						span.DY.Value = span.DY.Value * ((1 - GetFontDescentPercentage(font)) - 1);
-						txt.Text = null;
-						txt.AddChild(span);
+			switch (fmt.Alignment)
+			{
+				case StringAlignment.Near:
+					//txt.Style.Set("text-anchor", "middle");
+					txt.X = rect.Left;
+					break;
+				case StringAlignment.Center:
+					txt.Style.Set("text-anchor", "middle");
+					txt.X = (rect.Left + rect.Right) / 2;
+					break;
+				case StringAlignment.Far:
+					txt.Style.Set("text-anchor", "end");
+					txt.X = rect.Right;
+					break;
 					}
+
+			switch (fmt.LineAlignment)
+			{
+				case StringAlignment.Near:
+					txt.Style.Set("dominant-baseline", "hanging");
+					txt.Y = rect.Top;
+					break;
+				case StringAlignment.Center:
+					txt.Style.Set("dominant-baseline", "middle");
+					txt.Y = (rect.Top + rect.Bottom) / 2;
+					break;
+				case StringAlignment.Far:
+					txt.Style.Set("dominant-baseline", "baseline");
+					txt.Y = rect.Bottom;
 					break;
+			}
 
-				default:
-					throw new SvgGdiNotImpl("DrawText vertical alignment");
+			if (!ignoreRect && (fmt.FormatFlags != StringFormatFlags.NoClip))
+			{
+				SvgClipPathElement clipper = new SvgClipPathElement();
+				clipper.Id += "_text_clipper";
+				SvgRectElement rc = new SvgRectElement(rect.X, rect.Y - rect.Height, rect.Width, rect.Height);
+				clipper.AddChild(rc);
+				_defs.AddChild(clipper);
+				
+				txt.Style.Set("clip-path", new SvgUriReference(clipper));
 			}
 
 			_cur.AddChild(txt);
@@ -2760,7 +3505,8 @@
 			get { throw new SvgGdiNotImpl("get_TextRenderingHint"); }
 			set
 			{
-				switch (value) {
+				switch (value)
+				{
 					case TextRenderingHint.AntiAlias:
 						_cur.Style.Set("text-rendering", "auto"); break;
 					case TextRenderingHint.AntiAliasGridFit:
@@ -2781,15 +3527,14 @@
 		public System.Int32 TextContrast
 		{ get { throw new SvgGdiNotImpl("get_TextContrast"); } set { } }
 
-		private System.Drawing.Drawing2D.SmoothingMode _smoothingMode = SmoothingMode.Invalid;
+		private System.Drawing.Drawing2D.SmoothingMode _smoothingMode = SmoothingMode.None;
 		public System.Drawing.Drawing2D.SmoothingMode SmoothingMode
 		{
 			get { return _smoothingMode; }
 			set
 			{
-				switch (value) {
-					case SmoothingMode.Invalid:
-						break;
+				switch (value)
+				{
 					case SmoothingMode.None:
 						_cur.Style.Set("shape-rendering", "crispEdges"); break;
 					case SmoothingMode.Default:
@@ -2881,7 +3626,8 @@
 
 		private static Graphics GetDefaultGraphics()
 		{
-			if (_g == null) {
+			if (_g == null)
+			{
 				Bitmap b = new Bitmap(1, 1);
 				_g = Graphics.FromImage(b);
 			}
@@ -2905,20 +3651,27 @@
 		/// </summary>
 		/// <param name="br"></param>
 		/// <returns></returns>
+		private SvgStyle HandleBrush(SvgBrush br)
+		{
+			return new SvgStyle(br);
+		}
+
 		private SvgStyle HandleBrush(Brush br)
 		{
 			if (br.GetType() == typeof(SolidBrush)) {
-				return new SvgStyle((SolidBrush)br);
+				return new SvgStyle(new SvgBrush((SolidBrush)br));
 			}
 
-			if (br.GetType() == typeof(LinearGradientBrush)) {
+			if (br.GetType() == typeof(LinearGradientBrush))
+			{
 				LinearGradientBrush grbr = (LinearGradientBrush)br;
 				RectangleF rc = grbr.Rectangle;
 
 				SvgLinearGradient grad = new SvgLinearGradient(rc.Left, rc.Top, rc.Right, rc.Bottom);
 
 
-				switch (grbr.WrapMode) {
+				switch (grbr.WrapMode)
+				{
 					//I have not been able to test Clamp because using a clamped gradient appears to crash the process
 					//under XP (?!?!)
 					case WrapMode.Clamp:
@@ -2932,17 +3685,25 @@
 				ColorBlend cb = null;
 
 				//GDI dll tends to crash when you try and access some members of gradient brushes that haven't been specified.
-				try {
+				try
+				{
 					cb = grbr.InterpolationColors;
-				} catch (Exception) { }
+				}
+				catch (Exception) { }
 
-				if (cb != null) {
-					for (int i = 0; i < grbr.InterpolationColors.Colors.Length; ++i) {
-						grad.AddChild(new SvgStopElement(grbr.InterpolationColors.Positions[i], grbr.InterpolationColors.Colors[i]));
+				if (cb != null)
+				{
+					for (int i = 0; i < grbr.InterpolationColors.Colors.Length; ++i)
+					{
+						grad.AddChild(new SvgStopElement(
+							grbr.InterpolationColors.Positions[i], 
+							new SvgColor(new SolidBrush(grbr.InterpolationColors.Colors[i]))));
 					}
-				} else {
-					grad.AddChild(new SvgStopElement("0%", grbr.LinearColors[0]));
-					grad.AddChild(new SvgStopElement("100%", grbr.LinearColors[1]));
+				}
+				else
+				{
+					grad.AddChild(new SvgStopElement("0%", new SvgColor(new SolidBrush(grbr.LinearColors[0]))));
+					grad.AddChild(new SvgStopElement("100%", new SvgColor(new SolidBrush(grbr.LinearColors[1]))));
 				}
 
 				grad.Id += "_LinearGradientBrush";
@@ -2954,7 +3715,8 @@
 				return s;
 			}
 
-			if (br.GetType() == typeof(HatchBrush)) {
+			if (br.GetType() == typeof(HatchBrush))
+			{
 				HatchBrush habr = (HatchBrush)br;
 
 				SvgPatternElement patty = new SvgPatternElement(0, 0, 8, 8, new SvgNumList("4 4 12 12"));
@@ -2962,10 +3724,10 @@
 				patty.Style.Set("stroke-linecap", "butt");
 
 				SvgRectElement rc = new SvgRectElement(0, 0, 8, 8);
-				rc.Style.Set("fill", new SvgColor(habr.BackgroundColor));
+				rc.Style.Set("fill", new SvgColor(new SolidBrush(habr.BackgroundColor)));
 				patty.AddChild(rc);
 
-				AddHatchBrushDetails(patty, new SvgColor(habr.ForegroundColor), habr.HatchStyle);
+				AddHatchBrushDetails(patty, new SvgColor(new SolidBrush(habr.ForegroundColor)), habr.HatchStyle);
 
 				patty.Id += "_HatchBrush";
 				patty.PatternUnits = "userSpaceOnUse";
@@ -2978,10 +3740,9 @@
 			}
 
 			//most types of brush we can't emulate, but luckily they are quite unusual
-			return new SvgStyle(new SolidBrush(Color.Salmon));
+			return new SvgStyle(new SvgBrush(Color.Salmon));
 		}
 
-
 		private void AddHatchBrushDetails(SvgPatternElement patty, SvgColor col, HatchStyle hs)
 		{
 			SvgStyledTransformedElement l1 = null;
@@ -2989,7 +3750,8 @@
 			SvgStyledTransformedElement l3 = null;
 			SvgStyledTransformedElement l4 = null;
 
-			switch (hs) {
+			switch (hs)
+			{
 				case HatchStyle.Cross:
 					l1 = new SvgLineElement(4, 0, 4, 8);
 					l2 = new SvgLineElement(0, 4, 8, 4);
@@ -3226,54 +3988,42 @@
 					break;
 			}
 
-			if (l1 != null) {
+			if (l1 != null)
+			{
 				l1.Style.Set("stroke", col);
 				l1.Style.Set("fill", col);
 				patty.AddChild(l1);
 			}
-			if (l2 != null) {
+			if (l2 != null)
+			{
 				l2.Style.Set("stroke", col);
 				l2.Style.Set("fill", col);
 				patty.AddChild(l2);
 			}
-			if (l3 != null) {
+			if (l3 != null)
+			{
 				l3.Style.Set("stroke", col);
 				l3.Style.Set("fill", col);
 				patty.AddChild(l3);
 			}
-			if (l4 != null) {
+			if (l4 != null)
+			{
 				l4.Style.Set("stroke", col);
 				l4.Style.Set("fill", col);
 				patty.AddChild(l4);
 			}
 		}
 
-		private void DrawEndAnchors(Pen pen, PointF start, PointF end, bool ignoreUnsupportedLineCaps = false)
+		private void DrawEndAnchors(SvgPen pen, PointF start, PointF end, bool ignoreUnsupportedLineCaps = false)
 		{
 			float startAngle = (float)Math.Atan((start.X - end.X) / (start.Y - end.Y)) * -1;
 			float endAngle = (float)Math.Atan((end.X - start.X) / (end.Y - start.Y)) * -1;
 
-			CustomLineCap clcstart = null;
-			CustomLineCap clcend = null;
-
-			//GDI+ native dll throws an exception if someone forgot to specify custom cap
-			try
-			{
-				clcstart = pen.CustomStartCap;
-			}
-			catch (Exception)
-			{
-			}
-			try
-			{
-				clcend = pen.CustomEndCap;
-			}
-			catch (Exception)
-			{
-			}
+			CustomLineCap clcstart = pen.CustomStartCap;
+			CustomLineCap clcend = pen.CustomEndCap;
 
-			DrawEndAnchor(pen.StartCap, clcstart, pen.Color, pen.Width, start, startAngle, ignoreUnsupportedLineCaps);
-			DrawEndAnchor(pen.EndCap, clcend, pen.Color, pen.Width, end, endAngle, ignoreUnsupportedLineCaps);
+			DrawEndAnchor(pen.StartCap, clcstart, pen.Brush, pen.Width, start, startAngle, ignoreUnsupportedLineCaps);
+			DrawEndAnchor(pen.EndCap, clcend, pen.Brush, pen.Width, end, endAngle, ignoreUnsupportedLineCaps);
 		}
 
 		/// <summary>
@@ -3296,19 +4046,13 @@
 			}
 		}
 
-		private void DrawEndAnchor(LineCap lc, CustomLineCap clc, Color col, float w, PointF pt, float angle, bool ignoreUnsupportedLineCaps)
+		private void DrawEndAnchor(LineCap lc, CustomLineCap clc, SvgBrush col, float w, PointF pt, float angle, bool ignoreUnsupportedLineCaps)
 		{
 			SvgStyledTransformedElement anchor = null;
 			PointF[] points = null;
 
-			switch (lc) {
-				case LineCap.NoAnchor:
-					break;
-
-				case LineCap.Flat:
-					// TODO: what is the correct look?
-					break;
-
+			switch (lc)
+			{
 				case LineCap.ArrowAnchor:
 					points = new PointF[3];
 					points[0] = new PointF(0, -w / 2f);
@@ -3316,7 +4060,6 @@
 					points[2] = new PointF(w, w);
 					anchor = new SvgPolygonElement(points);
 					break;
-
 				case LineCap.DiamondAnchor:
 					points = new PointF[4];
 					points[0] = new PointF(0, -w);
@@ -3325,32 +4068,28 @@
 					points[3] = new PointF(-w, 0);
 					anchor = new SvgPolygonElement(points);
 					break;
-
 				case LineCap.RoundAnchor:
 					anchor = new SvgEllipseElement(0, 0, w, w);
 					break;
-
 				case LineCap.SquareAnchor:
 					float ww = (w / 3) * 2;
 					anchor = new SvgRectElement(0 - ww, 0 - ww, ww * 2, ww * 2);
 					break;
-
 				case LineCap.Custom:
-					if (clc != null)
-					{
-						if (!ignoreUnsupportedLineCaps)
-							throw new SvgGdiNotImpl("DrawEndAnchor custom");
-					}
-					break;
+					//if (clc != null)
+					//{
+					//	if (!ignoreUnsupportedLineCaps)
+					//		throw new SvgGdiNotImpl("DrawEndAnchor custom");
+					//}
+					//break;
+					//not implemented!
+					return;
 
 				default:
-					if (!ignoreUnsupportedLineCaps)
-						throw new SvgGdiNotImpl("DrawEndAnchor " + lc.ToString());
-					break;
-			}
-
-			if (anchor == null)
+					//if (!ignoreUnsupportedLineCaps)
+					//	throw new SvgGdiNotImpl("DrawEndAnchor " + lc.ToString());
 				return;
+			}
 
 			anchor.Id += "_line_anchor";
 			anchor.Style.Set("fill", new SvgColor(col));
@@ -3386,26 +4125,52 @@
 			_cur.AddChild(bez);
 		}
 
+		private void FillBeziers(SvgBrush brush, PointF[] points, FillMode fillmode)
+		{
+			SvgPathElement bez = new SvgPathElement();
+
+			string s = "M " + points[0].X.ToString(CultureInfo.InvariantCulture) + " " + points[0].Y.ToString(CultureInfo.InvariantCulture) + " C ";
+
+			for (int i = 1; i < points.Length; ++i)
+			{
+				s += points[i].X.ToString(CultureInfo.InvariantCulture) + " " + points[i].Y.ToString(CultureInfo.InvariantCulture) + " ";
+			}
+
+			s += "Z";
+
+			bez.D = s;
+
+			bez.Style = HandleBrush(brush);
+			bez.Transform = new SvgTransformList(_transforms.Result.Clone());
+			_cur.AddChild(bez);
+		}
+
 		private void DrawBitmapData(Bitmap b, float x, float y, float w, float h, bool scale)
 		{
-			SvgGroupElement g = new SvgGroupElement("bitmap_at_" + x.ToString("F", System.Globalization.CultureInfo.InvariantCulture) + "_" + y.ToString("F", System.Globalization.CultureInfo.InvariantCulture));
+			SvgGroupElement g = new SvgGroupElement("bitmap_at_" + x.ToString(CultureInfo.InvariantCulture) + "_" + y.ToString(CultureInfo.InvariantCulture));
 
 			float scalex = 1, scaley = 1;
 
-			if (scale) {
+			if (scale)
+			{
 				scalex = w / b.Width;
 				scaley = h / b.Height;
 			}
 
-			for (int line = 0; line < b.Height; ++line) {
-				for (int col = 0; col < b.Width; ++col) {
+			for (int line = 0; line < b.Height; ++line)
+			{
+				for (int col = 0; col < b.Width; ++col)
+				{
 					//This is SO slow, but better than making the whole library 'unsafe'
 					Color c = b.GetPixel(col, line);
 
-					if (!scale) {
+					if (!scale)
+					{
 						if (col <= w && line <= h)
 							DrawImagePixel(g, c, x + col, y + line, 1, 1);
-					} else {
+					}
+					else
+					{
 						DrawImagePixel(g, c, x + (col * scalex), y + (line * scaley), scalex, scaley);
 					}
 				}
@@ -3434,7 +4199,8 @@
 		private static PointF[] Point2PointF(Point[] p)
 		{
 			PointF[] pf = new PointF[p.Length];
-			for (int i = 0; i < p.Length; ++i) {
+			for (int i = 0; i < p.Length; ++i)
+			{
 				pf[i] = new PointF(p[i].X, p[i].Y);
 			}
 
@@ -3453,7 +4219,8 @@
 			res.Add(points[0]);
 			res.Add(ControlPoint(points[1], points[0], tension));
 
-			for (int i = 1; i < l; ++i) {
+			for (int i = 1; i < l; ++i)
+			{
 				PointF[] pts = ControlPoints(points[i - 1], points[i + 1], points[i], tension);
 				res.Add(pts[0]);
 				res.Add(points[i]);
@@ -3464,7 +4231,8 @@
 			res.Add(points[l]);
 
 
-			if (closed) {
+			if (closed)
+			{
 				//adjust rh cp of point 0
 				PointF[] pts = ControlPoints(points[l], points[1], points[0], tension);
 				res[1] = pts[1];
@@ -3480,10 +4248,13 @@
 				res.Add(points[0]);
 
 				return (PointF[])res.ToArray(typeof(PointF));
-			} else {
+			}
+			else
+			{
 				ArrayList subset = new ArrayList();
 
-				for (int i = start * 3; i < (start + num) * 3; ++i) {
+				for (int i = start * 3; i < (start + num) * 3; ++i)
+				{
 					subset.Add(res[i]);
 				}
 
@@ -3543,13 +4314,15 @@
 
 			sweepAngle += startAngle;
 
-			if (sweepAngle > startAngle) {
+			if (sweepAngle > startAngle)
+			{
 				float tmp = startAngle;
 				startAngle = sweepAngle;
 				sweepAngle = tmp;
 			}
 
-			if (sweepAngle - startAngle > Math.PI || startAngle - sweepAngle > Math.PI) {
+			if (sweepAngle - startAngle > Math.PI || startAngle - sweepAngle > Math.PI)
+			{
 				longArc = 1;
 			}
 
@@ -3560,18 +4333,24 @@
 			end.Y = (float)Math.Sin(sweepAngle) * (height / 2f) + center.Y;
 
 
-			string s = "M " + start.X.ToString("F", System.Globalization.CultureInfo.InvariantCulture) + "," + start.Y.ToString("F", System.Globalization.CultureInfo.InvariantCulture) +
-				" A " + (width / 2f).ToString("F", System.Globalization.CultureInfo.InvariantCulture) + " " + (height / 2f).ToString("F", System.Globalization.CultureInfo.InvariantCulture) + " " +
-				"0 " + longArc.ToString() + " 0 " + end.X.ToString("F", System.Globalization.CultureInfo.InvariantCulture) + " " + end.Y.ToString("F", System.Globalization.CultureInfo.InvariantCulture);
-
-			if (pie) {
-				s += " L " + center.X.ToString("F", System.Globalization.CultureInfo.InvariantCulture) + "," + center.Y.ToString("F", System.Globalization.CultureInfo.InvariantCulture);
-				s += " L " + start.X.ToString("F", System.Globalization.CultureInfo.InvariantCulture) + "," + start.Y.ToString("F", System.Globalization.CultureInfo.InvariantCulture);
+			string s = "M " + start.X.ToString(CultureInfo.InvariantCulture) + "," + start.Y.ToString(CultureInfo.InvariantCulture) +
+				" A " + (width / 2f).ToString(CultureInfo.InvariantCulture) + " " + (height / 2f).ToString(CultureInfo.InvariantCulture) + " " +
+				"0 " + longArc.ToString(CultureInfo.InvariantCulture) + " 0 " + end.X.ToString(CultureInfo.InvariantCulture) + " " + end.Y.ToString(CultureInfo.InvariantCulture);
+
+			if (pie)
+			{
+				s += " L " + center.X.ToString(CultureInfo.InvariantCulture) + "," + center.Y.ToString(CultureInfo.InvariantCulture);
+				s += " L " + start.X.ToString(CultureInfo.InvariantCulture) + "," + start.Y.ToString(CultureInfo.InvariantCulture);
 			}
 
 			return s;
 		}
 
-
+		public void RegisterFont(FontDefInfo f) 
+		{
+			SvgFontElement txt = new SvgFontElement();
+			txt.Font = f;
+			_defs.AddChild(txt);
+		}
 	}
 }
diff -Naubr SvgNet-master/SvgNet/SvgNetStaticConfig.cs src/SvgNet/SvgNetStaticConfig.cs
--- SvgNet-master/SvgNet/SvgNetStaticConfig.cs	1970-01-01 03:00:00.000000000 +0300
+++ src/SvgNet/SvgNetStaticConfig.cs	2015-10-06 17:41:15.257052031 +0300
@@ -0,0 +1,17 @@
+/*
+	Copyright © 2003 RiskCare Ltd. All rights reserved.
+	Copyright © 2010 SvgNet & SvgGdi Bridge Project. All rights reserved.
+	Copyright © 2015 Rafael Teixeira, Mojmír Němeček, Benjamin Peterson and Other Contributors
+
+	Original source code licensed with BSD-2-Clause spirit, treat it thus, see accompanied LICENSE for more
+*/
+
+using SvgNet.SvgTypes;
+
+namespace SvgNet
+{
+	public static class SvgNetStaticConfig
+	{
+		public static readonly SvgLengthType DefaultUnit = SvgLengthType.SVG_LENGTHTYPE_USERDEFAULT;
+	}
+}
\ No newline at end of file
diff -Naubr SvgNet-master/SvgNet/SvgStyle.cs src/SvgNet/SvgStyle.cs
--- SvgNet-master/SvgNet/SvgStyle.cs	2015-04-21 01:30:54.000000000 +0300
+++ src/SvgNet/SvgStyle.cs	2015-10-06 17:41:39.734053216 +0300
@@ -7,10 +7,11 @@
 */
 
 
-using System.Drawing;
-using System.Collections;
 using System;
+using System.Collections;
+using System.Drawing;
 using System.Drawing.Drawing2D;
+using System.Globalization;
 
 
 namespace SvgNet.SvgTypes
@@ -49,59 +50,64 @@
 		/// has no equivalent in SVG.
 		/// </summary>
 		/// <param name="pen"></param>
-		public SvgStyle(Pen pen)
+		public SvgStyle(SvgPen pen)
 		{
-			SvgColor strokeCol = new SvgColor(((SolidBrush)pen.Brush).Color);
+			SvgColor strokeCol = pen.Color;
 			Set("stroke", strokeCol);
 			Set("stroke-width", pen.Width);
 			Set("fill", "none");
 
-			switch (pen.EndCap) {
+			switch(pen.EndCap)
+			{
 				case LineCap.Round:
-					Set("stroke-linecap", "round"); break;
+					Set("stroke-linecap", "round");break;
 				case LineCap.Square:
-					Set("stroke-linecap", "square"); break;
+					Set("stroke-linecap", "square");break;
 				case LineCap.Flat:
-					Set("stroke-linecap", "butt"); break;
+					Set("stroke-linecap", "butt");break;
 			}
 
-			switch (pen.LineJoin) {
+			switch(pen.LineJoin)
+			{
 				case LineJoin.Bevel:
-					Set("stroke-linejoin", "bevel"); break;
+					Set("stroke-linejoin", "bevel");break;
 				case LineJoin.Miter:
-					Set("stroke-linejoin", "miter"); break;
+					Set("stroke-linejoin", "miter");break;
 				case LineJoin.Round:
-					Set("stroke-linejoin", "round"); break;
+					Set("stroke-linejoin", "round");break;
 			}
 
 			//converting between adobe and ms miter limits is very hard because adobe have never explained what the value means.
-			Set("stroke-miterlimit", pen.MiterLimit / 2 + 4f);
+			Set("stroke-miterlimit", pen.MiterLimit/2 + 4f);
 
 			float[] dashes = null;
 
-			switch (pen.DashStyle) {
+			switch(pen.DashStyle)
+			{
 				case DashStyle.Dash:
-					dashes = new float[] { 3, 1 }; break;
+					dashes = new float[]{3,1}; break;
 				case DashStyle.DashDot:
-					dashes = new float[] { 3, 1, 1, 1 }; break;
+					dashes = new float[]{3,1,1,1}; break;
 				case DashStyle.DashDotDot:
-					dashes = new float[] { 3, 1, 1, 1, 1 }; break;
+					dashes = new float[]{3,1,1,1,1}; break;
 				case DashStyle.Dot:
-					dashes = new float[] { 1, 1 }; break;
+					dashes = new float[]{1,1}; break;
 				case DashStyle.Custom:
 					dashes = pen.DashPattern; break;
 			}
 
-			if (dashes != null) {
+			if (dashes != null)
+			{
 				//MS GDI changes dash pattern to match width of line; svg does not.
-				for (int i = 0; i < dashes.Length; ++i) {
+				for(int i=0; i < dashes.Length; ++i)
+				{
 					dashes[i] *= pen.Width;
 				}
 
 				Set("stroke-dasharray", new SvgNumList(dashes));
 			}
 
-			Set("opacity", pen.Color.A / 255f);
+			Set("opacity", pen.Color.A/255f);
 
 		}
 
@@ -109,12 +115,12 @@
 		/// Creates a style based on a GDI brush object.  Only works for solid brushes; pattern brushes are not yet emulated.
 		/// </summary>
 		/// <param name="brush"></param>
-		public SvgStyle(SolidBrush brush)
+		public SvgStyle(SvgBrush brush)
 		{
-			SvgColor col = new SvgColor(((SolidBrush)brush).Color);
+			SvgColor col = new SvgColor(brush);
 			Set("fill", col);
 			Set("stroke", "none");
-			Set("opacity", ((SolidBrush)brush).Color.A / 255f);
+			Set("opacity", col.A/255f);
 		}
 
 		/// <summary>
@@ -123,7 +129,7 @@
 		/// <param name="font"></param>
 		public SvgStyle(Font font)
 		{
-			Set("font-family", font.FontFamily.Name);
+			Set("font-family", "\"" + font.FontFamily.Name + "\"");
 
 			if (font.Bold)
 				Set("font-weight", "bolder");
@@ -134,10 +140,39 @@
 			if (font.Underline)
 				Set("text-decoration", "underline");
 
-			Set("font-size", font.SizeInPoints.ToString("F", System.Globalization.CultureInfo.InvariantCulture) + "pt");
+			Set("font-size", font.SizeInPoints.ToString(CultureInfo.InvariantCulture) /* + "pt" */);
 
 		}
 
+		public SvgStyle(String path, String name, float size, FontStyle? style)
+		{
+			if(name  == null) 
+			{
+				path = path.Replace("\\", "/");
+				path = path.Substring(path.LastIndexOf('/') + 1);
+				path = path.Substring(0, path.LastIndexOf('.') + 1);
+				path = path.Replace('.', '_');
+				name = path;
+			}
+
+			if(!style.HasValue) style = FontStyle.Regular;
+
+			Set("font-family", "\"" + name + "\"");
+
+			if ((style & FontStyle.Bold) != 0)
+				Set("font-weight", "bolder");
+
+			if ((style & FontStyle.Italic) != 0)
+				Set("font-style", "italic");
+
+			if ((style & FontStyle.Underline) != 0)
+				Set("text-decoration", "underline");
+			
+			Set("font-size", "" + size /* + "pt" */);
+
+		}
+
+
 		/// <summary>
 		/// Sets a style.  The key must be a string but the value can be anything (e.g. SvgColor).  If and when the element that owns this style is written out
 		/// to XML, <c>ToString</c> will be called on the value.
@@ -146,7 +181,8 @@
 		/// <param name="val"></param>
 		public void Set(string key, object val)
 		{
-			if (val == null || val.ToString() == "") {
+			if (val == null || val.ToString() == "")
+			{
 				_styles.Remove(key);
 				return;
 			}
@@ -168,15 +204,19 @@
 		/// <param name="s"></param>
 		public void FromString(string s)
 		{
-			try {
+			try
+			{
 				string[] pairs = s.Split(';');
 
-				foreach (string pair in pairs) {
+				foreach(string pair in pairs)
+				{
 					string[] kv = pair.Split(':');
 					if (kv.Length == 2)
 						Set(kv[0].Trim(), kv[1].Trim());
 				}
-			} catch (Exception) {
+			}
+			catch(Exception)
+			{
 				throw new SvgException("Invalid style string", s);
 			}
 		}
@@ -189,7 +229,8 @@
 			string val;
 			string result = "";
 
-			foreach (string s in _styles.Keys) {
+			foreach(string s in _styles.Keys)
+			{
 				val = _styles[s].ToString();
 				result += s;
 				result += ":";
@@ -236,11 +277,12 @@
 		/// Adds two SvgStyles together, resulting in a new object that contains all the attributes of both styles.
 		/// Attributes are copied deeply, i.e. cloned if they are <c>ICloneable</c>.
 		/// </summary>
-		public static SvgStyle operator +(SvgStyle lhs, SvgStyle rhs)
+		public static SvgStyle operator + (SvgStyle lhs, SvgStyle rhs)
 		{
 			SvgStyle res = new SvgStyle();
 
-			foreach (string key in lhs._styles.Keys) {
+			foreach(string key in lhs._styles.Keys)
+			{
 				object o = lhs[key];
 				if (typeof(ICloneable).IsInstanceOfType(o))
 					res[key] = ((ICloneable)o).Clone();
@@ -248,7 +290,8 @@
 					res[key] = o;
 			}
 
-			foreach (string key in rhs._styles.Keys) {
+			foreach(string key in rhs._styles.Keys)
+			{
 				object o = rhs[key];
 				if (typeof(ICloneable).IsInstanceOfType(o))
 					res[key] = ((ICloneable)o).Clone();
diff -Naubr SvgNet-master/SvgNet/SvgSvgElement.cs src/SvgNet/SvgSvgElement.cs
--- SvgNet-master/SvgNet/SvgSvgElement.cs	2015-04-21 01:30:54.000000000 +0300
+++ src/SvgNet/SvgSvgElement.cs	2015-10-06 17:41:48.693053649 +0300
@@ -18,6 +18,7 @@
 	{
 		public SvgSvgElement()
 		{
+			_atts.Add("xmlns", "http://www.w3.org/2000/svg");
 		}
 
 		public SvgSvgElement(SvgLength width, SvgLength height)
diff -Naubr SvgNet-master/SvgNet/Types.cs src/SvgNet/Types.cs
--- SvgNet-master/SvgNet/Types.cs	2015-04-21 01:30:54.000000000 +0300
+++ src/SvgNet/Types.cs	2015-10-06 17:42:09.877054674 +0300
@@ -22,7 +22,7 @@
 	/// </summary>
 	public enum SvgLengthType
 	{
-		SVG_LENGTHTYPE_UNKNOWN = 0,
+		SVG_LENGTHTYPE_USERDEFAULT = 0,
 		SVG_LENGTHTYPE_NUMBER = 1,
 		SVG_LENGTHTYPE_PERCENTAGE = 2,
 		SVG_LENGTHTYPE_EMS = 3,
@@ -147,7 +150,7 @@
 		public SvgLength(float f)
 		{
 			_num = f;
-			_type = SvgLengthType.SVG_LENGTHTYPE_UNKNOWN;
+			_type = SvgNetStaticConfig.DefaultUnit;
 		}
 
 		public SvgLength(float f, SvgLengthType type)
@@ -198,7 +202,7 @@
 					_type = SvgLengthType.SVG_LENGTHTYPE_PC;
 					break;
 				case "":
-					_type = SvgLengthType.SVG_LENGTHTYPE_UNKNOWN;
+					_type = SvgLengthType.SVG_LENGTHTYPE_USERDEFAULT;
 					break;
 				default:
 					throw new SvgException("Invalid SvgLength", s);
@@ -354,5 +354,5 @@
	/// <summary>
	/// A color, as found in CSS2 and used in SVG.  As well as a GDI Color object, SvgColor stores
	/// the string it was initialized from, so that when a color specified as 'black' is written out,
-	/// it will be written 'black' rather than '#000000'
+	/// it will be written 'black' rather than '#000000'. Moved to SvgColors.cs
	/// </summary>
@@ -359,1 +359,1 @@
-	public class SvgColor : ICloneable
+	/*public class SvgColor : ICloneable
@@ -498,3 +498,3 @@
			throw new SvgException("Invalid SvgColor", s);
		}
-	}
+	}*/
