@dburt welcome
Yes. You can make that example work. You might want to take a look at this project, which uses the JSCAD CLI (command line interface) for compiling the design and exporting SVG. Specifically, the 'localfont' project.
https://github.com/jscad-community/jscad-text
If you are going to work with other JavaScript libraries, especially those using async functions or promises then take a look at the 'googlefont' project.