Render font that follows parent position

I’m trying to modify font_renderer.js to render a text in front of a cube (and follow its position), but I’m not sure how to do it. I see this script creates 2 triangles for each letter, but how can I change it to create those planes in a way they follow the position and the rotation of a parent cube?

Take a look at this,

I am not sure about the triangles you mentioned, but I think you can set the fonts x and y coordinates on the screen from whatever entity in 3d space you want.