# Why isn't the font chosen in the pdf that is exported?

**URL:** <https://discourse.processing.org/t/why-isnt-the-font-chosen-in-the-pdf-that-is-exported/23710>\
**Category:** Processing\
**Tags:** homework\
**Created:** [September 6, 2020, 12:53pm UTC](https://discourse.processing.org/t/why-isnt-the-font-chosen-in-the-pdf-that-is-exported/23710 "2020-09-06T12:53:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gatz\_gaz](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@gatz\_gaz](https://discourse.processing.org/u/gatz_gaz)\
**Post date:** [September 6, 2020, 12:53pm UTC](https://discourse.processing.org/t/why-isnt-the-font-chosen-in-the-pdf-that-is-exported/23710/1 "2020-09-06T12:53:51Z")

</div>

```auto
import processing.pdf.*;
PGraphicsPDF pdf;

PFont font;
String s="NOT THE ACTUAL EVENTS";

void setup(){
  size(400,600);
  font=createFont("Programme-RegularAlt",10);
  textFont(font);
  //fill(0);
  frameRate(30);
  pdf = (PGraphicsPDF)beginRecord(PDF, "nin.pdf");
  beginRecord(pdf);
}

void draw(){
    textMode(SHAPE);
  //background(255);
  fill(255,255);
  rect(0,0,width,height);
  fill(0);
  text(s,random(0, 400),random(0,600));
   pdf.nextPage();
    
    for (int i=0; i<100; i++) {
    float r = random(1.0);
    if(r < 1) {
      text(1,0,0); 
    } else {
      text(0,0,0); 
    }
}

 if(frameCount == 30 ) {
    endRecord();
    exit(); // Quit
  } else {
    pdf.nextPage(); // Tell it to go to the next page 
  }
}

```

---

<div class="post-metadata">

**Author:** ![raron](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/raron/32/13651_2.png) [@raron](https://discourse.processing.org/u/raron)\
**Post date:** [September 6, 2020, 4:58pm UTC](https://discourse.processing.org/t/why-isnt-the-font-chosen-in-the-pdf-that-is-exported/23710/2 "2020-09-06T16:58:55Z")

</div>

You have to specify the renderer for textFont()

```auto
void setup(){
  size(400,600);
  font=createFont("Comic Sans MS",10);
  //fill(0);
  frameRate(30);
  pdf = (PGraphicsPDF)beginRecord(PDF, "nin.pdf");
  pdf.textFont(font);
  beginRecord(pdf);
}

```
