相邻的“f”和“l”字符

出于某种原因,当我显示单词“蝴蝶”(或任何其他与“FL”),“f”和“l”连接在顶部(见下图)。 字体是世纪哥特粗体。 这是我用来设置UILabel的代码。 从plist中检索标签的string:

UILabel *label = [[UILabel alloc] init]; label.text = [self.flashcardDelegate.alphabetArr objectAtIndex:index]; label.textColor = [UIColor colorWithRed:.733 green:0 blue:.03137 alpha:1]; label.backgroundColor = [UIColor clearColor]; label.frame = CGRectMake(ipad ? 210.0f : 65.0f, ipad ? 650.0f : 300.0f, ipad ? 340.0f : 185.0f, ipad ? 250.0f : 135.0f); label.font = [UIFont fontWithName:@"CenturyGothic-Bold" size:ipad ? 200 : 100]; label.textAlignment = UITextAlignmentCenter; 

任何想法为什么会发生? 谢谢。

截图

这就是所谓的连字,是故意的。 如果您使用的是核心文本,则可以通过使用kCTLigatureAttributeName属性来更改操作系统呈现连字的方式,如果您使用的是NSLigatureAttributeName则可以使用NSAttributedString

你所看到的就是一个连字符 – 这个想法最初是为了更容易地处理印刷机的金属块上的字距(对一般连接的字符对使用一个字形),但现在已经延续到了现代时代作为一个很大的文体决定。

我不确定如何在API中禁用它,但希望这些额外的背景信息可以帮助您find答案。

这是做这个的一个简短的方法。 iOS 6.0+

 NSMutableAttributedString *attributedString; attributedString = [[NSMutableAttributedString alloc] initWithString:label.text]; [attributedString addAttribute:NSLigatureAttributeName value:@0 range:NSMakeRange(0, label.text.length)]; [label.text setAttributedText:attributedString]; [attributedString release];