Skip to content Skip to sidebar Skip to footer

Android 2.3 Hebrew Fonts In Webview

I am porting an app that displays Hebrew to Android 2.3. The 2.3 emulator displays the strings correctly when in a TextView, but when I try to put the strings in a WebView, the web

Solution 1:

When you display the page, you aren't giving a way for the browser to know that your page uses a right-to-left script.

You can use the HTML dir attribute in a markup element that surrounds your right-to-left text (it should detect automatically which characters to reverse, and which not to). (For more details, look at this note from W3C - it seems to be implemented in Chrome at least.)

Probably the most expedient way would be to rewrite the first tag as:

<html dir="rtl">

Solution 2:

I changed the font of the webview by adding

         mWebView.getSettings().setFixedFontFamily("DroidSansHebrew.ttf");

The text is rendered in the correct font but left-to-right which is not the correct orientation for Hebrew.

Post a Comment for "Android 2.3 Hebrew Fonts In Webview"