问题描述
playLabel = [CCLabelTTF labelWithString:NSLocalizedString(@play,nil)fontName: @font.ttffontSize:32];
和我的font.ttf文件只支持英文/中文/日文,如果是韩文,会出现。所以我想使用Arial字体为韩国(但仍然我的自定义font.ttf字体为中国/日本,法国或西班牙语它是好的,但因为我可以简单地忽略字母上面的标记。
所以我该如何做呢?或者我应该做一个方法像[助手getFont],并返回不同的本地化的字体文件?
当添加语言时,我有一种语言的多种选择(如zh是中文,但是zh-hans是简体中文,zh-hant是繁体中文,所以我可以只用zh不希望将它们分开?
我不确定这是否可行(似乎应该)如果你在你的本地化文件中定义了不同的字体名称?
pre $ N $ string $ fontName = NSLocalizedString(@playLabelFontName,nil) ;
playLabel = [CCLabelTTF labelWithString:NSLocalizedString(@play,nil)fontName:fontName f ontSize:32];
在您的英文/中文/ b
$ b
playLabelFontName=font.ttf
在你的韩语中:
pre $ play $'$' / code>
here is a sample line:
playLabel = [CCLabelTTF labelWithString:NSLocalizedString(@"play", nil) fontName:@"font.ttf" fontSize:32];
and my font.ttf file only support English/Chinese/Japanese, and if it is korean, nothing will show up. so i want to use Arial font for Korean (but still my custom font.ttf font for chinese/japanese, for french or spanish it's fine though since i can simply ignore the mark above letters.
so how can i do this? or should i make a method like [Helper getFont] and return different font files for different localization?
and also, when adding the language, i have multiple choices for one language (like 'zh' is chinese, but 'zh-hans' is simplified chinese and 'zh-hant' is traditional chinese, so can i just use zh for both case if i don't want to separate them?
I am not sure if this will work (seems like it should), but what about if you defined the different font names in your localization files?
NSString *fontName = NSLocalizedString(@"playLabelFontName", nil);
playLabel = [CCLabelTTF labelWithString:NSLocalizedString(@"play", nil) fontName:fontName fontSize:32];
In your English/Chinese/Japenese localization file put:
"playLabelFontName" = "font.ttf"
In your Korean put:
"playLabelFontName" = "Arial.ttf"
这篇关于iOS本地化可以在plist中使用2个ttf文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!