English 中文(简体)
• 如何在 iPhone应用中显示不同的阿拉伯字体?
原标题:How to Display different Custom arabic fonts in iPhone application?

在我的申请中,我需要用不同的习俗来显示阿拉伯文本。 下面的假设是将<代码>ttf文档添加到info.plist

根据上述设想,只有文本才能成功地以不同的字体显示文字。 我也做了同样的事情: 真的风格,但这里并非已经出现。 为什么如此?

请任何人帮助我

预付款。

最佳回答

@Kareem ,我从Stackoverflow本身拿到装上字体,但不能先到工作。 或许可以采取一些步骤帮助你。

  1. Add the font files to your project.
  2. 将其条目输入信息。 名单

    例如“entergraph

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

    - (Font*) 习俗基金会(float)

        UIFont* customFont = [UIFont fontWithName:@"FX_Masa" size:size];
    
        if(customFont == nil)
            customFont = [UIFont systemFontOfSize:size];
    
        return customFont;
    }
    

如果你注意到,我在此通过的名称是“_MASA”,而不是_MasaRegular ,这就是我错失之处。 在计算字体时我们需要使用的名称是INSTALL 不结盟运动E(Double at the font to set the font on system and the name that listed in Font Book is thestal name)。

“entergraph

希望也帮助你解决问题。 如果你采用任何良好方法,请在此提供最新情况。

问题回答

There is a nice UILabel extension in GitHub called "Font Label": https://github.com/zynga/FontLabel This allows to load any TTF file and then draw ZLabel objects (ZLabel is an extension of UILabel) with this custom font. It is based on CoreGraphics and I tested with many custom fonts and proved to work correctly. I don t know of course the effect with arabic fonts, but it s worth a try and a feedback from you (to us and also the github project admins) is welcome.





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签