Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
TabloCraig
Visitor

roFontRegistry.getDefaultFont() returns invalid, sometimes

In our text label utility, we have the following:

fontRegistry = createObject("roFontRegistry")
font = fontRegistry.getDefaultFont()
assert(font <> invalid, "roFontRegistry.getDefaultFont() should return a font")


This assertion fails from time to time in production (according to the crash reporter found in the Roku Developer backend), but we have never witnessed it in our own testing.

One small item to note is this code is only encountered once, since the returned font is stored in the globalAA for future reference. Is there something that causes `getDefaultFont()` to return invalid under certain circumstances? We have a tight grip on bitmap memory usage and are confident that there is plenty available before this block of code is executed.
0 Kudos
3 REPLIES 3
rymawby
Binge Watcher

Re: roFontRegistry.getDefaultFont() returns invalid, sometimes

Hi TabloCraig,

According to the docs getDefaultFont should always return the system font without fail.

You mentioned you usage of getGlobalAA (which acts differently in SG apps to SDK1 apps) can you elaborate a bit further around this? Is the code above exactly what gets run?
 
0 Kudos
TabloCraig
Visitor

Re: roFontRegistry.getDefaultFont() returns invalid, sometimes

We store the returned font in the global AA, after that block of code is executed once. I think that is a red herring and shouldn't have mentioned it.

The channel does not use SG other than for the player.

The block of code is a copy-paste from the file; the only thing I changed was the indentation. I believe there is either a bug with roFontRegistry, or we are doing something to cause a problem with it, though I can't be sure of what it would be.
0 Kudos
TabloCraig
Visitor

Re: roFontRegistry.getDefaultFont() returns invalid, sometimes

Any thoughts on this? Was hoping to hear from the Roku team.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.