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
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
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.
Thanks for the info @pkuzmenko and @RokuBen and looking into it. 👍
We’re upgrading Roku Community to bring you a faster, more mobile-friendly experience. You may notice limited functionality or read-only access during this time. Read more here.
Planned Downtime:
Community will be unavailable for up to 24–48 hours during the upgrade window during the week of May 19th and you may notice reduced functionality.
In the meantime, for additional assistance, visit our Support Site.
We're sorry for this disruption — we’re excited to share what’s next!