# How to load fonts on an android device?

**URL:** <https://discourse.processing.org/t/how-to-load-fonts-on-an-android-device/12488>\
**Category:** Processing for Android\
**Created:** [July 3, 2019, 6:53pm UTC](https://discourse.processing.org/t/how-to-load-fonts-on-an-android-device/12488 "2019-07-03T18:53:20Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![WeinSim](https://avatars.discourse-cdn.com/v4/letter/w/db5fbb/32.png) [@WeinSim](https://discourse.processing.org/u/WeinSim)\
**Post date:** [July 3, 2019, 6:53pm UTC](https://discourse.processing.org/t/how-to-load-fonts-on-an-android-device/12488/1 "2019-07-03T18:53:21Z")

</div>

Hi, so I want to make a sketch on my phone where i load a font but always fails to load the font. I also put it into the sketch’s data folder (both as a \*.ttf as well as \*.vwl) but none of it worked. Any ideas on what I’m doing wrong?

---

<div class="post-metadata">

**Author:** ![dan850](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@dan850](https://discourse.processing.org/u/dan850)\
**Post date:** [July 4, 2019, 1:44am UTC](https://discourse.processing.org/t/how-to-load-fonts-on-an-android-device/12488/2 "2019-07-04T01:44:13Z")

</div>

hi @WeinSim, can you give us a code sample demonstrates your issue?

---

<div class="post-metadata">

**Author:** ![WeinSim](https://avatars.discourse-cdn.com/v4/letter/w/db5fbb/32.png) [@WeinSim](https://discourse.processing.org/u/WeinSim)\
**Post date:** [July 4, 2019, 5:31pm UTC](https://discourse.processing.org/t/how-to-load-fonts-on-an-android-device/12488/3 "2019-07-04T17:31:52Z")

</div>

So I have a code which looks something like that. Only giving “Courier” as a font to load doesn’t work because apparently, the font isn’t saved on my phone. Now in the sketche’s data folder, I’ve included two files: Courier.ttf and Courier.vlw. Trying to load the Courier.ttf file (by typing “Courier = createFont(“Courier.ttf”, width/10);”) crashed the sketch and trying to load the Courier.vlw file is like using the default font (just as in the first example). I also tried copying the two files directly to the place where the sketch is saved but that doesn’t work either.

```auto
PFont Courier;

void setup() {
  size(displayWidth, displayHeight);
  Courier = createFont("Courier", width/10);
}

void draw() {
  background(251);
  fill(0);
  textFont(Courier);
  textAlign(CENTER, CENTER);
  text("test", width/2, height/2);
  
  noLoop();
}

```

---

<div class="post-metadata">

**Author:** ![KTibow](https://avatars.discourse-cdn.com/v4/letter/k/3e96dc/32.png) [@KTibow](https://discourse.processing.org/u/KTibow)\
**Post date:** [July 5, 2019, 3:18am UTC](https://discourse.processing.org/t/how-to-load-fonts-on-an-android-device/12488/4 "2019-07-05T03:18:54Z")

</div>

What happens if you run it in Java mode instead of Android mode?

---

<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:** [July 5, 2019, 3:30am UTC](https://discourse.processing.org/t/how-to-load-fonts-on-an-android-device/12488/5 "2019-07-05T03:30:58Z")

</div>

> [@WeinSim](#):
>
> I also tried copying the two files directly to the place where the sketch is saved but that doesn’t work either.

how about using the  
/data/ … folder?

---

<div class="post-metadata">

**Author:** ![KTibow](https://avatars.discourse-cdn.com/v4/letter/k/3e96dc/32.png) [@KTibow](https://discourse.processing.org/u/KTibow)\
**Post date:** [July 5, 2019, 3:36am UTC](https://discourse.processing.org/t/how-to-load-fonts-on-an-android-device/12488/6 "2019-07-05T03:36:21Z")

</div>

@kll, WeinSim tried that already.

---

<div class="post-metadata">

**Author:** ![KTibow](https://avatars.discourse-cdn.com/v4/letter/k/3e96dc/32.png) [@KTibow](https://discourse.processing.org/u/KTibow)\
**Post date:** [July 5, 2019, 3:37am UTC](https://discourse.processing.org/t/how-to-load-fonts-on-an-android-device/12488/7 "2019-07-05T03:37:30Z")

</div>

Also @WeinSim, could you share the Courier ttf and vlw files?

---

<div class="post-metadata">

**Author:** ![WeinSim](https://avatars.discourse-cdn.com/v4/letter/w/db5fbb/32.png) [@WeinSim](https://discourse.processing.org/u/WeinSim)\
**Post date:** [July 5, 2019, 12:18pm UTC](https://discourse.processing.org/t/how-to-load-fonts-on-an-android-device/12488/8 "2019-07-05T12:18:46Z")

</div>

I didn’t run it on Android mode from my laptop but I have Processing for Android on my phone and ran the sketch from there. And there is no such thing as Java/Android mode when using your phone.

---

<div class="post-metadata">

**Author:** ![WeinSim](https://avatars.discourse-cdn.com/v4/letter/w/db5fbb/32.png) [@WeinSim](https://discourse.processing.org/u/WeinSim)\
**Post date:** [July 5, 2019, 12:26pm UTC](https://discourse.processing.org/t/how-to-load-fonts-on-an-android-device/12488/9 "2019-07-05T12:26:50Z")

</div>

I couldn’t send the file directly because the forum would only let me send image files, but here are the download links to the ttf file (1st one) and vlw file (2nd one)  
[http://s000.tinyupload.com/?file\_id=63691213872178297765](http://s000.tinyupload.com/index.php?file_id=63691213872178297765)  
[http://s000.tinyupload.com/?file\_id=01858220214284167796](http://s000.tinyupload.com/index.php?file_id=01858220214284167796)

---

<div class="post-metadata">

**Author:** ![KTibow](https://avatars.discourse-cdn.com/v4/letter/k/3e96dc/32.png) [@KTibow](https://discourse.processing.org/u/KTibow)\
**Post date:** [July 5, 2019, 1:52pm UTC](https://discourse.processing.org/t/how-to-load-fonts-on-an-android-device/12488/10 "2019-07-05T13:52:16Z")

</div>

Just checking @WeinSim, you used an app like APDE or something? I’ll try running it on Java mode on my computer.

---

<div class="post-metadata">

**Author:** ![KTibow](https://avatars.discourse-cdn.com/v4/letter/k/3e96dc/32.png) [@KTibow](https://discourse.processing.org/u/KTibow)\
**Post date:** [July 5, 2019, 2:08pm UTC](https://discourse.processing.org/t/how-to-load-fonts-on-an-android-device/12488/11 "2019-07-05T14:08:50Z")

</div>

@WeinSim, I tried it on my computer, and it worked fine once I changed the line that says

```auto
Courier = createFont("Courier", width/10);

```

to

```auto
Courier = createFont("Courier.ttf", width/10);

```

.  
And I did place the font called “Courier.ttf” in the data folder.  
By the way, in Android mode, you don’t need a `size()` function. Proof here:

```auto
void setup() {
  fullScreen();
  noStroke();
  fill(0);
}

void draw() {
  background(204);
  if (mousePressed) {
    if (mouseX < width/2) {
      rect(0, 0, width/2, height); // Left
    } else {
      rect(width/2, 0, width/2, height); // Right
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [July 5, 2019, 3:56pm UTC](https://discourse.processing.org/t/how-to-load-fonts-on-an-android-device/12488/12 "2019-07-05T15:56:45Z")

</div>

@WeinSim ===

(put your font in the data folder)  
then try the code below :

```auto

PFont police;
boolean ecrire = false;

void setup(){
  size(600,800);
  background(255);
  textSize(36);
  police = createFont("Courier.ttf", 36);
  textFont(police);
  ecrire= true;
 
  
  
}

void draw(){
  background(255);
  fill(255,0,0);
  if(ecrire){
 text("Essai", width/2, height/2); 
  }
}

```

---

<div class="post-metadata">

**Author:** ![WeinSim](https://avatars.discourse-cdn.com/v4/letter/w/db5fbb/32.png) [@WeinSim](https://discourse.processing.org/u/WeinSim)\
**Post date:** [July 5, 2019, 4:18pm UTC](https://discourse.processing.org/t/how-to-load-fonts-on-an-android-device/12488/13 "2019-07-05T16:18:52Z")

</div>

Yes I think it’s called APDE. Simply what you get when you google “Processing for android” and download it from their website (or from google play or sth idk).  
Now I think on my laptop I got the same results when loading the font files.

---

<div class="post-metadata">

**Author:** ![WeinSim](https://avatars.discourse-cdn.com/v4/letter/w/db5fbb/32.png) [@WeinSim](https://discourse.processing.org/u/WeinSim)\
**Post date:** [July 5, 2019, 4:25pm UTC](https://discourse.processing.org/t/how-to-load-fonts-on-an-android-device/12488/14 "2019-07-05T16:25:57Z")

</div>

Ok so I just checked again, on my laptop it actually works. But for some reason on my phone it doesn’t.

Oh, and thank you for the information.

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [July 5, 2019, 4:34pm UTC](https://discourse.processing.org/t/how-to-load-fonts-on-an-android-device/12488/15 "2019-07-05T16:34:55Z")

</div>

@WeinSim ===  
i dont use APDE but the android mode; as for me the code i have put works fine on 2 phones i have tested , first one running MM, the other kitKat.

---

<div class="post-metadata">

**Author:** ![WeinSim](https://avatars.discourse-cdn.com/v4/letter/w/db5fbb/32.png) [@WeinSim](https://discourse.processing.org/u/WeinSim)\
**Post date:** [July 5, 2019, 5:32pm UTC](https://discourse.processing.org/t/how-to-load-fonts-on-an-android-device/12488/16 "2019-07-05T17:32:24Z")

</div>

Ok but (at least as far as I know), android mode only works when the phone is connected to the computer. And when thinkng a bit ahead (I’m planning to use something like that in an app), it wouldn’t be very practical if you always had to stand right next to a computer when using it.
