It appears to be a dot product of a vector field and the curve vector (i.e. a line integral).
I think this approach can't handle certain cases where a path is retraced in opposite directions, like with the handwritten letter 't' or 'i'. Perhaps curvature integrals could be added as well to improve it.
I don't think so.
I draw my 9s by drawing the circle, and then the line down.
Looks like you go the other way. This is all about direction and gesture as opposed to OCR.
I think this approach can't handle certain cases where a path is retraced in opposite directions, like with the handwritten letter 't' or 'i'. Perhaps curvature integrals could be added as well to improve it.
Overall seems to work quite well!