【问题标题】:Font Anti-Aliasing on iPad SDKiPad SDK 上的字体抗锯齿
【发布时间】:2011-02-11 08:16:02
【问题描述】:

我在 iPad SDK 上使用自定义像素字体,并且正在尝试找到一种方法来禁用 UIFont 的字体抗锯齿功能。像素字体通常在没有抗锯齿时效果最好。当我创建静态资源时,我很容易在 Photoshop 中禁用它,但这次我需要使用自定义字体的动态输出。

如果这可能的话,有什么想法吗?

谢谢。

【问题讨论】:

    标签: antialiasing uifont


    【解决方案1】:

    如果您将 UILabel 或类似的子类化,这样的事情可能会起作用:

    -(void) drawRect:(CGRect)r {
        CGContextRef context = UIGraphicsGetCurrentContext();
        CGContextSaveGState( context );
        CGContextSetShouldSmoothFonts( context , false );
        [super drawRect:r];
        CGContextRestoreGState( context );
    }
    

    如果这不起作用,您也可以尝试以下调用:

    CGContextSetAllowsAntialiasing( context , false );
    CGContextSetShouldAntialias( context , false );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-01-26
      • 2015-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-18
      • 1970-01-01
      相关资源
      最近更新 更多