A AR_B4X Member Licensed User Aug 9, 2016 #1 Hi, I am trying to use a ttf file in my app. Apart from using it, I would also like the text to be bold. So I have something like this B4X: Dim Minya As Typeface Minya = Typeface.LoadFromAssets("minya.ttf") NameLbl.Initialize("") NameLbl.Text = Name NameLbl.TextColor = Colors.Black NameLbl.Typeface = Typeface.CreateNew(Minya, Typeface.DEFAULT_BOLD) ' Errors out Thank you
Hi, I am trying to use a ttf file in my app. Apart from using it, I would also like the text to be bold. So I have something like this B4X: Dim Minya As Typeface Minya = Typeface.LoadFromAssets("minya.ttf") NameLbl.Initialize("") NameLbl.Text = Name NameLbl.TextColor = Colors.Black NameLbl.Typeface = Typeface.CreateNew(Minya, Typeface.DEFAULT_BOLD) ' Errors out Thank you
A AR_B4X Member Licensed User Aug 10, 2016 #2 Thank you for your response. But is that the only way? What if the bold version of the font is not available? Upvote 0
Thank you for your response. But is that the only way? What if the bold version of the font is not available?
NJDude Expert Licensed User Longtime User Aug 10, 2016 #3 Then it won't be possible, the font must have a bold set. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Aug 10, 2016 #4 Have you tried: B4X: NameLbl.Typeface = Typeface.CreateNew(Minya, Typeface.STYLE_BOLD) Upvote 0
A AR_B4X Member Licensed User Aug 10, 2016 #5 I did try that but it had no impact. Thank you. Upvote 0
asales Expert Licensed User Longtime User Aug 26, 2016 #6 I use this code with libertysans font and works (the font style is changed from default to bold): B4X: Dim FontName As Typeface FontName = Typeface.CreateNew(Typeface.LoadFromAssets("libertysans.ttf"), Typeface.STYLE_BOLD) Label1.Typeface = FontName If don't work with your font, probably the font file doesn't have a bold variant. Upvote 0
I use this code with libertysans font and works (the font style is changed from default to bold): B4X: Dim FontName As Typeface FontName = Typeface.CreateNew(Typeface.LoadFromAssets("libertysans.ttf"), Typeface.STYLE_BOLD) Label1.Typeface = FontName If don't work with your font, probably the font file doesn't have a bold variant.