# Error message when using PFont

**URL:** https://discourse.processing.org/t/error-message-when-using-pfont/36147
**Category:** Processing.py
**Created:** [April 6, 2022, 1:59am UTC](https://discourse.processing.org/t/error-message-when-using-pfont/36147 "2022-04-06T01:59:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![adora](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@adora](https://discourse.processing.org/u/adora)
#### Post date: [April 6, 2022, 1:59am UTC](https://discourse.processing.org/t/error-message-when-using-pfont/36147/1 "2022-04-06T01:59:45Z")

</div>

So I wanted to add another font to my python project, but I keep getting an error message for the PFont line. Here is my code:

```auto
def setup():
    size(1600, 900)
    PFont headerFont # Error message: Maybe there's an unclosed paren or quote mark somewhere before this line?
    headerFont = loadFont("BlackBubbleFont.vlw")

```

I’ve already went to Tools \> Create Font to add my font “BlackBubbleFont.vlw” and it is in my project’s data folder. I’ve also tried putting the “PFont headerFont” line above def setup(), but the error message still pops up.

I followed a youtube tutorial exactly, so I’m not sure why mine doesn’t work. The only difference I can think of is that I’m using the python mode, while the youtuber was using java.

Is there something I did wrong? Thanks!

---

<div class="post-metadata">

### Author: ![tabreturn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tabreturn/32/3697_2.png) [@tabreturn](https://discourse.processing.org/u/tabreturn)
#### Post date: [April 6, 2022, 3:59am UTC](https://discourse.processing.org/t/error-message-when-using-pfont/36147/2 "2022-04-06T03:59:03Z")

</div>

Have you tried just to load the TTF/OTF font file directly (no _Create Font_ step required)? Place the TTF/OTF in the sketch’s _data_ sub-folder, and use some code like this –

```python
def setup():
    size(1600, 900)
    headerFont = createFont(′BlackBubbleFont.ttf′, 20)

```

---

<div class="post-metadata">

### Author: ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)
#### Post date: [April 6, 2022, 6:52pm UTC](https://discourse.processing.org/t/error-message-when-using-pfont/36147/3 "2022-04-06T18:52:53Z")

</div>

> [@adora](#):
>
> ```auto
> def setup():
> size(1600, 900)
> PFont headerFont # Error message: Maybe there's an unclosed paren or quote mark somewhere before this line?
> headerFont = loadFont("BlackBubbleFont.vlw")
> 
> ```

Remember you are in Python, so no such thing as variable declaration `PFont headerFont`!  
See if this makes any sense:

```python
def setup():
    size(1600, 900)
    global headerFont # if you want to use the variable inside draw()
    headerFont = loadFont("BlackBubbleFont.vlw")

```
