I need to create an array of points (polygon) that represent the outline of a string draw to a canvas in Javascript. Similar to the Java 2D Shape API, where you can create a Polygon object from text.
Any ideas on how I could go about doing this?
I need to create an array of points (polygon) that represent the outline of a string draw to a canvas in Javascript. Similar to the Java 2D Shape API, where you can create a Polygon object from text.
Any ideas on how I could go about doing this?
I don't know of any library that will directly convert character glyphs to canvas paths.
But Yes, here's an idea that works but it's not very direct.
Use Adobe Illustrator to convert text characters to a path outline.
Then use ai->canvas to convert the Illustrator path to an Html Canvas path
BTW, ai->canvas is an amazing library! -- Kudos to Mike Swanson:
You can get the library here: http://blog.mikeswanson.com/post/29634279264/ai2canvas
If the font you want offers an svg version, you can avoid the Illustrator step by using info on this previous post: How to convert text to SVG paths?