Support for marathi font - android

In my application i want to use marathi font.I know how to use custom fonts in android.The problem is that when i use "Kruti Dev" it shows in android studio preview emulator even thought i have not set it.But if i try to use "Subak" font i am not getting the desired output.
So please can you tell me how will i be able to use this font.
Custom Font Code
Typeface face=Typeface.createFromAsset(getAssets(),
"fonts/subak.ttf);

There is an issue in Android 5.0 that causes some custom fonts to not render when loaded via the Typeface.createFromAsset() function.
The workaround is to re-encode the font that is not displaying. Upload the font file to http://www.freefontconverter.com/ and convert it to output as a TTF. Place the outputted file back in your assets folder and it should now display correctly on Android.
This issue was fixed in the Android 5.1 release.
Reference:
https://androidbycode.wordpress.com/2015/06/02/help-my-custom-font-does-not-work-on-android-5-0/

Related

Arabic fonts for Android

I am new in android world. I have issue with arabic font on android device they overlap each other . And some of them are unreadable please help where i am wrong or provide some solution for it.
I used Cavorting.otf downloaded from google and worked fine for me. I also increased font size to 25sp so it can be readable easily. I recommend you to increase the font size then try changing different fonts.

Font issue in Corona SDK

I am working on an Android Application on Corona Sdk.
and I am using chinacat font for it.
The Problem is the font is being displayed correctly in simulator,
but when i deploy on device it is displayed in normal font.
I am on Windows 8.1.
Here is my code:
local fontname="chinacat"
texts = display.newText(word, 0, 0, fontname, fontsize)
~Thanks
Using Custom Fonts can be tricky at first, specially regarding what name to use as the font filename as well as inside the code.
Just follow the guide below and you will be fine.
http://www.coronalabs.com/blog/2013/01/16/faq-wednesday-custom-fonts/
Just put it in the root folder of your project. And make sure that the font supports from a-z,A-z,0-9 if the font doesn't support it, your app will use the native font

Custom fonts in Android API below 16?

Im working on my first Android application bigger than one activity.
I've read this:
Android 4.1 adds several more variants of the Roboto font style for a
total of 10 variants, and they're all usable by apps. Your apps now
have access to the full set of both light and condensed variants.
(here: link)
I also read somewhere, that I can use custom TTF font.
Does it mean, that Android API below 4.1 (API 16) cannot support custom fonts?
Do I have to work on API 16 or above? I have 4.0.4 phone for now, I don't want to throw it away yet...
Don't throw away your phone! You certainly can use custom fonts below API level 16.
First add your font (ttf file) to your /assets folder, then do something like:
Typeface typeface = Typeface.createFromAsset(getAssets(), "myfont.ttf");
myTextView.setTypeface(typeface);
http://developer.android.com/reference/android/widget/TextView.html#setTypeface(android.graphics.Typeface)
It has been around since API level 1.
The fonts in your question can be used without having to include any font file - they are not "custom" but built into the platform and available for all to use.

kannada text support on older Android devices

how to show kannada text on older devices.
I have tried with font files but rendering is not correct.
I have tried indic text renderer but I was stuck at
SharedLibrary : libcomplex-script-rendering.so
C:/users/vamsikrishna.g/Downloads/indic-text-renderer-72ba1d4f4f36/obj/local/armeabi/objs/complex-script-rendering/complex-script-rendering.o: In function `Java_org_iisc_mile_indictext_android_EditIndicText_drawIndicText':
C:/users/vamsikrishna.g/Downloads/indic-text-renderer-72ba1d4f4f36/jni/complex-script-rendering.c:136: undefined reference to `hb_ft_font_create'
I was not able to resolve this issue which is experienced by lot of people .
so if any body resolved or has any ideas on rendering kannada text on old Android phones
please help.
Now, far sure it is clear that a TTF file should be present to provide characters and an appropriate libraries (libskia.so or libharfbuzz.so i.e. as an example ) are required to render them correctly.
Replace the firmware of your device with similar Indian region's firmware to render the Kannada font correctly. Other regions' firmware do not render the Kannada fonts correctly. Kannada fonts correctly render on Indian Region's Android version 2.x.
please raise the points if you found this solution feasible,will be thankful to you.
If this is for a particular application:
You need to keep the ttf file in your assests folder and
follow the link...
how to add font in Android Application
this one in for hindi... You can do the same for kannada

How to draw the Glyph on canvas from .ttf file [duplicate]

This question already has answers here:
Extracting glyph-path information from ttf files
(3 answers)
How to use kerning pairs extracted from a TTF file to correctly show glyphs as Path2D in Java?
(2 answers)
Closed 2 years ago.
Android does not support the Urdu Nastaliq font properly (the word is broken up and the exact shape (Nastaliq) of the word is not made).
I have used Typeface for this as
TextView tx=(TextView)this.findViewById(R.id.tt);
tx.setTypeface(Typeface.createFromAsset(getAssets(),"TTF font Path"));
I am able to get the exact formating of the Nastaliq Font in java using the AWT package like
Font font = Font.createFont(Font.TRUETYPE_FONT, new File("Path for ttf file"));
Font dynamicFont32Pt = font.deriveFont (32f);
JLabel textLabel = new JLabel(textMessage);
textLabel.setFont(dynamicFont32Pt);
But Android also does not support the AWT Package Properly (java.awt.Font.createFont() and deriveFont()), So we decided to make a render engine for the .ttf file for Urdu.
Now my question is-
Can we get the urdu Font (properly) rendering in Android without needing a Rendering Engine?
If not, then
How can I read the .ttf file (All tables like 'glyp', 'head') in Android?
How can I draw a TTF font, that is, a vector font that does not require a PNG?
The answer from the Extracting glyph-path information from ttf files question can interest you: basically, it points to the Batik library which has code to parse a TTF file in Java (to transform it to SVG).
You should check my question How to use kerning pairs extracted from a TTF file to correctly show glyphs as Path2D in Java?. Instead of Batik, I recommend using Apache FOP. It is simple and easy to use. The advantage is that you read the font only once and you embed the Glyphs into your app. However, Apache FOP only works for TTF, not for OTF (it is possible too, but I am still working on that). Batik uses Java AWT to render strings. The problem is that your app needs to read the font file each time it runs. In the method I am suggesting you can use an embedded mini vectorized font, or you can use an embedded vectorized string for small texts. The problem of this approach is that widths only work properly in painting time. To be able to use the glyphs you recover from the font file using awt, you need to read the kerning pairs and widths directly from the file to be able to display the text properly. This is explained in the answers to the question. Also check the question How to read kerning pairs table from TTF file in Android?. The advantage of using vectorized glyphs is that your app is independent of font files and operating system.
You can see that I am using this system on Windows, but you can do the same for Android. Fonts are easier to deal with on Windows and most fonts there are TTF. In reality you can develop your vectorized font on Windows and just use the resulting class in Android. That's the beauty of this method. I generate my fonts using println and copying and pasting it in a new class file. I don't even bother in writing a file.

Categories

Resources