MitchBu Well-Known Member Licensed User Longtime User Nov 2, 2016 #1 I am trying to apply what looks like rather straighforward instructions in Erel's tutorial at https://www.b4x.com/android/forum/threads/custom-fonts.46461/ - I copied the fonts into Files\Special 2. Add the #AppFont attribute for each font file (including the extension): Click to expand... Where should I add this ? B4X: #AppFont: Calebasse.ttf #AppFont: Zz.ttf I tried in Project Attributes, but I get an error "Attribute not supported:appfont" Then this B4X: Label1.Font = Font.CreateNew2("Calebasse", 30) triggers : "Undeclared variable 'font' is used before it was assigned any value" What am I doing wrong ? Last edited: Nov 2, 2016
I am trying to apply what looks like rather straighforward instructions in Erel's tutorial at https://www.b4x.com/android/forum/threads/custom-fonts.46461/ - I copied the fonts into Files\Special 2. Add the #AppFont attribute for each font file (including the extension): Click to expand... Where should I add this ? B4X: #AppFont: Calebasse.ttf #AppFont: Zz.ttf I tried in Project Attributes, but I get an error "Attribute not supported:appfont" Then this B4X: Label1.Font = Font.CreateNew2("Calebasse", 30) triggers : "Undeclared variable 'font' is used before it was assigned any value" What am I doing wrong ?
L LucianDesign Member Licensed User Longtime User Nov 2, 2016 #2 That tutorial is for B4iOS. For Android is different. See this https://www.b4x.com/android/forum/threads/how-to-make-custom-font-bold.69888/#post-446780 B4X: Dim FontName As Typeface FontName = Typeface.CreateNew(Typeface.LoadFromAssets("libertysans.ttf"), Typeface.STYLE_BOLD) Label1.Typeface = FontName Upvote 0
That tutorial is for B4iOS. For Android is different. See this https://www.b4x.com/android/forum/threads/how-to-make-custom-font-bold.69888/#post-446780 B4X: Dim FontName As Typeface FontName = Typeface.CreateNew(Typeface.LoadFromAssets("libertysans.ttf"), Typeface.STYLE_BOLD) Label1.Typeface = FontName
MitchBu Well-Known Member Licensed User Longtime User Nov 2, 2016 #3 Oh gosh. I should have read the title more carefully. Sorry. Thank you LucianDesign Upvote 0