private void RenderHorzTextRun(SvgTextContentElement element, ref Point ctp,
                                       string text, double rotate, WpfTextPlacement placement, bool isWhitespace = false)
        {
            if (_horzRenderer == null)
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(text) && !isWhitespace)
            {
                return;
            }

            if (placement != null)
            {
                placement.UpdatePositions(text);
            }

            // Force conversion to path geometry for text with surrogate pair, XmlXamlWriter cannot handle the output
            bool isGeometryMode = _context.TextAsGeometry;

            for (int i = 0; i < text.Length - 1; i++)
            {
                if (char.IsSurrogatePair(text[i], text[i + 1]))
                {
                    _context.TextAsGeometry = true;
                    break;
                }
            }
            _horzRenderer.RenderTextRun(element, ref ctp, text, rotate, placement);

            _context.TextAsGeometry = isGeometryMode;
        }
        private void RenderTextRunH(SvgTextContentElement element, ref Point ctp,
                                    string text, double rotate, WpfTextPlacement placement)
        {
            if (string.IsNullOrWhiteSpace(text) || _horzRenderer == null)
            {
                return;
            }

            if (placement != null)
            {
                placement.UpdatePositions(text);
            }
            _horzRenderer.RenderTextRun(element, ref ctp, text, rotate, placement);
        }