simox-dev / core-plot

Automatically exported from code.google.com/p/core-plot
0 stars 0 forks source link

Text is Blurry #22

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Text is blurry because sub-pixel antialiasing is disabled on layer-backed 
views. Suggestions from 
around the web are limited to two possibilities: render the text as an image 
first then display it in 
the layer, or (in the case of NSTextField), turn on "draws background". The 
latter isn't feasible for 
Core Plot, but the former may be workable.

Original issue reported on code.google.com by idiotsavant2005@gmail.com on 3 Jun 2009 at 7:31

GoogleCodeExporter commented 9 years ago
Because Core Plot is designed to make use of layers and not NSView / UIView, 
NSTextField and all are out of the 
picture. The only remaining alternative (unless Apple provides a 10.5.x fix or 
workaround) appears to be the the 
render-to-image route. I wonder, though, if the disabled sub-pixel antialiasing 
applies only to text. That is, 
would the problem follow an image?

Original comment by joshuano...@gmail.com on 3 Jun 2009 at 7:45

GoogleCodeExporter commented 9 years ago
Actually, I believe the blurry text (and axis lines) is due to the layers not 
being aligned on pixel boundaries.  
This was worsened by the auto-layout routines, which simply do floating-point 
calculations for layer 
placement without any rounding taking place.  By applying CGRectIntegral in the 
right places, or just round(), 
we should be able to sharpen up the text and lines.

The antialiasing problems cause jagged-looking text.  You can get antialiasing 
within layers, but you have to 
draw behind the layer first, using something similar to what's described here: 
http://stackoverflow.com/questions/715750/ugly-looking-text-when-drawing-nsattri
butedstring-in-
cgcontext .  Prerendering the text as an image is going to be tricky, because 
we still want to be able to output 
the entire plot as a pure vector PDF (which we do now by calling the existing 
rendering routines).

Original comment by waupacalarson@gmail.com on 4 Jun 2009 at 2:52

GoogleCodeExporter commented 9 years ago
I believe you're right. :-) I hadn't noticed the axis lines were also blurred 
(I was drawn directly to the text).

Original comment by joshuano...@gmail.com on 4 Jun 2009 at 3:09

GoogleCodeExporter commented 9 years ago

Original comment by drewmcco...@mac.com on 7 Jun 2009 at 6:17

GoogleCodeExporter commented 9 years ago

Original comment by drewmcco...@mac.com on 16 Jun 2009 at 7:22

GoogleCodeExporter commented 9 years ago
The axis label text should now be free of blurriness, as of the last commit.  
The next step is to remove the 
jaggies by dealing with subpixel antialiasing with the CPTextLayer.

Original comment by waupacalarson@gmail.com on 28 Aug 2009 at 4:03

GoogleCodeExporter commented 9 years ago
Brad has added functions for aligned drawing to fix this issue.

Original comment by drewmcco...@mac.com on 6 Oct 2009 at 7:30