tufanv Expert Licensed User Longtime User Mar 21, 2018 #1 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
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
Erel B4X founder Staff member Licensed User Longtime User Mar 21, 2018 #2 Why are you loading the same font file more than once? It is never needed. Store it in a global variable and use it whenever you need. Upvote 0
Why are you loading the same font file more than once? It is never needed. Store it in a global variable and use it whenever you need.
Lahksman Active Member Licensed User Longtime User Mar 21, 2018 #3 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
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
tufanv Expert Licensed User Longtime User Mar 21, 2018 #4 Erel said: Why are you loading the same font file more than once? It is never needed. Store it in a global variable and use it whenever you need. Click to expand... yes , why am i doing that ? I don't know. Thanks for your answers. Upvote 0
Erel said: Why are you loading the same font file more than once? It is never needed. Store it in a global variable and use it whenever you need. Click to expand... yes , why am i doing that ? I don't know. Thanks for your answers.