private void RenderTextPath(SvgTextPathElement textPath, ref Point ctp, double rotate, WpfTextPlacement placement) { if (textPath.ChildNodes == null || textPath.ChildNodes.Count == 0) { return; } SvgElement targetPath = textPath.ReferencedElement as SvgElement; if (targetPath == null) { return; } PathGeometry pathGeometry = WpfRendering.CreateGeometry(targetPath, true) as PathGeometry; if (pathGeometry == null) { return; } this.IsTextPath = true; WpfTextOnPathDrawing pathDrawing = new WpfTextOnPathDrawing(); pathDrawing.BeginTextPath(); XmlNodeType nodeType = XmlNodeType.None; foreach (XmlNode child in textPath.ChildNodes) { nodeType = child.NodeType; if (nodeType == XmlNodeType.Text) { RenderTextPath(textPath, pathDrawing, GetText(textPath, child), new Point(ctp.X, ctp.Y), rotate, placement); } else if (nodeType == XmlNodeType.Element) { string nodeName = child.Name; if (String.Equals(nodeName, "tref")) { RenderTRefPath((SvgTRefElement)child, pathDrawing, ref ctp); } else if (String.Equals(nodeName, "tspan")) { RenderTSpanPath((SvgTSpanElement)child, pathDrawing, ref ctp); } } } WpfTextStringFormat stringFormat = GetTextStringFormat(_textElement); ISvgAnimatedLength pathOffset = textPath.StartOffset; SvgTextPathMethod pathMethod = (SvgTextPathMethod)textPath.Method.BaseVal; SvgTextPathSpacing pathSpacing = (SvgTextPathSpacing)textPath.Spacing.BaseVal; pathDrawing.DrawTextPath(_textContext, pathGeometry, pathOffset, stringFormat.Alignment, pathMethod, pathSpacing); pathDrawing.EndTextPath(); }
private void RenderTextPath(SvgTextElement element, SvgTextPathElement textPath, ref Point ctp, double rotate, WpfTextPlacement placement) { if (_pathRenderer == null) { return; } _pathRenderer.RenderSingleLineText(textPath, ref ctp, String.Empty, rotate, placement); }