src/macosx/native/sun/awt/CTextPipe.m

Print this page

        

*** 137,146 **** --- 137,148 ---- // get our baseline transform and font CGContextRef cgRef = qsdo->cgRef; CGAffineTransform ctmText = CGContextGetTextMatrix(cgRef); + BOOL saved = false; + /* 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);
*** 169,182 **** --- 171,193 ---- if (fallback) { const CGFontRef cgFallback = CTFontCopyGraphicsFont(fallback, NULL); CFRelease(fallback); if (cgFallback) { + if (!saved) { + CGContextSaveGState(cgRef); + saved = true; + } CGContextSetFont(cgRef, cgFallback); CFRelease(cgFallback); } } + } else { + if (saved) { + CGContextRestoreGState(cgRef); + saved = false; + } } // if we have per-glyph transformations int tin = (g_gvTXIndicesAsInts == NULL) ? -1 : (g_gvTXIndicesAsInts[i] - 1) * 6; if (tin < 0)