Sunil Sunny
Sunil Sunny

Reputation: 3994

Custom Fonts not working in lollipop?

I have developed a handwriting app .And one of the main feature of this is that we can change the fonts from default font to 4 other custom fonts ie, to

Vicmorg (Vic Modern Cursive)
Cursive Writing 7
Dnealiancursive
Print-Regular

And this is working fine in all devices.Yesterday I updated my nexus 10 to lollipop .Now the fonts are not taken correctly, vicmorg.ttf and Dnealiancursive.ttf are now not working but Print-Regular and Cursive Writing 7 are working .No issues in other phones though. Is there a fix for this ? Please help.

Upvotes: 11

Views: 15198

Answers (3)

Hiren Patel
Hiren Patel

Reputation: 52800

I did it in following way:

I have updated TextView with androidx.appcompat.widget.AppCompatTextViewand it works for each device.

Example

From

 <TextView

To

 <androidx.appcompat.widget.AppCompatTextView

Hope it helps you.

Upvotes: 4

Alex Zaraos
Alex Zaraos

Reputation: 6553

Error on lollipoop

test files .otf run correctly but .ttf not. my solution for files .ttf was convert to .otf

http://www.files-conversion.com/font-converter.php

or

http://www.font2web.com/

for custom font for example, inside assets folder (../assets/fonts/birdman-webfont.otf):

Typeface birdman = Typeface.createFromAsset(getAssets(), "fonts/birdman-webfont.ttf");
TextView text= (TextView) findViewById(R.id.text);
text.setTypeface(birdman);

note: if your file is .ttf and show ERROR in the convertion, change the extension to .otf manually and convert with http://www.files-conversion.com/font-converter.php

Upvotes: 1

AstonCheah
AstonCheah

Reputation: 246

re-convert your whatever fonts to .ttf from this link works for me.

http://www.freefontconverter.com/

Upvotes: 22

Related Questions