Android Question Why does Material Icons typeface truncate text?

Widget

Well-Known Member
Licensed User
Longtime User
I am trying to load MaterialIcons typeface from an invisible label in a .bal file so I can dynamically load the Typeface using code. But for some reason the Button text and Label text that is using this typeface is being truncated when displayed in my test app and I can't figure out why.

If you tun my test app and check the Log you'll see the Label.Text and Button.Text are not truncated and is correctly stored in the views as "x Testing" but is being displayed in the Activity as "x T" (truncated). Changing the font size does not solve the problem.

The FontAwesome typeface displays just fine in the same Button and Label views. The problem is with MaterialIcons.

I have included a test app to see if someone can figure out what is going wrong. I have been scratching my head over this problem for a couple of hours and haven't figured it out yet. I'm hoping someone else has better luck.

TIA
 

Attachments

  • MaterialIconTruncatesText.png
    MaterialIconTruncatesText.png
    75.7 KB · Views: 311
  • FontAwesomeWorksFine.png
    FontAwesomeWorksFine.png
    76.1 KB · Views: 244
  • MaterialIconTruncatesText.zip
    10.9 KB · Views: 188

Widget

Well-Known Member
Licensed User
Longtime User
Ok, I solved the problem.

Material Icons can only use uppercase Latin text. When I used "Testing" for the button caption it replaced it with "T ". This may be a problem if I ever want to use lowercase text along with the icon. I may have to resort to converting the Material Icon to a bitmap and merging it with lowercase text. But this should be infrequent because I believe the Android standard is to use uppercase text on buttons. Even so, I'm still not sure why Material Icons didn't include lowercase text because it takes up only 26 locations in their font. :(

FontAwesome can display upper or lower case Latin text so "Testing" shows up just fine. I guess that's why they call it "awesome".

Anyways, I thought I'd let you know what the solution is. I'm sure I won't be the only one to encounter the problem. It will save someone a lot of head scratching I'm sure. o_O
 
Upvote 0
Top