Closed davidredsox closed 7 years ago
Can you include the full code for the sketch and the font itself (if not restrictively licensed) ?
Hey, my apologies for taking so long - I haven't checked this in a couple days.
Here's the code: steering behaviors.zip (updated)
It contains a .html file, sketch.js, vehicle.js (for steering behaviors), the minified version of p5.js, the slim and minified version of JQuery (used for user input), and the font, which is Montserrat Regular (taken from Google Fonts).
I am programming using a Chromebook and am using a local web server, because I couldn't get .textToPoints()
to work without one.
Hello,
I downloaded your example and it runs without errors. Can you post your console error with the code that you posted?
So for some reason when I unzipped the files onto my Windows PC, it ended up being an older version of the code (I'm gonna have to switch text editors on my Chromebook, I think). I updated it to be correct without the referencing errors.
In response to @feedzh , did you try typing in the character "i" or a word containing the character "i" into the text input and clicking the "Generate" button? The error occurs when you type an "i" character, or when you input a whitespace character, such as a space. Also, the error occurs with words containing the letter "i" or a string with spaces.
I also want to say this: I watched a video by Daniel Shiffman ("The Coding Train") about steering behaviors, and he used the word "train" in his example, which worked correctly. This probably points to a problem specific with my code and/or setup and not necessarily a problem with the p5 library.
The problem is with the font file which you are using. It is not the issue of p5 at all.
I tried with other bunch of fonts and it is working fine for me.
Here is my repo you can check out.
I suppose I should have tried that first. Thanks though.
Using
fontVar.textToPoints("i", width/2, height/2, 200)
, activated when a button is pushed, throws this error:Of course, this assumes that
fontVar
contains a preloaded and correctly referenced font. Also, thegenerate()
function is what transforms the text into points and displays those points.I want to note though: I'm not completely sure that it is a problem with the
.textToPoints()
function, but I am pretty sure.