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: 
downinit
Channel Surfer

Bug? roFontRegistry.Register("bad/path/nofile.ttf") returns true, even if fonts not registered

Is this a bug for anyone else?

 

reg = CreateObject("roFontRegistry")
ok = reg.Register("pkg:/bad-path/or-no-font.ttf")
if ok
    ?"Always true, despite:"
    ?" - not registering fonts (no file or corrupted file)"
    ?" - bad paths"
    ?"Font count: ";reg.GetFamilies().Count()
endif

 

 
Roku OS: 11.5.0 build 4312-C2
 
0 Kudos
3 REPLIES 3
pkuzmenko
Binge Watcher

Re: Bug? roFontRegistry.Register("bad/path/nofile.ttf") returns true, even if fonts not re

The font object will be create latter, I guess that roFontRegistry just hold file name and do nothing till you ask the registry to create a roFont object.

Have a look how I do create the fonts in my game engine:

 

 

 

m.fontRegistry = {}
            for each font in collection.fonts
                uri = "pkg:/"+font.filename
                if m.fontRegistry[uri] = invalid then
                    m.fontRegistry[uri] = CreateObject("roFontRegistry")
                    m.fontRegistry[uri].Register(uri)
                end if
                rokuFont = m.fontRegistry[uri].GetFont(m.fontRegistry[uri].GetFamilies()[0],font.fontSize, false, false)
                m.fonts[font.name] = { 
                    font: rokuFont,
                    spacing: font.spacing
                }
            end for

 

 

 

RokuBen
Community Moderator
Community Moderator

Re: Bug? roFontRegistry.Register("bad/path/nofile.ttf") returns true, even if fonts not re

Yes, I just checked the code and the error reporting for bad filenames was lost during a refactor.  If you register an invalid file, it will just have no effect on the set of fonts available.  I'll file an internal bug to fix this in a future OS release.

downinit
Channel Surfer

Re: Bug? roFontRegistry.Register("bad/path/nofile.ttf") returns true, even if fonts not re

Thanks for the info @pkuzmenko and @RokuBen and looking into it. 👍

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.