English 中文(简体)
Where exactly in the Android OS is text renderred?
原标题:

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 :)

问题回答

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

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 ....





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签