How to display malayalam in phonegap application? - android

I am trying to develop a phone gap application with malayalam language but it is not showing in web-kit browser. anyone have answer for this?

Not all android phone does not support Malayalam Unicode font, and you need to convert Unicode font to ascii font to display Malayalam in all devices.
this may help in your condition.
First you need to convert Unicode font characters to Ascii font using java code(Use any Unicode font like ML_TTKARTHIKA.ttf).
use #fontface font attribute in html to display ascii font to Malayalam characters
For more help: Refer this question

You need to have a unicode font that has the malayalam characters (one of these, for example) and generate the webfont support for it.
Add the font and the webfont style to the css folder in your project. Load them in the index.html and add the font to the css body declaration.

unicode fonts will render properly in cordova webview
just add this in html header <meta charset="utf-8" />

Related

Problem with loading fonts in html on UITextView in iOS

I have an HTML script that needs to be displayed inside of a webview in Android and in an UITextView in iOS. This script uses multiple fonts.
When declaring the fonts in Android I used the following script:
#font-face {
font-family: 'myfont';
src:url("file:///android_asset/fonts/myfont.ttf")
}
and it worked perfectly fine.
In ios, however, I was unable to find the correct solution for setting the source path for the fonts.
I tried the following:
src:url("myfont.ttf")
src:url("myfont.ttf")
src:url("file:///fonts/myfont.ttf")
src:url("file:myfont.ttf")
Do you know how it should be set for iOS
You need to mention the correct font family name and that's it. No need to specify the src. Just make sure to add it in your Info.plist file under key <key>UIAppFonts</key> like so:
<key>UIAppFonts</key>
<array>
<string>Lato-Black.ttf</string>
</array>
How to find font family name?
You might think that the font family name is the name of the file itself. But it is not. Have a look at the below screenshot
The file name is different but the font book shows something else. The title in the font book application is your font family name. To denote different weights of the font, use -Regular, -Bold, etc.
Then in your css you can directly use
span {
font-family: "MathJax_Math-Regular"
}
and your font should be applied

How to force arabic font (TypeFace) to use english numbers Android?

I am using arabic font in my android app but the numbers is written in arabic , I want to use the same font but numbers still in English Language,Or Customize the TypeFace..Any way??

Tamil fonts in Android

I developed a Tamil news application in android version 2.3.3. However, Tamil fonts have only been properly developed in android versions 4.0 and beyond. I want to display them in all versions of android mobile.
I tried to solve the problem with some Tamil fonts, such as bamini and mylai, but they only worked in higher android versions.
First of all you have to understand that there is no Tamil Language support in Android OS (except few Samsung & SE mobiles) till ICS(4.0). Even then it had bugs and full support is provided with Jelly Bean (4.2).
You will only see boxes if you use Unicode Tamil font in your app. Reason is there are no Tamil fonts in the system.
1. Manual way of doing
There is a work around for this solution. All you have to do is, download the Bamini font and place it in your assets folder. And create TypeFace with the font Bamini and set it to the TextView.
Typeface font1 = Typeface.createFromAsset(getAssets(), "fonts/Bamini.ttf");
customText1.setTypeface(font1);
Now use a converter to convert Unicode font into Bamini encoding. instead of the Unicode text provide the converted Bamini encoded script into the setText method.
2. Using the Library
If you hate all these manual encoding conversion then check out this library
As I said in above line, if you like to change the encoding dynamically while running the application then consider using the library I wrote for Android. This library will help you to convert Unicode String to Bamini, TSCII, TAB, TAM and Anjal.
Set up is very simple. All you have to do is simply import the library into your Android project and call the library as below.
// Initialise the Typeface (assumes TSCII, Bamini, Anjal, TAB or TAM font located inside assets/fonts folder)
Typeface tf = Typeface.createFromAsset(getAssets(),"fonts/mylai.ttf");
// Initialises the TextView
TextView tv = (TextView)findViewById(R.id.textView1);
//Setting the Typeface
tv.setTypeface(tf);
//Magic happens here ;) encoding conversion
String TSCIIString = TamilUtil.convertToTamil(TamilUtil.TSCII, "வணக்கம் அன்ரொயிட்");
//Setting the new string to TextView
tv.setText(TSCIIString);
There is a sample app available along with the library. Check out the app on how the library is utilised to convert the Unicode String to Bamini, TAB, TAM, TSCII and Anjal.
You would get something like this when you use the library.
You need to make use of the TypeFace class available in Android. You can use either Bamini or TSCII encoding (Mylai is a TSCII font).
Disclaimer : I wrote this library.
3. For WebView
If you are developing using html and CSS wraped inside a WebView then take a look at this application's source. You gonna have to make use of fontface feature of CSS3.
First you need to have style declared as this
#font-face {
font-family: MyCustomFont;
src: url("Bamini.ttf") /* TTF file for CSS3 browsers */
}
Then you gotta use the MyCustomFont in your tags. For example if you wanna set it to the whole body (which is much easier in this case)
body {
font-family: MyCustomFont, Verdana, Arial, sans-serif;
font-size: medium;
color: black
}
Hope this would give you the heads up you deserve. Hope to see more Tamil apps in Play Store.
TAb dont need embedd, now we have unicode
Please use this Tamil unicode fonts
http://visualmediatech.com.fonts

my font size is 0 byte after launching the app

I have trouble with my font.
I need to display plain, bold and italic text in a specific font in the same textView.
I use html.fromHtml and with the regular android font it works fine.
I want helvetica instead, so I built a single font file witch contained the three fonts (plain bold italic), and used setTypeFace on my textView. I built it from 3 otf files with fontBuilder.
But when I call Typeface.createFromAsset(getAssets(), "fonts/HelveticaNeue.dfont");
i saw that my font file size was 0 bytes, and indeed in my project I can't import it well,
when i go in the folder fonts i see that the size is ok, but from eclipse point of view, 0 bytes.
Does somebody have an idea ?
ANSWER:
The problem was that my font didn't had dataFork, it's a thing that you have to add to your font for it to be understood by PC's, and Unix OS.
is it correct format .dfont
i think fonts should be with .ttf
Typeface.createFromAsset(getAssets(), "fonts/HelveticaNeue.ttf")

Hindi Marathi font on Android

which font is most suitable for Android application developed in Marathi/ Hindi indian language. I tried with mangal and droidsansfallback but still the words dont appear as they should. I don't see the boxes or some special characters after using above font which is good, but still the marathi/hindi words doesnt have exacts alphabets. Any help/guidance will be appreciated. Thanks....
As Devanagari fonts are not supported by Android, you can still give that support to your Application.
For Marathi font copy font file to your asset folder. then use the following code.
TextView text_view = new TextView(this);
Typeface font = Typeface.createFromAsset(getAssets(), MarathiFont);
text_view.setTypeface(font);
text_view.setText("मराठी");
the same way u can give support for hindi....
Marathifont = any marathi or devanagari font
e.g
Marathifont = "kiran.ttf"
Devnagari fonts are not supported in older devices. You can replace the default font after rooting the device. mangal font worked pretty well for me.
Fontoosh can be helpful for installing devnagari font or replacing the font.
I think you should use Google Noto Fonts.
Just search for Hindi/Marathi and you will get fonts for it.
Noto Sans Devanagari is good.

Categories

Resources