I am new to android programming.I learned some basic stuffs from the youtube tutorial videos.I want to create an app for my blog. The app should act as a web browser and display the content of my blog as such.But the problem is I used to write my blog in a local Indian language.So I want my app to support my local language font which is a Unicode supported font.Is it possible to make my app to support such local font.Please help me?Sorry for my poor english!! :)
You can use Custom fonts for your Android Application,
For this, you need to use Typeface and also you need to have knowledge of Character Mapping of your font.
Following likns will help you,
how to set custom locale for indian regional languages
Can I embed a custom font in an Android application?
Android development using custom fonts
Customize Android Fonts
Related
In android app we generally use xml to design the activities, is it possible to implement any other formatting language
I am writing an app in which I have to support all Indian languages and for that I am looking for some third party library (free or paid)
I googled many times for the same but I did not get any decent option (library)
I just got use strings.xml for (English, Hindi) in their respective folders.
But I have seen in Whatsapp there is a multilanguage option, which supports almost all major indian languages
For an Example : If I do select Hindi language, so it translates complete app in Hindi language only
Same kind of functionality, I need in my app, like in drop down, If user do tap on any of the Indian language, my app has to converted in same one only (Like: Hindi, Telugu, Marathi, Gujarati and others)
What would be the best way of doing this and getting it done?
It depends what do you mean by "support"
Android supports all Indic languages. But it is not localized in all them.
Because of that, some of them cannot be selected from Settings.
But if you can provide string.xml files for all of them, and put them in the proper values-xy folder.
Possible problems:
How to select a language that the OS does not support? Have your own language selection. Once a locale is selected, call Locale.setDefault (to change the formatters), and change the resource loading configuration (Set Locale programmatically)
You see squares. This means missing fonts. Android has fonts for all the Indic scripts. But older phones might miss some. And OEMs might remove some to reduce size. So you can embed the proper Noto fonts in your application and use them (https://www.google.com/get/noto/). Use styles, and have language specific style sheets.
Keyboard missing. Install one. Here is the Google one: https://play.google.com/store/apps/details?id=com.google.android.apps.inputmethod.hindi. But there are also third party ones, for instance https://play.google.com/store/apps/details?id=org.smc.inputmethod.indic
I am developing an Android app for regional magazine which is in Marathi language and from OS 2.2 and above. I am able to use custom fonts for the devices which does not support Devanagari/Marathi natively using typeface.
But the result is not desired and the Marathi text does not look any better. I have following problems with the custom fonts.
Extra horizontal space between two words or character
Extra vertical space between two line
Collapse of two lines
Does not works on all devices
Joint characters(जोडाक्षर e.g.'त्या') are not showing well
I have tried many fonts like utsaah,mangal,arialuni,shivaji but none of them have full support.
I have seen one of very good marathi app here which works on Android 2.1 and above. Can anyone please help me? How can I use a font which supports all Android devices?
I don't know if it is possible to fix the problems you listed in your question using custom fonts.
But let me suggest you an approach to display your content using WebView. In a WebView marathi should look fine. You can use custom fonts as well. The only difference is that instead of composing xml layouts you will have to create web pages (html+js) and package them in your app.
A couple of how-to-start guides:
developer.android.com
developer.chrome.com
An alternative to this solution would be using a framework. The app you referenced to (Sakal) uses Appcelerator Titanium.
I just created a text page in my app and now i want to change language of this page dynamically
to Indian languages like Telugu, Tamil, Bengla, Guujrati and Punjabi.
I researched a lot, and got that there are only 2 methods to achieve this(please correct me if i am going wrong):-
1)Using localization of strings http://developer.android.com/guide/topics/resources/localization.html .
But in it problem is that, if android phone is supportable with these languages then it works
otherwise it show boxes in-place of fonts.
2)Using custom fonts to change language like
TextView tv=(TextView)findViewById(R.id.custom);
Typeface face=Typeface.createFromAsset(getAssets(),"fonts/Verdana.ttf");
tv.setTypeface(face);
But here's the problem is rendering. Fonts are not rendered properly.
Please suggest me, which option should i choose and how to overcome it's limitation.
I also want to mention that I want to support it on Android 2.3 and above.
Prior to Android 3, you need to use an appropriate font plus localisation to display characters from special scripts.
For Android 3+, using localisation most times is sufficient. Exceptions are Arabic, Hebrew, Indic scripts and a few others where you may need an appropriate font in addition to localisation to properly display these special characters in your Android app.
AFAIK, Verdana ONLY supports European Scripts such as Latin-1, Latin Extended-A, Latin Extended-B, Latin Extended Additional, Basic Greek and Cyrillic. Whereas Telugu, Tamil, Bengali, Gujarati are part of the South Asian Scripts - not sure about Punjabi (See Unicode Consortium for more info regarding Unicode scripts.) I guess you need to find an open-source font (so you don't have to pay loyalty when using proprietary fonts) that support the scripts you want to implement in your app.
I have a website specifically for viewing on Android devices, I am using Gujarati languages and i have a big problem rendering the Gujarati Fonts properly, I atleast want a workaround to get the Gujarati fonts Working properly which is by default not supported on any Android versions. And so i did,
The Work around:
- Rooting the phone
- Finding the correct unicode font for Gujarati language
- Replace the existing DroidSansFallback.ttf in System/fonts with the Gujarati Font (with some extra changes in fontsfallback.xml in system/etc folder for ICS)
This Helped me to atlest view Gujarati texts, but not correct rendering.
The Problem:
1) Problem of Half forms, the half form letters are not rendering properly as they are suppose to combine but they dont,
If you refer to this faq on unicode.org, it clearly defines how it should render,I have also used the mentioned "Zero Width Joiner" by using html codes for every letter using [unicodeLookup][7] but it has no effect.
Anyways This problem is not primary as it is improper but still not incorrect.
2) This rendering problem makes the texts print incorrectly, See the two images below, First one is correctly render as visible on PC and second on is a screenshot from Android native browser
image
the problem marked as 1 are fist problem and the one marked as 2 are second problem, if you google "Devanagari - Unicode Consortium ch09" you will get a pdf refering to this problem (just goto "Figure 9-8. Rendering Order in Devanagari") which clearly explains the method to render the scripts correctly. It seems what ever android uses to render the scripts is not supported for such languages, if there is any change that can be made to Android OS to render the fonts in correct order, please help.
This is definitely not a problem with fonts as i have tried using Shruti fonts which is used by windows OS, it is a problem with rendering these complex scripts
Possible Solutions: (unwanted)
1) Using opera mini with bitmap fonts (not my solution)
2) Use Images instead of texts (again not my solution as my site will have 300 lines of lists and that too for mobile, do not want to increase page size)
Please give me a proper solution to this problem, thanks in advance !!
Rendering Gujarati (and other "complex" scripts, i.e. those which use half-forms, contextual forms, rearrangement, etc.) requires more than just fonts; it also needs text layout. Text layout capability is normally supplied by the host operating system or in some cases the application. Android has been improving text layout support, but even the latest version is still not complete for all scripts. In other words: you cannot easily fix this with fonts alone, even for recent versions of Android.
Possible workarounds:
develop some kind of plugin or extension that does correct Gujarati layout and require users to download/install the plugin to use your site. This will likely be a very high-impedance path, requiring a great deal of expertise in fonts, software development, and knowledge of the target writing system. Not to mention the inconvenience for your users.
develop a custom version of a Gujarati font and use corresponding custom text in your site that does not require text layout; supply the font via #font-face (webfont). This will also likely be fairly challenging if you do not have experience with font development, but would probably be the best path.
render the text to images; do browser-sniffing and supply images for cases where the client is known not to support complex scripts. This is likely to fail much of the time (hard to keep track of browser capabilities, not to mention the problem of reliably detecting browsers to begin with). But guaranteed to give the right results.
If you want to view your website in all devices just put webfonts in the your website. web fonts are embedded fonts that you put on your server and with proper css link everybody can view that without installing the fonts on devices.
For other websites not having web fonts use firefox for android and then get addon https://addons.mozilla.org/en-us/android/addon/gujarati-fonts-package. Now you can view all webpages in Gujarati fonts without any complex procedure or root the android.