OS 中文斜体 Italic Font Chinese


        CGAffineTransform matrix =  CGAffineTransformMake(1, 0, tanf(15 * (CGFloat)M_PI / 180), 1, 0, 0);

        UIFontDescriptor *desc = [ UIFontDescriptor fontDescriptorWithName :[UIFont systemFontOfSize :17 ]. fontName matrix :matrix];

         font = [ UIFont fontWithDescriptor :desc size :17];

ios中不支持中文倾斜,于是仅仅有设置倾斜角度。

第一行代码:设置反射。倾斜15度。

第二行代码:取得系统字符并设置反射。

第三行代码:获取字体。

上面的代码。通过舍子font的f能够实现,能够实现中文斜体。后面能够用

[string. text drawInRect :dr withFont :font lineBreakMode :NSLineBreakByTruncatingTail ];

绘制出斜体字。

原文地址:https://www.cnblogs.com/gccbuaa/p/6914992.html