General Board

  • Recommend useful replies to give out SEEDs and raise your level as well.
  • You can select the most useful reply as the Best Answer for your thread.
  • Share topics you want to discuss on Facebook or Twitter and earn SEEDs!
  • Share your knowledge by posting in threads that interest you.
Subscription preference

Notification emails are sent to your Samsung account email address.

* Email : anonymous@samsung.com

  

Close

Typeface.ITALIC not working on Galaxy Note 2

Forums View
Started by Newbie serandel , 0 Seed Nov 28, 2012 13:59 Posts : 3 View : 8877 Likes : 0
 I'm making an app where sometimes I want to change the font of a textview to italics, depending on the data to show.

On my Galaxy Nexus, it's simply a case of

textView.setTypeface(font, iWantItalics ? Typeface.ITALIC : Typeface.NORMAL);

and it works beautifully.

The problem is that I've got a new Galaxy Note II to test and... nope, no italics.

Reading Samsung devices supporting setTypeface(Typeface.Italic)? I get the impression that it's a bug on the Note's Android build, so the Roboto font simply has no italics. I've tried every advice on that thread and others similar (Typeface.defaultFromStyle(Typeface.ITALIC),Typeface.create(null, Typeface.ITALIC), etc.) with no luck.

My problem is that the workaround the guy from that thread used was copying the Roboto TTF in theassets directory and creating the font from there but what about people with _another_ default font in their phones? I don't want to force Roboto on them or, even worse, to have that other font when the typeface is normal and Roboto italics otherwise.

Has anybody an idea for me? Thanks.

Tags

android , font , italics , galaxynote

Post Reply
Board View
Newbie z.pazderski , 0 Seed Nov 28, 2012 14:25 Post #1 0
Hmm, there doesn't seem to be a TextView.setTypeface(Font, int) method, only a setTypeface(Typeface, int).
Anyway, have you tried calling setTypeface(null, Typeface.ITALIC)?
And yes, some fonts simply don't have italics, so the italic look must be faked by the OS, for which the above method is for. Unless it doesn't work, of course, in which case we would have to dig a little deeper.


Regards,
Ziemowit Pazderski
Samsung Developers


This content has been quoted from serandel@’s thought. (Link to original post)

 I'm making an app where sometimes I want to change the font of a textview to italics, depending on the data to show.

On my Galaxy Nexus, it's simply a case of

textView.setTypeface(font, iWantItalics ? Typeface.ITALIC : Typeface.NORMAL);

and it works beautifully.

The problem is that I've got a new Galaxy Note II to test and... nope, no italics.

Reading Samsung devices supporting setTypeface(Typeface.Italic)? I get the impression that it's a bug on the Note's Android build, so the Roboto font simply has no italics. I've tried every advice on that thread and others similar (Typeface.defaultFromStyle(Typeface.ITALIC),Typeface.create(null, Typeface.ITALIC), etc.) with no luck.

My problem is that the workaround the guy from that thread used was copying the Roboto TTF in theassets directory and creating the font from there but what about people with _another_ default font in their phones? I don't want to force Roboto on them or, even worse, to have that other font when the typeface is normal and Roboto italics otherwise.

Has anybody an idea for me? Thanks.

 

 
Post Reply
Board View
Newbie serandel , 0 Seed Nov 30, 2012 13:57 Post #2 0
The variable 'font' was, effectively,  a Typeface. Nevertheless, since I stored there the system default font, I've refactored my code so now I use 

textView.setTypeface(null, iWantItalics ? Typeface.ITALIC : Typeface.NORMAL);

But it's the same: it works OK in the Galaxy Nexus and doesn't work in the Note II.

I understand that, as you say, the OS should fake the italics. But, even then, I find difficult to believe that it should be necessary when we are using Roboto, the Android default font, so I suspect is a bug in the OS build used in these devices.

Thanks!

Post Reply
Board View
Newbie z.pazderski , 0 Seed Dec 03, 2012 11:39 Post #3 0
Thank you for this find, I'll forward it to people responsible for fixing such issues.

Regards,
Ziemowit Pazderski
Samsung Developers

This content has been quoted from serandel@’s thought. (Link to original post)

The variable 'font' was, effectively,  a Typeface. Nevertheless, since I stored there the system default font, I've refactored my code so now I use 

textView.setTypeface(null, iWantItalics ? Typeface.ITALIC : Typeface.NORMAL);

But it's the same: it works OK in the Galaxy Nexus and doesn't work in the Note II.

I understand that, as you say, the OS should fake the italics. But, even then, I find difficult to believe that it should be necessary when we are using Roboto, the Android default font, so I suspect is a bug in the OS build used in these devices.

Thanks!

 

 
Post Reply