Widget Well-Known Member Licensed User Longtime User Feb 4, 2017 #1 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 75.7 KB · Views: 749 FontAwesomeWorksFine.png 76.1 KB · Views: 674 MaterialIconTruncatesText.zip MaterialIconTruncatesText.zip 10.9 KB · Views: 540
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
Widget Well-Known Member Licensed User Longtime User Feb 4, 2017 #2 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. Upvote 0
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.
Erel B4X founder Staff member Licensed User Longtime User Feb 5, 2017 #3 Check the tips section here: https://www.b4x.com/android/forum/threads/b4x-fontawesome-material-icons-fonts.72908/ Upvote 0
Check the tips section here: https://www.b4x.com/android/forum/threads/b4x-fontawesome-material-icons-fonts.72908/
Widget Well-Known Member Licensed User Longtime User Feb 5, 2017 #4 Erel said: Check the tips section here: https://www.b4x.com/android/forum/threads/b4x-fontawesome-material-icons-fonts.72908/ Click to expand... I saw that thread after I posted. It seems I only read the documentation when all else fails. Upvote 0
Erel said: Check the tips section here: https://www.b4x.com/android/forum/threads/b4x-fontawesome-material-icons-fonts.72908/ Click to expand... I saw that thread after I posted. It seems I only read the documentation when all else fails.