How to display a special font in Processing?

Hello, I downloaded this kind of font online, and I need to translate the input of others into this font in Processing and save the file in SVG format to the local folder. Cuz I need to upload the SVG file to my plotter to write. However, this font cannot be displayed in Processing, and the saved file is still the default font.
Does anyone know how to solve it?
18

This is my code.

void keyPressed() {
void keyPressed() {
  if (key == BACKSPACE) {
    if ( myString.length() > 0)
      myString = myString.substring(0, myString.length()-1);
  } else if( (key >= 33 &&key <= 47) ||(key >= 48 &&key <= 57) ||(key >= 65 &&key <= 90) || (key >= 97 && key <= 122))
  myString+= key;
  //textWidth("750, 520, 350, 170");
}
void mousePressed(){
   if(dist(mouseX, mouseY, buttonX, buttonY) < buttonSize)
  {
  textSize(40);
   beginRecord(SVG, myString + ".svg");
     pushStyle();
     fill(0);
   //text(myString, 200,200);
   textFont(createFont("gimbutas.ttf", 30), 30);
   fill(0);
   text(myString, 200, 200);
   popStyle();
   endRecord();
    myString = "";
}

Please format your Code.

Also, what exactly does not work? Does the font not load, or is it not even recognized as a file, or does it just not display the font correctly?

Please format your code properly for posting.
Use the </> (in editor) and post your code inside that.

Quotes do not cut and paste well; I tried you code but that was the first issue so I did not explore further.

Hello, I have format my code. I need to export a word entered by others into the font I downloaded and save it as an SVG file in the local folder. But when I ran it, the folder still showed the original font.

Sorry about it, I am a freshman here, I already format my code. Thanks.

1 Like

sorry, but that is the " blockquote what even makes it worse ( hides sometimes math… )

use the

</> Preformatted text button

to paste your code into
thank you


and please ad more problem description,
possibly text can not be exported as SVG ? empty file ?

I already found a solution, thanks anyway.

Glad to hear that you fixed it. Do you mind sharing what your solution was? Did you use a different font, or convert it with a third party tool, or…?

Sure, My solution was to convert the symbol corresponding to SVG files directly after I took a screenshot about each letter and number separately, and added ‘PShape’ variable in the code so that the Processing could recognize the character outline in the SVG file. So when the audiences enter each letter, it will enable automatically recognize the corresponding SVG file and generate a new SVG file in the local folder.

1 Like