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. 👍