安卓:阿拉伯字体 [英] Android: Arabic font

查看:35
本文介绍了安卓:阿拉伯字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试解析包含复杂阿拉伯字母的 XML 文件..

I am trying to parse an XML file which contains complex arabic letters ..

当我在 android 2.3.7 上测试时,并不是所有的阿拉伯字母都支持,仍然有一些复杂的字母显示为正方形..

When i tested on android 2.3.7, not all arabic letters are supported, there is still some complex ones appear as squares ..

但是当在 android 4.0.4 上测试时,所有的字母看起来都很棒..

But when tested on android 4.0.4, all letters appear great ..

我需要找到 4.0.4 中使用的 .ttf 阿拉伯字体或最好的 android 阿拉伯字体,以强制它在我的应用程序中在所有版本上都能正常工作,你能帮我吗?

I needed to find the .ttf arabic font used in 4.0.4 or the best android arabic font to force it in my application to work fine on all versions, can you help me please?

我尝试过 DroidNaskh-Regular.ttf 和 DroidSansArabic.ttf 但与 android 4.0.4 不一样..

I tried DroidNaskh-Regular.ttf and DroidSansArabic.ttf but not the same like android 4.0.4 ..

谢谢..

推荐答案

试试这个解决方案:

此处获取在 android 4 上使用的机器人字体.如果这不起作用,您可以尝试其他字体,例如 DejaVu 字体.其他字体可用这里例如.

get the roboto font as used on android 4 , from here. if that doesn't work , you can try out other fonts , such as the DejaVu font . other fonts are available here for example .

然后,把文件放到你的assets文件夹中,对于每个需要显示文本的视图(比如textView),使用字体:

then , put the file into your assets folder , and for each of the views that need to show text (like textView) , use the font :

Typeface face = Typeface.createFromAsset(getAssets(), "Roboto-Regular.ttf");
textview.setTypeface(face);

我过去试过希伯来语,结果很好.遗憾的是,特殊点(称为NIKUD")没有很好地显示,因此您可能会遇到类似的阿拉伯语问题.

i've tried hebrew in the past and it showed fine . sadly , the special dots (called "NIKUD") didn't show so well so you might have similar problems for arabic .

这篇关于安卓:阿拉伯字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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