Make a texture be restricted to the edges of a mesh like TexMesh - how?

I am trying to implement a toon-like effect on a Text object using a Gradient texture and making it black, or something like that. Trouble is, when I try and map it so the texture matches the shape of the edges (like in TexMesh), it doesn’t conform to the edges of the letters. How can I make an object have a Gradient (or some other texture) match the shape of the object’s edges without having to rely on light or anything complex?

Problem is that complexity is in letters shapes.
An “a” or “e” are more complex shapes than an “l”.

You can convert your text to a mesh, and then UV unwrap each letter to have a perfect gradient.
Or if you like Texmesh, after converting text into a mesh, you can use it.

But if you don’t want to convert Text object, you will have to adapt mapping.
And complexity of that depends on complexity of text.
Letters don’t have same width.

Rats! I was trying to fake outlining of text to help save on performance load!

Outlining is different than a gradient that travels the whole width of letter.

You can do it at compositing with filters, with a Grease Pencil Object with Lineart modifier.
You can find tutorials for doing shaders. But that is a little bit complicated.
You can simply model it. If you pass Fill mode property of text from Both to None and increase Bevel Depth, you have an outline of text.

Those solutions are simple and should not have a huge performance impact.

Really? But how would I then go about colouring said outline black or any colour I want?

There are lots of nodes at compositing or shading to modify colors.
A Grease Pencil object or a Text outline with faces created by Bevel Depth has color of its material.

So, whatever method is used, you can assign any color to result.