斜体字体不适用于iOS 7上的中文/日文/韩文 [英] Italic Font not work for Chinese/Japanese/Korean on iOS 7

查看:293
本文介绍了斜体字体不适用于iOS 7上的中文/日文/韩文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在UITextView中设置斜体字体样式,但斜体字体不适用于iOS 7上的中文/日文/韩文。有人可以帮忙吗? 方案

因为在iOS上没有斜体样式的中文字体,所以你需要使用仿射



下面的代码给出了一个15°倾斜到 Heiti SC Medium $ b $ pre $ ,0,0);
UIFontDescriptor * desc = [UIFontDescriptor fontDescriptorWithName:@Heiti SC Mediummatrix:matrix];
textView.font = [UIFont fontWithDescriptor:desc size:17];

实际效果:


I want to set Italic Font Style in UITextView, but Italic Font just not work for Chinese/Japanese/Korean on iOS 7.Could anyone help?

解决方案

Because there are no italic styled Chinese fonts on iOS, you need to use affine transformation to slant the normal styled Chinese font.

The code below gives a 15° slant to Heiti SC Medium:

CGAffineTransform matrix = CGAffineTransformMake(1, 0, tanf(15 * (CGFloat)M_PI / 180), 1, 0, 0);
UIFontDescriptor *desc = [UIFontDescriptor fontDescriptorWithName:@"Heiti SC Medium" matrix:matrix];
textView.font = [UIFont fontWithDescriptor:desc size:17];

Real effect:

这篇关于斜体字体不适用于iOS 7上的中文/日文/韩文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆