1

In my Android app i set the style of my TextView like this:

<TextView
            android:fontFamily="cursive" 
            android:textStyle="normal|bold" 
            ...
/>

For example in Lollipop will work because there is the cursive font by default: see here

Now I'd like to know in which version there isn't the cursive font.

p.s.

cursive font=DancingScript-Regular.ttf

Community
  • 1
  • 1
GMX
  • 950
  • 1
  • 14
  • 29
  • - to add a new font, consider going [here](http://stackoverflow.com/questions/10487976/what-is-the-best-way-of-installing-new-font-to-android-emulator) or [here](http://stackoverflow.com/questions/4154639/is-it-possible-to-change-android-emulator-fonts) or [here](http://stackoverflow.com/questions/4907530/installing-a-new-font-in-android-emulator) – Ahmed I. Elsayed Nov 14 '16 at 12:22
  • Is okay if don't work on emulators, I just want be sure that will work on all physical devices... and so is just an emulators limit. – GMX Nov 14 '16 at 12:24
  • See [this](http://stackoverflow.com/questions/29384114/what-fonts-are-installed-by-default-on-android) – Ahmed I. Elsayed Nov 14 '16 at 12:44
  • Cursive is not included in android by default, You can just add it in your assets folder – Ahmed I. Elsayed Nov 14 '16 at 12:45
  • Yea i can use this solution for the version where there isn't the cursive font but i'd like to know in which version there isn't this font. I updated my answer with more info. – GMX Nov 14 '16 at 13:48
  • Isn't it called `italics`? – xdevs23 Nov 14 '16 at 13:56
  • no... fontFamily="cursive" and the ttf file is called DancingScript-Regular.ttf – GMX Nov 14 '16 at 14:02

2 Answers2

5

It's weird. The cursive font family is officially available starting at API level 16 (Jellybean). However, it uses the DroidSerif font which is not a cursive looking font. By API 21, they move to the DancingScript font which looks far more cursive like.

So, you may be able to use the keyword in API 16-20, but it won't amount to much. From API levels 21+, it should look very much like cursive script.

You can look at the available fonts if you go here:

{ANDROID-SDK-HOME}/platforms/android-{SDK-INT}/data/fonts

The containing system-fonts.xml has all them listed with the corresponding fonts.

DeeV
  • 35,865
  • 9
  • 108
  • 95
0

Actually cursive font family shouldn't be available form android device. Over here you can find perfect explanation what you can set using fontFamily and textStyle.

If you want to use custom fonts I strongly recommend Calligraphy lib.

Community
  • 1
  • 1
chris
  • 53
  • 1
  • 5