如何在iPhone应用程序中显示不同的自定义阿拉伯字体? [英] How to Display different Custom arabic fonts in iPhone application?

查看:157
本文介绍了如何在iPhone应用程序中显示不同的自定义阿拉伯字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我需要显示具有不同自定义字体的阿拉伯语文本。我按照将 ttf 文件添加到 info.plist 的方案。

In my application i need to display arabic text with different custom fonts. I follow the scenario adding ttf files to info.plist.

根据上述情况,我只能以 ENGLISH 文本的不同字体样式成功获取显示文字。我正在为阿拉伯语字体样式做同样的事情,但在这里我没有得到。为什么会这样?

As per above scenario i am successfully getting display text in different font style for ENGLISH text only. I am doing same thing for arabic font styles but here i am not getting. Why is going like that?

请任何人帮助我

提前致谢。

推荐答案

@Kareem,我从Stackoverflow本身提示加载字体但是无法在第一时间使用它。可能以下步骤可以帮助您。

@Kareem , I took hint from Stackoverflow itself to load the fonts but could not get it working in first go. May be following steps can help you .


  1. 将字体文件添加到项目中。

  2. 在info.plist文件中输入

  1. Add the font files to your project.
  2. Make their entries in info.plist file

,例如

您现在可以实现一些方法,将您的字体加载到某处
申请委托
喜欢

you can now implement some method that loads your font somewhere in application delegate like

- (UIFont *)CustomFontWithSize :(浮动)尺寸{

-(UIFont*) CustomFontWithSize:(float)size{

    UIFont* customFont = [UIFont fontWithName:@"FX_Masa" size:size];

    if(customFont == nil)
        customFont = [UIFont systemFontOfSize:size];

    return customFont;
}


如果您注意到我在这里传递的名字是FX_MASA而不是FX_MasaRegular,这是我错的地方。获取字体时我们需要使用的名称是INSTALL NAME(双击字体以在系统上安装字体,Font Book中显示的名称是安装名称)。

If you notice then the name I have passes here is "FX_MASA" and not FX_MasaRegular , this was the point where I was wrong. The name that we need to use while fetching the font is the INSTALL NAME (Double click on the font to install the font on system and the name that appears in Font Book is the install name).

希望这也有助于解决您的问题。如果您遇到任何好方法,请在此处更新。

Hope this helps your problem as well. In case you come across any good method, please update here.

这篇关于如何在iPhone应用程序中显示不同的自定义阿拉伯字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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