changeset 3774:18da8c32f363

RT-30823: Improve subpixel support for CoreText
author Felipe Heidrich <felipe.heidrich@oracle.com>
date Thu, 30 May 2013 14:54:15 -0700
parents 9b21f61edda7
children 6fbcdced58f6
files prism-common/src/com/sun/prism/impl/GlyphCache.java prism-ps/src/com/sun/prism/impl/ps/BaseShaderGraphics.java
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/prism-common/src/com/sun/prism/impl/GlyphCache.java	Thu May 30 13:03:04 2013 -0700
+++ b/prism-common/src/com/sun/prism/impl/GlyphCache.java	Thu May 30 14:54:15 2013 -0700
@@ -130,7 +130,7 @@
         Color currentColor = null;
         Point2D pt = new Point2D();
 
-        boolean subPixel = strike.isSubPixelGlyph() && xform.isTranslateOrIdentity();
+        boolean subPixel = strike.isSubPixelGlyph();
         boolean useGlyphListForAdvances = gl.isComplex() || subPixel;
 
         /* For complex text the advances from GlyphList must be used.
--- a/prism-ps/src/com/sun/prism/impl/ps/BaseShaderGraphics.java	Thu May 30 13:03:04 2013 -0700
+++ b/prism-ps/src/com/sun/prism/impl/ps/BaseShaderGraphics.java	Thu May 30 14:54:15 2013 -0700
@@ -2019,7 +2019,9 @@
             if (isSimpleTranslate) {
                 // Applying this rounding allows for smoother text animation,
                 // when animating simple translated text.
-                p2d.x = (float)Math.round(3.0 * p2d.x)/ 3.0f;
+                if (!strike.isSubPixelGlyph()) {
+                    p2d.x = (float)Math.round(3.0 * p2d.x)/ 3.0f;
+                }
                 p2d.y = (float)Math.round(p2d.y);
             }
         } else {
@@ -2028,7 +2030,9 @@
                 // locations produces very poor text. This doesn't solve
                 // the problem for scaled (etc) cases, but addresses a
                 // common case.
-                p2d.x = (float)Math.round(p2d.x);
+                if (!strike.isSubPixelGlyph()) {
+                    p2d.x = (float)Math.round(p2d.x);
+                }
                 p2d.y = (float)Math.round(p2d.y);
             }
             context.validatePaintOp(this, IDENT, cacheTex, bx, by, bw, bh);