为什么IOS7中NSAttributedString的紧排失败

为什么IOS7中NSAttributedString的紧排失败,ios7,Ios7,我的应用程序有一个UILabel,格式为NSAttribute字符串,带有 属性:“NSKernAttributeName@1.9,” 当以下代码在运行IOS6的iPad上编译时,kern的工作原理与预期一致 当在运行IOS7的iPad上编译时,不会出现紧排 我已经在苹果开发者网站上提交了Bug#15108371-尚未有回应 NSString *formattedNumber; NSNumber *scoreNum = [[NSNumber alloc] initWithLongLong:thi

我的应用程序有一个UILabel,格式为NSAttribute字符串,带有 属性:“NSKernAttributeName@1.9,”

  • 当以下代码在运行IOS6的iPad上编译时,kern的工作原理与预期一致
  • 当在运行IOS7的iPad上编译时,不会出现紧排
  • 我已经在苹果开发者网站上提交了Bug#15108371-尚未有回应

    NSString *formattedNumber;
    NSNumber *scoreNum = [[NSNumber alloc] initWithLongLong:thisScore];
    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
    formatter.numberStyle = NSNumberFormatterPadBeforeSuffix;
    formatter.formatWidth = 10;
    formatter.paddingCharacter = @"0";
    formatter.numberStyle = NSNumberFormatterDecimalStyle;
    formatter.usesGroupingSeparator = NO;
    formattedNumber = [formatter stringFromNumber:scoreNum];
    
    //Creat atributed string of formated number.
    NSShadow *textShadow = [[NSShadow alloc] init];
    textShadow.shadowColor = [UIColor colorWithRed:0.5 green:0.7 blue:1 alpha:1.0];
    textShadow.shadowBlurRadius = 5.0;
    textShadow.shadowOffset = CGSizeMake(0,0);
    
    NSAttributedString  *pHighScoreStyle = [[NSAttributedString alloc] initWithString:formattedNumber attributes: @{
                 NSFontAttributeName: [UIFont fontWithName:@"courier" size:16],
      NSForegroundColorAttributeName: [UIColor colorWithRed:0.6 green:0.8 blue:1.0 alpha:0.8],
                 NSKernAttributeName: @1.9,
                NSShadowAttributeName: textShadow    }   ];
    
    //Change the disply value.
    runningScore.attributedText = pHighScoreStyle;
    

    嗯。我也有同样的问题(见上面的评论)。这取决于字体(我也使用Courier)。出于某种奇怪的原因,Courier不支持紧排(在iOS7中!)使用CourierNewPSMT,一切正常。。。。至少对我来说

    顺便说一句:以下是iphone上的字体列表:

    在iOS6中使用紧排与在iOS7中不使用紧排有相同的问题。我不像你那样使用UILabel,而是使用低级CoreText。你收到苹果公司的回信了吗?他们接受你的错误了吗?苹果还没有。如果有人需要解决方案,请点击这里:谢谢你,纳格。谢谢你的字体列表。对苹果来说日子不好过。是的,我换了新的Courier,发现kerning能如期工作。回避有关字体标准的问题。新的Courier是否符合更复杂的标准?不,我认为这只是苹果的一个缺陷