private void RenderTSpanPath(SvgTSpanElement element, WpfPathTextBuilder pathBuilder, ref Point ctp) { WpfTextPlacement placement = WpfTextPlacement.Create(element, ctp, true); ctp = placement.Location; double rotate = placement.Rotation; if (!placement.HasPositions) { placement = null; // Render it useless. } string sBaselineShift = element.GetPropertyValue("baseline-shift").Trim(); double shiftBy = 0; var comparer = StringComparison.OrdinalIgnoreCase; if (sBaselineShift.Length > 0) { SvgTextBaseElement textElement = (SvgTextBaseElement)element.SelectSingleNode("ancestor::svg:text", element.OwnerDocument.NamespaceManager); double textFontSize = GetComputedFontSize(textElement); if (sBaselineShift.EndsWith("%", comparer)) { shiftBy = SvgNumber.ParseNumber(sBaselineShift.Substring(0, sBaselineShift.Length - 1)) / 100f * textFontSize; } else if (string.Equals(sBaselineShift, "sub", comparer)) { shiftBy = -0.6F * textFontSize; } else if (string.Equals(sBaselineShift, "super", comparer)) { shiftBy = 0.6F * textFontSize; } else if (string.Equals(sBaselineShift, "baseline", comparer)) { shiftBy = 0; } else { shiftBy = SvgNumber.ParseNumber(sBaselineShift); } } foreach (XmlNode child in element.ChildNodes) { if (child.NodeType == XmlNodeType.Text) { ctp.Y -= shiftBy; RenderTextPath(element, pathBuilder, GetText(element, child), new Point(ctp.X, ctp.Y), rotate, placement); ctp.Y += shiftBy; } } }
private void RenderTRefPath(SvgTRefElement element, WpfPathTextBuilder pathBuilder, ref Point ctp) { WpfTextPlacement placement = WpfTextPlacement.Create(element, ctp, true); ctp = placement.Location; double rotate = placement.Rotation; if (!placement.HasPositions) { placement = null; // Render it useless. } this.RenderTextPath(element, pathBuilder, GetText(element), new Point(ctp.X, ctp.Y), rotate, placement); }