public override void BeforeRender(WpfDrawingRenderer renderer) { base.BeforeRender(renderer); _isTextPath = false; _isGroupAdded = false; _textWidth = 0; _isMeasuring = false; WpfDrawingContext context = renderer.Context; SvgRenderingHint hint = _svgElement.RenderingHint; if (hint == SvgRenderingHint.Clipping) { return; } // We do not directly render the contents of the clip-path, unless specifically requested... if (string.Equals(_svgElement.ParentNode.LocalName, "clipPath") && !context.RenderingClipRegion) { return; } _context = renderer.Context; SetQuality(context); SetTransform(context); SetClip(_context); SetMask(_context); _drawGroup = new DrawingGroup(); string sVisibility = _textElement.GetPropertyValue("visibility"); string sDisplay = _textElement.GetPropertyValue("display"); if (string.Equals(sVisibility, "hidden") || string.Equals(sDisplay, "none")) { _drawGroup.Opacity = 0; } string elementId = this.GetElementName(); if (!string.IsNullOrWhiteSpace(elementId) && !context.IsRegisteredId(elementId)) { SvgObject.SetName(_drawGroup, elementId); context.RegisterId(elementId); if (context.IncludeRuntime) { SvgObject.SetId(_drawGroup, elementId); } } string elementClass = this.GetElementClass(); if (!string.IsNullOrWhiteSpace(elementClass) && context.IncludeRuntime) { SvgObject.SetClass(_drawGroup, elementClass); } Transform textTransform = this.Transform; if (textTransform != null && !textTransform.Value.IsIdentity) { _drawGroup.Transform = textTransform; } else { textTransform = null; // render any identity transform useless... } Geometry textClip = this.ClipGeometry; if (textClip != null && !textClip.IsEmpty()) { _drawGroup.ClipGeometry = textClip; } else { textClip = null; // render any empty geometry useless... } Brush textMask = this.Masking; if (textMask != null) { _drawGroup.OpacityMask = textMask; } if (textTransform != null || textClip != null || textMask != null) { DrawingGroup curGroup = _context.Peek(); Debug.Assert(curGroup != null); if (curGroup != null) { curGroup.Children.Add(_drawGroup); context.Push(_drawGroup); _isGroupAdded = true; } } _drawContext = _drawGroup.Open(); _horzRenderer.Initialize(_drawContext, _context); _vertRenderer.Initialize(_drawContext, _context); _pathRenderer.Initialize(_drawContext, _context); }