Gradient Hatch
Today I managed to find a way to make the hatch Gradient go by global position in the glyph rather than the amount of hatches.
To make this possible I created a class to extract and hold onto the vertical metrics in a layer – particularly the ascender and descender. Since I wanted to deal with simply positive numbers I add the absolute value of the descender to all y-coordinates such that any coordinate is a positive y coordinate. In addition to this I put on a clamp-function to limit the gradient values to the maximum and minimum y-coordinates.
What I discovered during development is that I might need to add gradient direction as a feature, I could start initially by just allowing it to go up and down, all though allowing it to create a gradient according to some angle would also be nice.
An up/down-checkbox would just involve adding a checkbox and some if-check, but if the gradient is made according to some angle I picture the pseudocode would go something like this.
To avoid scope creep I find it’s important to keep the task simple and any new feature discoveries during development are written down as new tasks.
The edges of the hatches are showing quite a lot now, which means I either have to increase the value of the expand step before it’s all intersected or make it a value set by the user.