This is kind of expensive actually. Its usually done with a precalculated texture sheet of glyphs which trades memory for shader perf. See: Signed Distance Field
Edit: Here's Valve's Siggraph paper on the technique https://steamcdn-a.akamaihd.net/apps/valve/2007/SIGGRAPH2007...