# Can anyone else confirm? textFont overrides stroke opacity?

**URL:** https://discourse.processing.org/t/can-anyone-else-confirm-textfont-overrides-stroke-opacity/4513
**Category:** Coding Questions
**Created:** [October 16, 2018, 12:42am UTC](https://discourse.processing.org/t/can-anyone-else-confirm-textfont-overrides-stroke-opacity/4513 "2018-10-16T00:42:26Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![rapatski](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rapatski/32/5164_2.png) [@rapatski](https://discourse.processing.org/u/rapatski)
#### Post date: [October 16, 2018, 12:42am UTC](https://discourse.processing.org/t/can-anyone-else-confirm-textfont-overrides-stroke-opacity/4513/1 "2018-10-16T00:42:26Z")

</div>

Hey guys, please see example below to try and recreate the behaviour I’m seeing: when setting the font to a font loaded with loadFont (as opposed to using createFont) all stroke opacity in the sketch is set to 255:

```auto
PFont font;

void setup()
{
  size(600, 600, P3D);
  pixelDensity(2);
  smooth(8);
  
  //font = createFont("Helvetica", 100);
  font = loadFont("Helvetica-100.vlw");
  
  
  // when setting font to loaded font, all stroke opacity is set to full??
  textFont(font, 20); // comment out to see normal behaviour
}

void draw() 
{
  background(255);
  
  // draw some low opacity circles
  noFill();
  stroke(0, 30);
  ellipseMode(CENTER);
  ellipse(width/2 - 50, height/2 - 50, 300, 300);
  ellipse(width/2 + 50, height/2 + 50, 300, 300);
  
  // render some text with a loaded font
  fill(0);
  textAlign(CENTER, CENTER);
  text("Strange", width/2, height/2);
}

```

---

<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: [October 16, 2018, 3:45am UTC](https://discourse.processing.org/t/can-anyone-else-confirm-textfont-overrides-stroke-opacity/4513/2 "2018-10-16T03:45:56Z")

</div>

can not see that ( win7, processing 3.4 )

```auto
PFont font;
int opaq=120;

void setup()
{
  size(600, 600, P3D);
  //pixelDensity(2);
  smooth(8);

  //font = createFont("Helvetica", 100);
  // font = loadFont("Helvetica-100.vlw");
  font = loadFont("Uni0554-8.vlw");

  // when setting font to loaded font, all stroke opacity is set to full??
  textFont(font); // comment out to see normal behaviour
  println("use mousewheel for adjust");
}

void draw() 
{
  background(0, 0, 100);

  // draw some low opacity circles
  noFill();
  stroke(200, 200, 0, opaq);
  // stroke(0, 30);
  ellipseMode(CENTER);
  ellipse(width/2 - 50, height/2 - 50, 300, 300);
  ellipse(width/2 + 50, height/2 + 50, 300, 300);

  // render some text with a loaded font
  //fill(200, 0, 0);
  fill(200, 0, 0, opaq);
  textSize(40);
  textAlign(CENTER, CENTER);
  text("TEXT", width/2, height/2);
}

// _______________________________________________________________
void mouseWheel(MouseEvent event) { 
  opaq += event.getCount()*5; 
  if ( opaq < 0 ) { 
    opaq = 0;
  }
  if ( opaq > 255 ) { 
    opaq = 255;
  }
  println("opaq "+opaq);
}

```

---

<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: [October 26, 2018, 3:50pm UTC](https://discourse.processing.org/t/can-anyone-else-confirm-textfont-overrides-stroke-opacity/4513/3 "2018-10-26T15:50:29Z")

</div>

> [@rapatski](#):
>
> recreate the behaviour I’m seeing

@rapatski was this resolved for you, or are you still having a problem on your system?

---

<div class="post-metadata">

### Author: ![rapatski](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rapatski/32/5164_2.png) [@rapatski](https://discourse.processing.org/u/rapatski)
#### Post date: [October 26, 2018, 6:48pm UTC](https://discourse.processing.org/t/can-anyone-else-confirm-textfont-overrides-stroke-opacity/4513/4 "2018-10-26T18:48:12Z")

</div>

I have not heard of a solution or workaround, but adding my specs: macOS Mohave, Processing 3.4. Anyone else with a mac who can recreate or get it to work on mac?

---

<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: [October 27, 2018, 4:22pm UTC](https://discourse.processing.org/t/can-anyone-else-confirm-textfont-overrides-stroke-opacity/4513/5 "2018-10-27T16:22:24Z")

</div>

I can confirm this bug on Processing 3.4 with macOS 10.12.

There is something deeply weird going on here. When I tested with noLoop I was getting text-only results, so I changed the test sketch.

In this revised sketch, it renders as normal. Now hold down space for ~1 second to load the font. In the very next frame, only the second text renders – no other lines, including prior lines AND prior text – are drawn at all. In the following frame, all lines are drawn opaque. Are you seeing the same thing?

```auto
// https://discourse.processing.org/t/can-anyone-else-confirm-textfont-overrides-stroke-opacity/4513

PFont font;
boolean loaded;

void setup() {
  size(600, 300, P3D);
  pixelDensity(2);
  smooth(8);
  frameRate(1);
}

void draw() {
  background(255);

  drawCircleText(); // no loaded font

  if (keyPressed && !loaded) {
    // create the font with PDE > Tools > Create Font > Helvetica, 100
    font = loadFont("Helvetica-100.vlw");
    // when setting font to loaded font, all prior drawing is lost, then next frame stroke opacity is set to full?
    textFont(font, 20);
    loaded = true;
  }

  translate(width/2, 0);
  drawCircleText(); // optionally loaded font

}

void drawCircleText() {
  // draw intersecting low opacity circles
  noFill();
  stroke(0, 30);
  strokeWeight(5);
  ellipseMode(CENTER);
  ellipse(width/4 - 50, height/2 - 50, 160, 160);
  ellipse(width/4 + 50, height/2 + 50, 160, 160);
  // render some text
  fill(0);
  textAlign(CENTER, CENTER);
  text("Strange", width/4 - 50, height/4);
}

```
