# textStyle Italic bold and others

**URL:** https://discourse.processing.org/t/textstyle-italic-bold-and-others/16557
**Category:** Beginners
**Created:** [December 21, 2019, 8:19pm UTC](https://discourse.processing.org/t/textstyle-italic-bold-and-others/16557 "2019-12-21T20:19:46Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)
#### Post date: [December 21, 2019, 8:19pm UTC](https://discourse.processing.org/t/textstyle-italic-bold-and-others/16557/1 "2019-12-21T20:19:46Z")

</div>

How, would I go about setting the text to italic in processing. There is textStyle() in p5.js but I cannot seem to find its equivalent in processing.

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: [December 22, 2019, 2:40am UTC](https://discourse.processing.org/t/textstyle-italic-bold-and-others/16557/2 "2019-12-22T02:40:09Z")

</div>

![font_ital](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/a9e6b304f94370413a9902bcac88f602b0f9dcc5.png)

i used 2 .ttf files i downloaded.  
in a modified example LETTER

---

<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: [December 22, 2019, 4:38am UTC](https://discourse.processing.org/t/textstyle-italic-bold-and-others/16557/3 "2019-12-22T04:38:18Z")

</div>

but if you like that functionality from p5.js more, just make it!

```auto
/**
 * Letters. 
 * 
 * Draws letters to the screen. This requires loading a font, 
 * setting the font, and then drawing the letters.
 */

//kll test add medium, mediumitalic, bold, bolditalic ttf files
// add a textStyle(style,size); function

// TAB MAIN
void setup() {
  size(640, 360);
  setup_text();
  background(0);
  draw_text();
}

void draw_text() {
  textAlign(CENTER, CENTER);
  int margin = 10;
  translate(margin*4, margin*4);
  int gap = 46;
  int counter = 35;
  for (int y = 0; y < height-gap; y += gap) {
    for (int x = 0; x < width-gap; x += gap) {
      char letter = char(counter);
      if (letter == 'A' || letter == 'E' || letter == 'I' || letter == 'O' || letter == 'U') {
        fill(255, 204, 0);
        //textFont(f_italic);
        //textSize(25);
        textStyle(BOLDITALIC,25);
      } else {
        fill(255);
        //textFont(f);
        //textSize(15);
        textStyle(NORMAL,15);
      }
      text(letter, x, y);
      counter++;
    }
  }
}

// TAB MY_THEME
PFont f, f_italic, f_bold, f_bold_italic;
final int tsize = 24; // ______ default size
final int NORMAL = 0;
final int ITALIC = 1;
final int BOLD = 2;
final int BOLDITALIC = 3;

void setup_text() {
  //printArray(PFont.list());  
  // expect that files under /data/*.ttf
  f = createFont("SourceCodePro-Medium.ttf", tsize);
  f_italic = createFont("SourceCodePro-MediumItalic.ttf", tsize);
  f_bold = createFont("SourceCodePro-Bold.ttf", tsize);
  f_bold_italic = createFont("SourceCodePro-BoldItalic.ttf", tsize);

  textStyle(NORMAL, tsize);
}

void textStyle(int tstyle) { // NORMAL, ITALIC, BOLD or BOLDITALIC 0,1,2,3
  textStyle( tstyle, tsize);
}

void textStyle(int tstyle, int tsize) {
  switch(tstyle) {
  case 0: // NORMAL
    textFont(f);
    break;
  case 1: // ITALIC
    textFont(f_italic);
    break;
  case 2: // BOLD
    textFont(f_bold);
    break;
  case 3: // BOLDITALIC
    textFont(f_bold_italic);
    break;
  default:
    println("wrong font style");
    break;
  }
  textSize(tsize);
}

```

---

<div class="post-metadata">

### Author: ![Tiemen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tiemen/32/5477_2.png) [@Tiemen](https://discourse.processing.org/u/Tiemen)
#### Post date: [December 22, 2019, 7:16am UTC](https://discourse.processing.org/t/textstyle-italic-bold-and-others/16557/4 "2019-12-22T07:16:25Z")

</div>

If there’s no italic font available or you prefer to use a single font, perhaps you can obtain the italic effect with [shearX](https://p5js.org/reference/#/p5/shearX).

---

<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: [December 22, 2019, 5:33pm UTC](https://discourse.processing.org/t/textstyle-italic-bold-and-others/16557/5 "2019-12-22T17:33:45Z")

</div>

Hello,

In the tools Processing IDE (PDE) _Tools_ tab you can use _Create Font_:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/f051dff5ff63f9da95359f29c5c3b1588705920d.png)

References:  
[https://processing.org/reference/loadFont\_.html](https://processing.org/reference/loadFont_.html)  
[https://processing.org/reference/createFont\_.html](https://processing.org/reference/createFont_.html)

🙂

For those that may wonder:  
IDE

> **[Integrated development environment](https://en.wikipedia.org/wiki/Integrated_development_environment)**
>
> An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of at least a source code editor, build automation tools and a debugger. Some IDEs, such as NetBeans and Eclipse, contain the necessary compiler, interpreter, or both; others, such as SharpDevelop and Lazarus, do not.
> The boundary between an IDE and other parts of the broader software development environment is not...

  
PDE  
[https://processing.org/reference/environment/](https://processing.org/reference/environment/)

“Wonder is the beginning of wisdom” - Socrates

🙂
