private GraphicsPath GetPath(ISvgRenderer renderer, string text, IList <RectangleF> ranges, bool measureSpaces) { EnsureDictionaries(); RectangleF bounds; SvgGlyph glyph; SvgKern kern; GraphicsPath path; SvgGlyph prevGlyph = null; Matrix scaleMatrix; float xPos = 0; var ascent = Ascent(renderer); var result = new GraphicsPath(); if (string.IsNullOrEmpty(text)) { return(result); } for (int i = 0; i < text.Length; i++) { if (!_glyphs.TryGetValue(text.Substring(i, 1), out glyph)) { glyph = _font.Descendants().OfType <SvgMissingGlyph>().First(); } if (prevGlyph != null && _kerning.TryGetValue(prevGlyph.GlyphName + "|" + glyph.GlyphName, out kern)) { xPos -= kern.Kerning * _emScale; } path = (GraphicsPath)glyph.Path(renderer).Clone(); scaleMatrix = new Matrix(); scaleMatrix.Scale(_emScale, -1 * _emScale, MatrixOrder.Append); scaleMatrix.Translate(xPos, ascent, MatrixOrder.Append); path.Transform(scaleMatrix); scaleMatrix.Dispose(); bounds = path.GetBounds(); if (ranges != null) { if (measureSpaces && bounds == RectangleF.Empty) { ranges.Add(new RectangleF(xPos, 0, glyph.HorizAdvX * _emScale, ascent)); } else { ranges.Add(bounds); } } if (path.PointCount > 0) { result.AddPath(path, false); } xPos += glyph.HorizAdvX * _emScale; prevGlyph = glyph; } return(result); }