Dipaly farsi文本在android webview(对于不支持波斯语的手机) [英] Dipaly farsi text in android webview (for phones not supporting farsi)

查看:310
本文介绍了Dipaly farsi文本在android webview(对于不支持波斯语的手机)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在波斯语中,字母附加在一起形成书写脚本。但是,当我使用UTF-8或Windows-1256环境保存HTML页面,并尝试在Android中使用webview显示它们,字母是单独显示和从左到右的方向(而不是RTL)。
我应该注意到这种情况不会发生在支持farsi的手机中。

In farsi letters are attach together to form writing scripts. However when I save HTML pages using "UTF-8" or "Windows-1256" encdoings, and try to display them using webview in android, letters are diplayed seperately and in left-to-right direction (instead of RTL). I should notice that this case is not happening in phones supporting farsi.

正确的形式应该是这样的(从支持farsi的手机快照):



answer坏形式文本发生在不支持farsi(波斯语)的手机中:

Correct form should be like this (snapshot from phone supporting farsi):

Bad-formed text happens in phones not supporing farsi (Persian):

应该注意的是,我在这两种情况下都使用了波斯语字体。
我也看到一些解决方案的正常Strings在java中改变字符在这
问题

It should be noticed i've used persian font in both cases. I also see some solutions for normal Strings in java which changes character on by one in this question

我的问题:我可以修复这种情况(或者应该由电话供应商修复)?如果可能的话是什么解决方案?

My question: Can i fix this cases (or it should be fix by phone vendors)? if possible what is solution?

推荐答案

当我在做键盘时,问题是在Android中的canvas.drawText函数中的构建不支持RTL语言。有一个补丁,但它不是默认的Android构建的一部分。所以只有使用它的世界的那些地方的模型往往有它。不幸的是我知道没有办法来测试它是否有补丁。如果没有,没有办法解决它。你可以尝试颠倒文本,但是你会打破有补丁的设备。

I hit this bug a lot when I was doing keyboards. The problem is that the build in canvas.drawText function in Android didn't support RTL languages. There was a patch for it, but it wasn't part of the default build of Android. So only models going out to those parts of the world that used it tended to have it. Unfortunately I know of no way to test whether it has the patch. And if it doesn't, there's no way to fix it. You could try reversing the text, but then you'd break devices which did have the patch.

长故事短,没有办法解决它。然而,如果谷歌现在没有拿起补丁(它存在于2.2天),我会感到震惊,所以它的手机数量减少。

Long story short- there is no way to fix it. However, I'd be shocked if Google hasn't picked up the patch in mainline by now (it existed back in the 2.2 days), so its a shrinking number of phones effected.

这篇关于Dipaly farsi文本在android webview(对于不支持波斯语的手机)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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