# How to display a special font in Processing?

**URL:** <https://discourse.processing.org/t/how-to-display-a-special-font-in-processing/15459>\
**Category:** Coding Questions\
**Created:** [November 13, 2019, 1:00pm UTC](https://discourse.processing.org/t/how-to-display-a-special-font-in-processing/15459 "2019-11-13T13:00:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![z.chen](https://avatars.discourse-cdn.com/v4/letter/z/7bcc69/32.png) [@z.chen](https://discourse.processing.org/u/z.chen)\
**Post date:** [November 13, 2019, 1:00pm UTC](https://discourse.processing.org/t/how-to-display-a-special-font-in-processing/15459/1 "2019-11-13T13:00:59Z")

</div>

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](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/fc96ee79d526dd3a434e0d305d574dfc4f0681c3.png)

This is my code.

```auto
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 = "";
}

```

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [November 13, 2019, 8:22pm UTC](https://discourse.processing.org/t/how-to-display-a-special-font-in-processing/15459/2 "2019-11-13T20:22:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [November 14, 2019, 8:13am UTC](https://discourse.processing.org/t/how-to-display-a-special-font-in-processing/15459/3 "2019-11-14T08:13:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![z.chen](https://avatars.discourse-cdn.com/v4/letter/z/7bcc69/32.png) [@z.chen](https://discourse.processing.org/u/z.chen)\
**Post date:** [November 14, 2019, 10:40am UTC](https://discourse.processing.org/t/how-to-display-a-special-font-in-processing/15459/4 "2019-11-14T10:40:06Z")

</div>

> [@Lexyth](#):
>
> 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?

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.

---

<div class="post-metadata">

**Author:** ![z.chen](https://avatars.discourse-cdn.com/v4/letter/z/7bcc69/32.png) [@z.chen](https://discourse.processing.org/u/z.chen)\
**Post date:** [November 14, 2019, 10:41am UTC](https://discourse.processing.org/t/how-to-display-a-special-font-in-processing/15459/5 "2019-11-14T10:41:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [November 14, 2019, 11:06am UTC](https://discourse.processing.org/t/how-to-display-a-special-font-in-processing/15459/6 "2019-11-14T11:06:08Z")

</div>

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

use the

```auto
</> 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 ?

---

<div class="post-metadata">

**Author:** ![z.chen](https://avatars.discourse-cdn.com/v4/letter/z/7bcc69/32.png) [@z.chen](https://discourse.processing.org/u/z.chen)\
**Post date:** [November 14, 2019, 1:51pm UTC](https://discourse.processing.org/t/how-to-display-a-special-font-in-processing/15459/7 "2019-11-14T13:51:45Z")

</div>

I already found a solution, thanks anyway.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [November 22, 2019, 7:02pm UTC](https://discourse.processing.org/t/how-to-display-a-special-font-in-processing/15459/8 "2019-11-22T19:02:53Z")

</div>

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…?

---

<div class="post-metadata">

**Author:** ![z.chen](https://avatars.discourse-cdn.com/v4/letter/z/7bcc69/32.png) [@z.chen](https://discourse.processing.org/u/z.chen)\
**Post date:** [November 22, 2019, 8:57pm UTC](https://discourse.processing.org/t/how-to-display-a-special-font-in-processing/15459/9 "2019-11-22T20:57:18Z")

</div>

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.
