I don't know what to make of this other than there appears to be a bug in the Roku 2 firmware. It's pretty hard to explain, so I'm just going to give the code to reproduce it.
Function BuildText(text as String) as Object
color = &heba0dfff
font = CreateObject("roFontRegistry").GetDefaultFont(20,true,false)
width = font.GetOneLineWidth(text,640)
height = font.GetOneLineHeight()
bm = CreateObject("roBitmap",{width:width,height:height,AlphaEnable:true})
bm.DrawText(text,0,0,color,font)
REM bm2 = CreateObject("roBitmap",{width:width,height:height,AlphaEnable:true})
REM bm2.DrawScaledObject(0,0,1,1,bm)
return bm
End Function
Sub RunUserInterface()
screen=CreateObject("roScreen")
screen.SetAlphaEnable(true)
screen.Clear(&hFF)
screen.Finish()
compositor=CreateObject("roCompositor")
compositor.SetDrawTo(screen, &hFF)
bm = BuildText("This is some text")
bmRgn = CreateObject("roRegion",bm,0,0,bm.GetWidth(),bm.GetHeight())
sprite = compositor.NewSprite(100,100,bmRgn)
compositor.Draw()
screen.Finish()
sleep(5000)
print "exiting"
End Sub
Run this on a Roku 1 and it works as expected. On a Roku 2, all I get are blocks of color where the characters should be. However, it gets more interesting. If the REMs are removed on the two lines and
either bm or bm2 is returned the string is displayed properly. And, to add to the confusion, if the BuildText function is included inline the text is displayed properly with or without the two bm2 lines.
Another interesting Roku 2 issue I've noticed is that DrawText is about 10 times faster on a Roku 1. I thought the Roku 2 was supposed to be faster? :?
I should point out that I'm on beta firmware, so maybe that's the issue. I don't have any way to test this on the release firmware.
-JT
Roku Community Streaming Expert
Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.
I am not a Roku employee.