Closed sunildarji811 closed 11 months ago
I do not think there is a built-in functinality available, but it should not be too difficult to implement this.
Glyph contours consist of lines and quadratic and/or cubic bézier curves. You can march around a contour and sum up the length of these lines and curves. Note that calculating the length of a curve is not completely trivial if you want a precise solution. Here is some detailed background if you are interested, but all Javascript 2d packages have that functionality included if you need it.
Also, you will have to decide which of the contours is your perimeter (if the glyph has multiple contours).
So maybe just grab a 2d package like paper.js, feed the glyph paths, and let it calculate the path lengths (http://paperjs.org/reference/path/#length)
Duplicate of #272 Edit: OK, I misunderstood, but still this is out of scope for a library like ours.
Is there any way to calculate perimeter of all the characters in given text using any pre defined function?
Like word 'neon' and I want to calculate how much length it will take to create a 'sign board' of that 'neon' text?
I want to calculate cost of board using given font type and font size by opentype.js