I have got the below code to display text along a path. I am planning to make sort of dynamic where I can just type in what i want and it displays it along the path. Haven\'
You can query the computed lengths of the string that should go on the path, and the length of the path. Then compare the two, if the string length is longer than the path length then text will fall off the path.
You can also use the knowledge of the path length to squeeze the string to fit, like this:
Here's an example where the string length is manipulated by decreasing the font-size: