ココアアプリでテキストを描画していますが、NSTextField と NSTextView で描画する必要があり、まったく同じに見えます。通常はすべて正常に描画されますが、テキストに Unicode または中国語の文字が含まれている場合、NSTextView は行間に大きな行スペースがある場合、nstextfield で正常に描画するときに完全に機能します。
見つけることができるすべての設定を試しましたが、この問題に影響を与えるものはありませんでした。以前にこの問題に遭遇し、修正を知っている人はいますか?
この問題は、http://cl.ly/3e0U1T2U2G2z341j3O3Tのスクリーンショットで確認できます。
これが問題を示すための私のテストコードです
NSTextField *textField = [[NSTextField alloc] initWithFrame:NSMakeRect(5, 50, 100, 100)];
[textField setStringValue:@"え?移転!? TESTTestTer 友達の旦那の店 THIS IS A TEST THIS IS A TEST"];
[textField setBordered:NO];
[textField setBezeled:NO];
[textField setAllowsEditingTextAttributes:YES];
[textField setDelegate:self];
[textField setFont:[NSFont fontWithName:@"LucidaGrande" size:12.0]];
[textField setTextColor:[NSColor colorWithDeviceRed:(74.0/255.0) green:(74.0/255.0) blue:(74.0/255.0) alpha:1.0]];
[[window contentView] addSubview: textField];
NSTextView *textView = [[NSTextView alloc] initWithFrame:NSMakeRect(200, 50, 100, 100)];
[textView setString:@"え?移転!? TEST TestTer 友達の旦那の店 THIS IS A TEST THIS IS A TEST"];
[textView setDelegate:self];
[textView setFont:[NSFont fontWithName:@"LucidaGrande" size:12.0]];
[textView setTextColor:[NSColor colorWithDeviceRed:(74.0/255.0) green:(74.0/255.0) blue:(74.0/255.0) alpha:1.0]];
[[textView layoutManager] setTypesetterBehavior:NSTypesetterBehavior_10_2_WithCompatibility];
[[textView textContainer] setLineFragmentPadding:0.0];
[[window contentView] addSubview: textView];