Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Font asset not found as file until "forced refresh" of sorts
Started by thomas6 Mar 15 2017 12:25 AM

4 replies to this topic
font asset refresh live build found
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

thomas6

[GLOBAL: userInfoPane.html]
thomas6
  • Contributor

  • 713 posts
  • Corona SDK

Hi!

 

Had a weird issue yesterday. A (custom) font file was not found when referring to it by font family name. It worked fine in a normal build so I couldn't see what the problem was. Tried referring to the specific font filename instead in one of my text objects and it worked right away.

 

Then I changed the code back to the old version (which didn't work at first with a live build), and now the same code did work. So somehow changing the font family name to the literal file name "unlocked", changed or fixed something permanently that was wrong before.

 

Does anyone have this as well? It might be important because it could be broader than just font assets and is too erratic for decent debugging and developing.



[TOPIC: post.html]
#2

vlads

[GLOBAL: userInfoPane.html]
vlads
  • Contributor

  • 291 posts
  • Corona Staff

Thanks for reporting this. This is known issue with Live Builds. To make fonts available by face names one would have to rebuild the app, since this is made through entries in plist we can't change on device. I'd recommend just using file names instead. Sorry for inconvenience. It actually is only about fonts and when you're using them with face names.



[TOPIC: post.html]
#3

thomas6

[GLOBAL: userInfoPane.html]
thomas6
  • Contributor

  • 713 posts
  • Corona SDK

Hi Vlads,

 

I'm not really following, for two reasons.

1) The font name is in the build settings of the live build. Don't these builds use the plist table from build settings.

2) Most importantly: how come it started to work by using the literal filename once, and after that kept on working when going back to the previously not-working code? And if this is a fix, can't this be implemented somehow?

 

I would switch method normally, but since the literal font filename options is slower when using many text objects it's not a good path to pursue, I think.



[TOPIC: post.html]
#4

vlads

[GLOBAL: userInfoPane.html]
vlads
  • Contributor

  • 291 posts
  • Corona Staff

System preloads fonts if they're in plist. Basically we learn that "Custom Font" lives int "custom_font.ttf".

When using live builds, there isn't a way to make system preload it, since live built app behaves differently than normal app - it doesn't really have all it's resources in place, it copies them on first launch to a place where it can synchronize them.

 

Once you user your font as "custom_font.ttf", it is loaded to application's font cache, so system learns about "Custom Font", and that it is in memory now. So when you're using it next time, system already knows about it.

 

Please, use filename for font, it would work reliably both in Live Builds and ordinary builds on all platforms. This is a minor bug, but it has easy workaround, so it is far in a backlog.

 

Sorry about this.

I hope you're enjoying live builds otherwise.



[TOPIC: post.html]
#5

thomas6

[GLOBAL: userInfoPane.html]
thomas6
  • Contributor

  • 713 posts
  • Corona SDK

Hi Vlads,

 

Thanks for the very quick response and explanation. I am very much enjoying live builds - extremely cool feature!




[topic_controls]
[/topic_controls]