From accba3a5e1104ec80075d7c62f705798ad24ff85 Mon Sep 17 00:00:00 2001 From: Jennifer Godinez Date: Mon, 10 Sep 2012 10:07:10 -0700 Subject: [PATCH] 7183516: [macosx]Can't print-out the defined fonts for PrintFont_2D and AntialiasTableTest Reviewed-by: bae, prr --- jdk/src/macosx/native/sun/awt/CTextPipe.m | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/jdk/src/macosx/native/sun/awt/CTextPipe.m b/jdk/src/macosx/native/sun/awt/CTextPipe.m index 37e8d4a5eaf..3adc847ed07 100644 --- a/jdk/src/macosx/native/sun/awt/CTextPipe.m +++ b/jdk/src/macosx/native/sun/awt/CTextPipe.m @@ -235,9 +235,22 @@ void JavaCT_DrawTextUsingQSD(JNIEnv *env, const QuartzSDOps *qsdo, const AWTStri 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);