WebView Malayalam Unicode complex/combined letters - java

I am having problem with my Android application. Which is not displaying some special letters ie, complex/combined letters (KOOTTAKSHARAM) from Malayalam language.
In my application I am using WebView to load the html prepared with Unicode chars received from server. The font 'Thoolika.ttf' is loading from asset.
Later I was used ascii text from server, and .ttf font file and worked without problem. I tried UTF-8 conversion also, but didn't help.
So I would like to know is it possible to display complex/combined letters (KOOTTAKSHARAM) from Malayalam language, using Unicode chars and Unicode font file (.ttf) ?

The split rendering of Koottaksharam and Chillu in Malayalam is not the real issue. The real issue is - only a few manufacturers support Malayalam Unicode fonts, and little of them renders Malayalam correctly.
You can read Malayalam in Samsung, but NOT in HTC, LG, Sony etc. Google has added native support for Malayalam in JellyBean (v.4.1)
The only workaround is - convert the Unicode text into ASCII codes, use that ASCII text in components, and load the font dynamically. You can see that at Manoramaonline.com - see the HTML source - they are not using Unicode, instead they are using some symbols, and displays those symbols using their own font, which eventually looks like Malayalam text.
Mathrubhumi.com has a mobile version of their website, which uses the same technique. You can read Malayalam perfectly even when there's no support for it. I think they are first typing out the ASCII version (to publish for Print and Android) and converts it into Unicode later (to publish in Websites)
There are many ASCII-to-Unicode converters like http://aksharangal.com/ and one famous Unocode-to-ASCII converter is - http://smc.org.in/silpa/ASCII2Unicode

Related

PDFBox Embeded fonts not working when filling form

I fill forms with field.setValue. However even though PDF document has embedded fonts in it, I am getting error "is not available in this font's encoding: WinAnsiEncoding" no matter which type of font it is. Note that this is happening for chinese or russian characters.
Your PDF documents may have embedded fonts but they apparently have been embedded with an Encoding value WinAnsiEncoding.
WinAnsiEncoding contains essentially the Latin-15 characters, so it is intended for “Western European” languages (see the Wikipedia article on this) and in particular neither for Cyrillic nor for CJK languages.
If you want to fill chinese or russian characters into form fields using PDFBox, therefore, you have to
either embed a font into your PDF using an appropriate encoding beforehand
or replace the embedded font with PDFBox right before setting the form field value, see for example this answer.

How to add two Fonts to java swing components, and make them automatically switch when user switches keyboard input language?

I'm working on an app where User should be able to input some text which contains both English and Persian(Same as Arabic: almost same characters and written from right to left ).
Currently i'm using fonts like Courier New which supports both languages but it looks really Ugly. I Want to use some better looking fonts, but these fonts only support one of these languages and show nonsense characters for the other language. So i need to use them based on text language.
So generally how can I make Java components (especially swing.JTextField, swing.JListBox and swing.JTextComponent) accept two fonts and switch appropriately to have a good looking GUI?
Edit: Here is an example of what i need. Let say user should input something like (FPGA استفاده از ) and all of it in a single swing.JTextField. It means (Using FPGA) and FPGA is an abbreviation, so there is no Persian translation. I need to set a font with a better look and all fonts which support Unicode are ugly for the Persian part.
Now if I set font to something like Times New Roman ,which only supports Latin, then Persian characters would show as empty squares. also if i set font to something like B Nazanin ,which only supports Persian, then Latin characters would show as empty squares. How can I have both fonts in a single Java component in the same time.
InputContext context = InputContext.getInstance();
if(context.getLocale().toString().equals("en_GB")){
.setFont(*font for english keyboard*);
}
else if(context.getLocale().toString().equals("fa_IR")){
.setFont(*font for persian keyboard*);
}

Java unicode fonts

I am developing a java game and I need characters, such as monsters and doors etc. I am trying to include them with the help of chars and unicode. However, some chars, such as a key, '\u26BF', do not show up properly in the terminal of the game, but rather as a box. Do I need to import some special fonts or how else would I solve this problem?
GNU Unifont is reported as containing this Glyph. As it comes under the GNU public licence it is not subject to any licence fee.
Home page: http://unifoundry.com/unifont.html
It has TrueType, which should work wiht Java.
Like people already pointed out in the comments sections, you will have to use another font containing those special characeters.
The font you are using seems to not support those characters, you can download any other font containing those character(s). The character 'u26BF' is a square box in some default fonts (source).
You can find different fonts and even try them out on DaFont and, like #SubOptimal warned you, check the licenses also before you download & use it.

Where do I set the character encoding in a Java Swing application so that I can write Hindi to a MySQL database?

I have a form which contains several fields like textbox, lables, etc.
In text fields I used "Kruti Dev 040 Wide" font to type value in Hindi, But when i save this value to database its shown in English. Please help me out of this problem I want this values in database in Hindi format.
Thanks and regards
Sandeep Sharma
Normally, you'd expect to have to set up your database to store UTF-8, in order to use Devanagari characters (the ones used for Hindi). But the Kruti Dev fonts avoid this issue by doing something slightly nasty. They actually make the Roman letters look like the Devanagari letters. This has the advantage that you can easily type Hindi on a standard English keyboard. But it has the disadvantage that anything that you write in Hindi will, under the covers, be Roman text.
So you have two options.
You can use a Kruti Dev font, but be aware that you'll still be working with Roman text. If you want to display your text, and have it look like Hindi, you'll need to use a Kruti Dev font to display it.
You can abandon the Kruti Dev font, and use UTF-8 characters for the Devanagari characters; making sure, of course, that your database is able to save UTF-8.

Japanese in JTextArea

I have a database with japanese words. Additionaly i have algorithm that reads these words and put them into JTextArea.
Problem is I see rectangles instead of japanese signs.
But when i copy such a set of rectangles (ctrl+c) from JTA and put them into eg. command input of TotalCommander or Winword document, signs appears are displayed properly. But only under Win7.
Because i run Eclipse on Virtual Machine under winXP I have ability of copy rectangles also to command input of TotalCommander under winXP. There are remain rectangles as in my Java app.
It means that there is in JTA an info about particular signs, but JTA can't interpretes this info.
Of course I have installed proper font.
I've tried many way with fonts:
textArea.setFont(new Font(blablabla));
and similar, but without effects.
What should i do?
The Problem with your JTextArea is most-probably, that the font you're using isn't applicable for UTF-8 & Japanese. The font doesn't provide an mapping table from UTF-8 values to characters. i.e. 0x41 is in ASCII, as well as in UTF-8 and even SHIFT-JIS the letter 'A' - but the Font you're just linking, resolves 0x41 to an Kanji character. And the whole font doesn't contain Hiragana and Katakana characters at all - please see also the comments section on the site where you got this font from here.
After using ChapMap it has a WSIfonts TAG and does NOT! support ALL the Chinese characters it only has 90 characters and assigns 1 character per Char except Caps.
It's a chinese font - not a Japanese one. But it won't even provide all chinese characters and has no useful mapping table included - so it's pretty useless.
Try to use another font - that should work just fine, if it contains really japanese characters and provides an applicable mapping table for UTF-8.
You can find fonts, that would work i.e. here

Categories

Resources