(points)
| 6899 | return contours; |
| 6900 | } |
| 6901 | function getPath(points) { |
| 6902 | var p = new Path(); |
| 6903 | if (!points) { |
| 6904 | return p; |
| 6905 | } |
| 6906 | var contours = getContours(points); |
| 6907 | for (var contourIndex = 0; contourIndex < contours.length; ++contourIndex) { |
| 6908 | var contour = contours[contourIndex]; |
| 6909 | var prev = null; |
| 6910 | var curr = contour[contour.length - 1]; |
| 6911 | var next = contour[0]; |
| 6912 | if (curr.onCurve) { |
| 6913 | p.moveTo(curr.x, curr.y); |
| 6914 | } else { |
| 6915 | if (next.onCurve) { |
| 6916 | p.moveTo(next.x, next.y); |
| 6917 | } else { |
| 6918 | var start = { x: (curr.x + next.x) * 0.5, y: (curr.y + next.y) * 0.5 }; |
| 6919 | p.moveTo(start.x, start.y); |
| 6920 | } |
| 6921 | } |
| 6922 | for (var i = 0; i < contour.length; ++i) { |
| 6923 | prev = curr; |
| 6924 | curr = next; |
| 6925 | next = contour[(i + 1) % contour.length]; |
| 6926 | if (curr.onCurve) { |
| 6927 | p.lineTo(curr.x, curr.y); |
| 6928 | } else { |
| 6929 | var prev2 = prev; |
| 6930 | var next2 = next; |
| 6931 | if (!prev.onCurve) { |
| 6932 | prev2 = { x: (curr.x + prev.x) * 0.5, y: (curr.y + prev.y) * 0.5 }; |
| 6933 | } |
| 6934 | if (!next.onCurve) { |
| 6935 | next2 = { x: (curr.x + next.x) * 0.5, y: (curr.y + next.y) * 0.5 }; |
| 6936 | } |
| 6937 | p.quadraticCurveTo(curr.x, curr.y, next2.x, next2.y); |
| 6938 | } |
| 6939 | } |
| 6940 | p.closePath(); |
| 6941 | } |
| 6942 | return p; |
| 6943 | } |
| 6944 | function buildPath(glyphs, glyph) { |
| 6945 | if (glyph.isComposite) { |
| 6946 | for (var j = 0; j < glyph.components.length; j += 1) { |
no test coverage detected