B4J Question Loading Font Lag

tufanv

Expert
Licensed User
Longtime User
Hello,

With the start of the app I need to add around 300 label to a scrollview which all have to load a custom font. I use:

Code: Copy
for i=0 to 300
price(i).Font=fx.LoadFont(File.DirAssets,"twnb.ttf",14)
next

this makes a lag around 5 seconds on startup. What is the best way to load font for multiple files on startup. ( I need them on startup as I load the values of them from the server on startup )

Thanks
 
I don't know if it would make much differrence but you could try:
Code: Copy
Dim f As Font
f = fx.LoadFont(File.DirAssets,"twnb.ttf",14)
For i=0 To 300
    price(i).Font=f
Next

EDIT: as usual Erel was faster :)
 
Upvote 0
Back
Top