changeset 5317:4c1e98bb75cc

7183516: [macosx]Can't print-out the defined fonts for PrintFont_2D and AntialiasTableTest. Reviewed-by: bae, prr
author jgodinez
date Tue, 11 Sep 2012 09:13:01 -0700
parents 73a2bcfba54a
children 1ecc79b87aa3
files src/macosx/native/sun/awt/CTextPipe.m
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/native/sun/awt/CTextPipe.m	Tue Sep 11 18:43:04 2012 +0400
+++ b/src/macosx/native/sun/awt/CTextPipe.m	Tue Sep 11 09:13:01 2012 -0700
@@ -235,9 +235,22 @@
     CGContextSetTextMatrix(cgRef, CGAffineTransformIdentity); // resets the damage from CoreText
 
     NSString *string = [NSString stringWithCharacters:chars length:length];
+    /*
+       The calls below were used previously but for unknown reason did not 
+       render using the right font (see bug 7183516) when attribString is not 
+       initialized with font dictionary attributes.  It seems that "options" 
+       in CTTypesetterCreateWithAttributedStringAndOptions which contains the 
+       font dictionary is ignored.
+
     NSAttributedString *attribString = [[NSAttributedString alloc] initWithString:string];
 
     CTTypesetterRef typeSetterRef = CTTypesetterCreateWithAttributedStringAndOptions((CFAttributedStringRef) attribString, (CFDictionaryRef) ctsDictionaryFor(nsFont, JRSFontStyleUsesFractionalMetrics(strike->fStyle)));
+    */
+    NSAttributedString *attribString = [[NSAttributedString alloc]
+        initWithString:string
+        attributes:ctsDictionaryFor(nsFont, JRSFontStyleUsesFractionalMetrics(strike->fStyle))];
+    
+    CTTypesetterRef typeSetterRef = CTTypesetterCreateWithAttributedString((CFAttributedStringRef) attribString);
 
     CFRange range = {0, length};
     CTLineRef lineRef = CTTypesetterCreateLine(typeSetterRef, range);