New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text looks blurry in GL Retina #2739

Closed
codeanticode opened this Issue Aug 5, 2014 · 4 comments

Comments

Projects
None yet
3 participants
@codeanticode
Member

codeanticode commented Aug 5, 2014

{ PJOGL.RETINA = true; } // for now

public void setup() {
//  size(640, 480, "processing.core.PGraphicsRetina2D");
//  size(640, 480, JAVA2D);
  size(640, 480, P2D);
//  smooth(4);
  textFont(createFont("Courier", 24));

  noStroke();
  fill(0);
}

public void draw() {
  background(180);

  for (int x = 0; x < width + 50; x += 50) {
    for (int y = 0; y < height - 50; y += 50) {
      ellipse(x, y, 40, 40);
    }    
  }

  text("Text doesn't look particularly crisp, though", 0, height - 20);
} 

A workaround is to create the text at double the size:

textFont(createFont("Courier", 48));
textSize(24);

@codeanticode codeanticode self-assigned this Aug 5, 2014

@dhawangupta

This comment has been minimized.

Show comment
Hide comment
@dhawangupta

dhawangupta Mar 2, 2015

Running the above code gives error : Cannot find anything named "PJOGL.RETINA". I have tried import processing.opengl.*;

When I run it without the first line, text is fine and sharp.
After adding the workaround suggested, text looks blurry.

I'm working on Processing 2.2.1 on Win8.1 (x64).

dhawangupta commented Mar 2, 2015

Running the above code gives error : Cannot find anything named "PJOGL.RETINA". I have tried import processing.opengl.*;

When I run it without the first line, text is fine and sharp.
After adding the workaround suggested, text looks blurry.

I'm working on Processing 2.2.1 on Win8.1 (x64).

@codeanticode

This comment has been minimized.

Show comment
Hide comment
@codeanticode

codeanticode Mar 4, 2015

Member

@dhawangupta Retina is not supported on 2.2.1. This ongoing discussion is about implementing retina in 3.x

Member

codeanticode commented Mar 4, 2015

@dhawangupta Retina is not supported on 2.2.1. This ongoing discussion is about implementing retina in 3.x

@codeanticode

This comment has been minimized.

Show comment
Hide comment
@codeanticode

codeanticode Mar 4, 2015

Member

@benfry I started to look at this issue, and I think that one way to solve it could be to add a pixelFactor field to PFont, in a similar way you did for PImage, and scale up and down things appropriately. For instance, in PApplet.createFont:

return new PFont(baseFont.deriveFont(size * g.pixelFactor), smooth, charset, stream != null, g.pixelFactor); 

and then in the PFont constructor:

public PFont(Font font, boolean smooth, char charset[], int factor) {
  ...
  this.pixelFactor = factor 
  size = font.getSize() / factor;
  ...

among other things. I'm not 100% familiar with the way the PFont internal work, let me know if this could be a reasonable approach.

Member

codeanticode commented Mar 4, 2015

@benfry I started to look at this issue, and I think that one way to solve it could be to add a pixelFactor field to PFont, in a similar way you did for PImage, and scale up and down things appropriately. For instance, in PApplet.createFont:

return new PFont(baseFont.deriveFont(size * g.pixelFactor), smooth, charset, stream != null, g.pixelFactor); 

and then in the PFont constructor:

public PFont(Font font, boolean smooth, char charset[], int factor) {
  ...
  this.pixelFactor = factor 
  size = font.getSize() / factor;
  ...

among other things. I'm not 100% familiar with the way the PFont internal work, let me know if this could be a reasonable approach.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Mar 30, 2015

Member

I think there's a more transparent option, let's look at it today/tomorrow.

Member

benfry commented Mar 30, 2015

I think there's a more transparent option, let's look at it today/tomorrow.

@benfry benfry closed this in 9a63a4e Jun 13, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment