walterf25 Expert Licensed User Longtime User Jan 19, 2020 #1 Hi all, i am trying to use this class in a B4i project, i just downloaded the class and the B4A Example, everything works as expected in the B4A example, but i get an error when trying to compile, and it has to do with the Font file being used, Erel is using a font file named Crystal.ttf which he mentions needs to be copied to the /Special folder inside the Files folder. I have copied that file and I have also added the following to the main Module Code: Copy #AppFont: Crysta.ttf But the project is still not compiling and telling me the error is at this line in the Gauge.bas class. Code: Copy #else if B4i NativeFont = Font.CreateNew2("Crysta", 20) #End If Any ideas why this fails, the Crysta.ttf file has been copied to the Special folder and the #AppFont attribute has been added to the Main Module. Walter
Hi all, i am trying to use this class in a B4i project, i just downloaded the class and the B4A Example, everything works as expected in the B4A example, but i get an error when trying to compile, and it has to do with the Font file being used, Erel is using a font file named Crystal.ttf which he mentions needs to be copied to the /Special folder inside the Files folder. I have copied that file and I have also added the following to the main Module Code: Copy #AppFont: Crysta.ttf But the project is still not compiling and telling me the error is at this line in the Gauge.bas class. Code: Copy #else if B4i NativeFont = Font.CreateNew2("Crysta", 20) #End If Any ideas why this fails, the Crysta.ttf file has been copied to the Special folder and the #AppFont attribute has been added to the Main Module. Walter
Erel B4X founder Staff member Licensed User Longtime User Jan 19, 2020 #2 Please post the error message. Upvote 0
S sorex Expert Licensed User Longtime User Jan 19, 2020 #3 I'm doing it like this Main .B4i module B4X: Copy #AppFont: gamefont.ttf The rest is main or class B4X: Copy Dim gameFont As B4XFont B4X: Copy #If B4A gameFont=xui.CreateFont(Typeface.LoadFromAssets("gamefont.ttf"), 16) #else gameFont=xui.CreateFont(Font.CreateNew2("gamefont", 30), 16) #end if if it still doesn't work (no error but not visible on label) then the problem might be the naming inside the font file. when you open the file in windows it will tell you what name it uses. It could be "Crysta normal" or something. the app will load the font without problems but you reference to it with the wrong font name. Last edited: Jan 19, 2020 Upvote 0
I'm doing it like this Main .B4i module B4X: Copy #AppFont: gamefont.ttf The rest is main or class B4X: Copy Dim gameFont As B4XFont B4X: Copy #If B4A gameFont=xui.CreateFont(Typeface.LoadFromAssets("gamefont.ttf"), 16) #else gameFont=xui.CreateFont(Font.CreateNew2("gamefont", 30), 16) #end if if it still doesn't work (no error but not visible on label) then the problem might be the naming inside the font file. when you open the file in windows it will tell you what name it uses. It could be "Crysta normal" or something. the app will load the font without problems but you reference to it with the wrong font name.