changeset 6120:4fdf087a50ae

7158350: [macosx] Strange results of SwingUIText printing Reviewed-by: prr, bae
author jgodinez
date Mon, 03 Jun 2013 09:59:29 -0700
parents dc0aeab104f0
children f49065b46f8a
files src/macosx/native/sun/awt/CTextPipe.m
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/native/sun/awt/CTextPipe.m	Mon Jun 03 09:50:35 2013 -0700
+++ b/src/macosx/native/sun/awt/CTextPipe.m	Mon Jun 03 09:59:29 2013 -0700
@@ -138,8 +138,11 @@
     // get our baseline transform and font
     CGContextRef cgRef = qsdo->cgRef;
     CGAffineTransform ctmText = CGContextGetTextMatrix(cgRef);
-    //CGFontRef cgFont = CGContextGetFont(cgRef);
 
+    /* Save and restore of graphics context is done before the iteration.  
+       This seems to work using our test case (see bug ID 7158350) so we are restoring it at
+       the end of the for loop.  If we find out that save/restore outside the loop
+       doesn't work on all cases then we will move the Save/Restore inside the loop.*/
     CGContextSaveGState(cgRef);
     CGAffineTransform invTx = CGAffineTransformInvert(strike->fTx);
 
@@ -206,13 +209,9 @@
         pt.x += advances[i].width;
         pt.y += advances[i].height;
 
-        // reset the font on the context after striking a unicode with CoreText
-        if (uniChar != 0)
-        {
-           // CGContextSetFont(cgRef, cgFont);
-            CGContextSaveGState(cgRef);
-        }
     }
+    // reset the font on the context after striking a unicode with CoreText
+    CGContextRestoreGState(cgRef);
 }
 
 // Using the Quartz Surface Data context, draw a hot-substituted character run