I’m using font’s
textToPoints method so later on I can manipulate the points the deform the text, but I have 3 issues. I’m absolutely not asking for complete code here, just ideas that I can try out.
I sort of solved this but wondering if there’s an easier way to actually draw the text? I’m looping through the points and using
vertexto make multiple shapes for each letter, but since the data itself isn’t divided by letters it’s not easy to detect when when to call
endShapeto begin the next outline. Right now I need to check the distance between the current and last point with some arbitrary threshold to consider if it belongs to the same outline or not. Is there a smarter way to go about this that I’m missing?
Probably the biggest issue I’m running into is the inner shapes for letters like o, p, b, a. I can’t detect if a new shape is part of the same letter, so everything has the same white fill. How can I determine if it’s an inner shape to make it a black fill instead so that the letters can have holes? For the most part I got this working by comparing min/max values of the last outline, but it’s a bit finnicky.
Related to the last point, if I get black shapes for the inner shapes when I export I actually want these to be alpha, and not black! Maybe pictures will help explain here.
Drawing the outer outline from an
o gives me this shape with white fill:
Then drawing the inner outline with a black fill gives me this:
But when I export I want the black area to be alpha, not black.