Android 操作系统中的文本具体在哪里渲染?

发布于 2024-08-18 05:27:16 字数 826 浏览 1 评论 0原文

让我首先说明我想要实现的目标:

为 Android 操作系统创建补丁,使其能够正确显示阿拉伯语/希伯来语。这两种语言都是从右到左 (RTL) 语言,其脚本涉及连接的字母/字形(与具有离散字母的拉丁字母不同)。

示例:

“汽车”的阿拉伯语单词是:

斯尼亚拉

离散字母如下所示:

塞拉利昂

正如您所看到的,每个字母以不同的方式相互连接,具体取决于它前面的内容和后面的内容 接下来是什么。好的,语言课程已经足够了:)我的问题是:

我需要劫持 Android 中的哪些二进制文件/类才能启用此功能?

另一种说法是;如果您希望每个实例“x”在系统范围内显示为“y”,您需要干预什么二进制/类?

源代码可以在 GitHub 上浏览: http://github.com/android/

我认为可能是C/C++ platform_system_core 或自定义 JVM platfom_dalvik 下的某个位置。

需要明确的是,字体不是问题,因为您可以将阿拉伯语/希伯来语字体作为后备字体,并且它们会显示,尽管以离散形式显示。

非常感谢您的帮助:)

Let me first state what I am trying to achieve:

To create a patch for the Android OS to enable it to display Arabic/Hebrew correctly. Both of these languages are Right-to-Left (RTL) and their script involves connected letters/glyphs (unlike Latin alphabets which have discrete letters).

Example:

The Arabic word for "car" is:

سيارة

The discrete letters look like this:

س ي ا ر ة

As you can see, each letter connects to each other letter in different ways depending on what precedes it & what follows it. Ok, enough with the language lessons :) My question is:

What binary/class in android do I need to hijack to enable this functionality?

Another way to put it is; if you wanted every instance "x" to be displayed as "y", system-wide, what binary/class would you need to meddle with?

The source code is browsable at GitHub: http://github.com/android/

I think it might be somewhere under the C/C++ platform_system_core, or thier custom JVM platfom_dalvik.

Just to be clear, the font is not an issue since you can drop Arabic/Hebrew fonts as fall-back fonts and they would display, albeit in discrete form.

Your help would be much appreciated :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

囍笑 2024-08-25 05:27:16

在签出的源代码树中查看 external/skia 。那是skia图形库,它最终负责字体渲染。

see external/skia in a checked-out source tree. that's the skia graphics library, and that's ultimately responsible for font rendering.

只怪假的太真实 2024-08-25 05:27:16

请记住,这个问题比修改底层图形引擎更复杂。

如果您在 Skia 中应用重塑,如果线条宽度发生变化,您可能会遇到问题(当 ä 取代 ä 后接 â 时会发生这种情况)。这是因为重塑阿拉伯语也可能会改变字母的顺序,而正如我所见,斯基亚试图对文本内容采取被动的行动。它只是将字母按原样输出到显示设备。

现在更糟糕的问题实际上是Android本身。阿拉伯语/希伯来语需要 BiDi 重新定位文本,这在 Android 中非常愚蠢,无法处理非常基本的问题。

还有更多坏消息吗? Android 的字体 Droid 不包含阿拉伯语或希伯来语字形。除非我们root设备并用另一种字体替换它,否则会显示方块而不是阿拉伯字母:)

整个平台还远远不能应对任何RTL语言,尤其是阿拉伯语。

如您所见,对 RTL 语言的正确修改不仅仅在 Skia 中......

Remember that the problem is more complicated than modifying the underlying graphics engine.

If you apply reshaping in Skia, you might run into problems if lines' widths change (happens when لا replaces ل followed by ا). This is because reshaping arabic might change the sequence of letters as well and Skia, as I see, tries to act passively regarding contents of text. It simply outputs the letters to the the display device as-are.

Now the worse problem is actually in Android itself. Arabic/Hebrew requires BiDi repositioning of text, which is very dumb in Android and can't handle very basic issues.

More bad news? Android's font, Droid, doesn't contain Arabic or Hebrew glyphs. Unless we root the device and replace it with another font, squares are displayed instead of arabic letters :)

The whole platform is still far from being able to cope with any RTL language, especially Arabic.

As you see, a correct modification for RTL languages isn't only in Skia ....

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文