Question

Processing.js documentation does not explain how you use a web-safe font with bold style. I have already tried loadFont("tahoma_bold.ttf") placing a font I downloaded on the same folder as the script (/project/main.js and /project/tahoma_bold.ttf). I have also tried /project/data/tahoma_bold.ttf. How do you do it?

Was it helpful?

Solution

Hey so I ran into a similar problem a couple of months ago when I tried the same thing but a little more complicated since I was running it in a web2py page. Here's the link to my answer for that.

And here is the simple answer I can think of for your question: instead of doing a loadfont, try:

textFont(createFont("/tahoma_bold.ttf",14));

One of two things will happen. If it works, congrats! If not, you need to add or remove parts of the path (try messing with backslashes) because it's likely the font can't be found. If you get some sort of result and comment back, I can keep helping you figure this one out.

Hope it works!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top