How to display Thai diactirics properly on Android? - android

A short preface. Thai script has vowel signs that may appear above the consonants, and also there are diacritic signs (DS) that also appear above the consonants; when both vowel and DS present, they appear one above other, so the vowel is set above the consonant and the DS is set above the vowel.
I am writing an application that will display text in Thai. Everything looks perfect in the emulator (API 10) but not on the real device (Samsung GT-I9001 with Gingerbread 2.3.6).
I've prepared two pictures to illustrate the problem. I have a simple layout that has the only TextView at the top; two words พี่สาว and ไม้ are displayed in that view.
This is how it should look like (a screenshot from the emulator):
The first character has a vowel and a DS above the vowel, and the last character has the DS only.
And here is a screenshot from my phone:
Both DS have slid down and now the vowel and the DS overlap each other above the first character. Note that the last by one character appears lower than it should (it should be whole line tall like you may see on the first screenshot).
I've found that the problem is system-wide: I've copied these Thai words to a simple web page and loaded it in the web browser in my phone, and got the same problem. It seems like the font rendering is broken.
So the question: how to bypass this? Do I need to install fonts (how?) or maybe some language pack (again, how?), or the only way is upgrading the Android?
PS: no problem on Android 4.0.4. Perhaps only old versions are affected.
Update: WarrenFaith has given a promising advice about setting the custom font. However this appeared to be not as simple as it looks. I've tried several different fonts including Roboto (introduced in ICS), Verdana from the msttf Linux package, and some others. To see that the font is really loaded and applied, I've added some Latin and Cyrillic characters to my text.
The result is funny. Only the Latin and Cyrillic characters change, but not Thai ones. Looks like the fonts don't have the required glyphs and Android replaces them with ones rendered using some default font.
(I don't understand why Roboto didn't work; it's the official Android font—shouldn't it have full support for the whole Unicode?)
So it seems like I have to find the font that has Thai glyphs.
And I'm still wondering what font is used by default in Android 4.0.4.
Happy end: thanks to WarrenFaith's advice, Google, and this blog article.

If the default text/font is broken, you should provide a font you know that will work. To implement the font, you can use the following answers:
Android - Using Custom Font
Using a custom typeface in Android

Related

Is there a font which supports invisible chararcter and has every character at the same size?

I'm a newbie in android developpement and ASCII art.
I made an RPG which uses ASCII art for graphics but I can't find any font which, when applied to Android :
-Supports invisible characters;
-Has a unique size for all characters, including every character in UTF-8.
Unfortunately I foud Consolas which works well on PC, not in Android.
Could you please help me?
PS - One of the concerned ASCII-arts :
ASCII art
EDIT - Nevermind, I found that Courier new works well. I just need to find another invisible character.;.

Raised colon ligature in Android?

Is there a way to enable your app to use raised colons between numbers for a font in Android? I believe the Roboto font supports it based on the lock screen which shows the colon vertically centered, as opposed to some other apps.
Here's an example of what I mean, the top one is what the Roboto font looks like by default (the colon is too low) and the bottom one is what it looks like on the lock screen:
Try unicode glyph U+02F8 -- hopefully the font supports it.
Thanks to the other comment I found one that works (the one mentioned is too high for me)
https://www.compart.com/en/unicode/U+A789
Simply copy&paste this character ꞉
Example: 8꞉93
At least my Pixel 3a displays that one correctly centered

Chrome on Android renders unicode astrological characters as emoji, how can I disable that behavior (render them as normal characters)? [duplicate]

I've been trying to make use of the Unicode symbols for astrology in products for both Apple and iOS. I'm getting inconsistent results, as shown here:
Most of these are coming out as I like, but for some reason the Taurus symbol is appearing one way on the first line, following the Moon, and a very different way, with the Emoji-like purple button, when it follows Mars. These results are consistent for different symbols and across Apple hardware; here's a screen capture from my phone showing the same problem with some other signs - Scorpio comes out all right, but Libra and Cancer are buttons.
The strings are extremely straightforward; "Moon Taurus" in the first image is \u263D for Moon, \u2649 for Taurus, basically assembled as [NSString stringWithFormat:#"%#%#", #"\u263D", #"\u2649"]. The "Mars Taurus" image is the same, only with \u2642 for Mars. The string formatting is identical in the different cells of the OSX table, and in the iOS AttributedString.
Any idea what makes these symbols appear one way sometimes, and another way other times?
Unicode uses variation sequences to select between different renderings for certain code points—listed in the StandardizedVariants.txt file. In your case, the astrological symbols have both "text style" and "emoji style" variants that are selected between by a U+FEOE (text style) or U+FE0F (emoji style) following the code point:
U+2650 U+FE0E: ♐︎
U+2650 U+FE0F: ♐️
Note that correct interpretation of the variation selector depends on support from both the application/framework and the fonts being used. On Chrome (42) there doesn't appear to be any difference between my examples above, but on Safari (8) they are distinct.

Android special characters converted to images in WebView?

Special characters such as
📂 ★ ✉
Are being replaced with images in the Android OS. As you can see, this seems to affect native TextViews (see screenshot).
My problem is they are also affecting the HTML I am loading through my app via WebView. The main problem is stars of different colors are all showing up as the same gray star. And other than that, you can imagine the visual inconsistency problems that arise.
If you load this page on Chrome for Android, the characters don't load at all. But if you copy the question and paste it into a plain text program such as ColorNote, you will see what I'm experiencing.
Is there a way to get my own WebView or even my entire app to use the font-family, rather than an image?
A wild guess, since I've only heard about this happening on iOS now.
How can I disable the unicode black telephone from being rendered as a red phone on iOS Mail app?
I need help getting a normal looking unicode down arrow in a UILabel like this ⬇
Unicode has this nifty thing that's called "Variation selectors", which can be used, among others, to select a variant shape of a letter, or to select whether a glyph is to be rendered as a black-and-white standard glyph, or as a colourful picture.
This variants are characters \uFE00 to \uFE0F. In case of emoji, \uFE0E means "render the previous character as a black-and-white glyph", and \uFE0F means "try to draw the previous character as a colourful picture".
So in your case, add \uFE0E after the character.

Using hebrew with the android emulator

I want to be able to run a "Hello World" application on my android emulator in hebrew
How can I do that? is it supported?
thanks
Though android does not have complete support for Hebrew if you are just displaying text, then it turns out to be pretty easy to do.
First you want to add a Hebrew font to your app. For this you simply put a true type font file (with Hebrew characters) in your assets directory. Then you load the font and use it on your view. For any view that inherits from TextView (which includes just about any view that displays text), you do the following:
AssetManager assets = getAssets();
Typeface font = Typeface.createFromAsset(assets, "hebrewfont.ttf");
view.setTypeface(font);
This will cause Hebrew characters to be visible. You may need to use the RTL mode character (\u200F) to force your text to display in the correct order. You may also need to set the gravity to right in order to right align the text.
I've found no way to get the scrollbar to appear on the left side. :( Cantilation marks to however display properly starting in android 2.2. I've tested Nequdot in all versions since 1.5, and they work as well. You may want to use some of the precombined characters, such as shuruq (\ufb35) instead of vav+dagesh (\u05d5\u05bc), as this isn't necessarily handled properly.
I have had good results with the DejaVu font, which is freely available.
Although this has been asked a long time ago, there is a native Hebrew support in later versions. The avd with API15 (Android 4.0.3) can display Hebrew nicely out of the box. I'm not sure which version is the earliest with this capability.

Categories

Resources