[Galaxy S II Themes and Apps] brightidea:
Hey man!

I've been thinking about shaping drawn text 100% natively by intercepting calls made to libandroid_runtime.so. Do you think it's doable ? I took my chances and created lib__droid_runtime.so and libandroid_runtime.so (which intercepts all calls). The system boots without problems (that's the easy part for me http://www.multiupload.com/3JJFWBSUYV). Now, what I need is to find out how to finish the work by actually changing the strings passed to the drawing functions.

I noticed that you're changing many methods in your patch:

in Paint.smali:
breakText(Ljava/lang/String;ZF[F)I
breakText([CIIF[F)I
getTextWidths(Ljava/lang/String;II[F)I
getTextWidths([CII[F)I
measureText(Ljava/lang/String;)F
measureText(Ljava/lang/String;II)F
measureText([CII)F
and
getTextBounds(Ljava/lang/String;IILandroid/graphics/Rect;)V
getTextBounds([CIILandroid/graphics/Rect;)V
getTextPath(Ljava/lang/String;IIFFLandroid/graphics/Path;)V
getTextPath([CIIFFLandroid/graphics/Path;)V

in Canvas.smali:
drawPosText(Ljava/lang/String;[FLandroid/graphics/Paint;)V
drawPosText([CII[FLandroid/graphics/Paint;)V
drawText(Ljava/lang/CharSequence;IIFFLandroid/graphics/Paint;)V
drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V
drawText(Ljava/lang/String;IIFFLandroid/graphics/Paint;)V
drawText([CIIFFLandroid/graphics/Paint;)V
drawTextOnPath(Ljava/lang/String;Landroid/graphics/Path;FFLandroid/graphics/Paint;)V
drawTextOnPath([CIILandroid/graphics/Path;FFLandroid/graphics/Paint;)V

Another question:

What's the difference (in functionality) between ProcessBidi and ReshapeArabic in your RTL utils?

I think the following is the set of native functions that need to be patched (only if the patch is going to be at JNI level), what do you think?:

Landroid/graphics/Canvas;->native_drawPosText(ILjava/lang/String;[FI)V
Landroid/graphics/Canvas;->native_drawPosText(I[CII[FI)V
Landroid/graphics/Canvas;->native_drawText(ILjava/lang/String;IIFFI)V
Landroid/graphics/Canvas;->native_drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V
Landroid/graphics/Canvas;->native_drawText(I[CIIFFI)V
Landroid/graphics/Canvas;->native_drawTextOnPath(ILjava/lang/String;IFFI)V
Landroid/graphics/Canvas;->native_drawTextOnPath(I[CIIIFFI)V
Landroid/graphics/Paint;->nativeGetStringBounds(ILjava/lang/String;IILandroid/graphics/Rect;)V
Landroid/graphics/Paint;->nativeGetCharArrayBounds(I[CIILandroid/graphics/Rect;)V
Landroid/graphics/Paint;->native_getTextPath(ILjava/lang/String;IIFFI)V
Landroid/graphics/Paint;->native_getTextPath(I[CIIFFI)V
Landroid/graphics/Paint;->native_breakText(Ljava/lang/String;ZF[F)I
Landroid/graphics/Paint;->native_breakText([CIIF[F)I
Landroid/graphics/Paint;->native_getTextWidths(ILjava/lang/String;II[F)I
Landroid/graphics/Paint;->native_getTextWidths(I[CII[F)I
Landroid/graphics/Paint;->native_measureText(Ljava/lang/String;)F
Landroid/graphics/Paint;->native_measureText(Ljava/lang/String;II)F
Landroid/graphics/Paint;->native_measureText([CII)F

After checking the Android 2.3.4 source code, it seems all the above are just JNI wrapper functions for the real native functions defined in libskia.so !! Maybe after all patching libskia would be the only thing needed to arabize the system (even libwebcore patch would no longer be needed if we patch that!)

I think I am going to take my chances and create a patch for libskia tomorrow. I hope it works :)

- Brightidea.