One option to allow users to preview the font while not letting them download it for free is to have them submit their code sample, render an image of it on the server, then send that back to the user. Not as nice as rendering the font in browser, of course, but it works.
I was thinking that but others also mentioned to have a trial mode font that didn’t have a complete character set also. Rendering a picture might become costly.