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: 
rbenditt
Streaming Star

DrawText not working on Roku OS 13

I have an app where I'm drawing bitmaps using the draw2d interface. When my Roku devices were updated to the latest Roku OS 13, calls to the DrawText function no longer produce output. Everything else on the bitmap still looks good, such as DrawLine.

I have another old test device running Roku OS 11 and I can see that the same code still works as expected on it.

Here's some simplified code that illustrates the problem:

m.theBitmap = CreateObject("roBitmap", {width: 200, height: 200, AlphaEnable: true})

font_registry = CreateObject("roFontRegistry")
font = font_registry.GetDefaultFont()

theColor = &hFF0000FF ' Red
'theColor = &hFF000000 ' Red - transparent
'theColor = &h00FF00FF ' Green
'theColor = &h00FF0000 ' Green transparent
i = m.theBitmap.drawText("HELLO", 50, 50 , theColor, font)
m.theBitmap.Finish()


As you can see, I've experimented with different colors to test for a possible bug with transparency, but nothing shows up no matter what color is set.  Hopefully there's a workaround or bug-fix coming so that I don't need to refactor to pure SceneGraph elements.

0 Kudos
7 REPLIES 7
renojim
Community Streaming Expert

Re: DrawText not working on Roku OS 13

I make extensive use of DrawText on bitmaps in my games and you had me worried, but I just tried them and they still seem to work.  @RokuBen mentioned here that Roku OS 13.0 "has a major internal change in how roScreen applications are drawn compared to 12.5".  I had an issue with one of my apps where it worked on 12.5.5, but not 13.0.  It turned out that what I was doing probably should have never worked.

The only difference I see with your code and mine is that I always specify parameters to GetDefaultFont:

 

font = CreateObject("roFontRegistry").GetDefaultFont(28,true,false)

 

I also make use of GetOneLineHeight and GetOneLineWidth to size the bitmap when necessary.

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.
0 Kudos
rbenditt
Streaming Star

Re: DrawText not working on Roku OS 13

Good to know that it's not completely broken then if it still works in your app.  I just tried your line of code to define a font with all the parameters specified and I still get nothing drawn.  It appears that the font is not nil (invalid) because I can see proper results with the GetOneLineHeight and GetOneLineWidth calls.  Just no text ever gets drawn to the bitmap for some reason.

0 Kudos
renojim
Community Streaming Expert

Re: DrawText not working on Roku OS 13

Do you have a complete example you can share?  The one nice thing about not using Scene Graph is that you pretty much only need one BRS file.

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.
rbenditt
Streaming Star

Re: DrawText not working on Roku OS 13

I've constructed a simple example app with hopes of illustrating the problem. Of course, the simple example renders text just fine.

I've tweaked the simple example project to call DrawText prior to a long loop of random line drawing. It all worked up to 36,000 lines then the app just became unresponsive. I don't think this was my problem as I've only been drawing a couple hundred items at most, not many thousand.

I've had some degree of success in my real app by moving the DrawText calls from the beginning of the bitmap creation to after all of the lines are drawn, just prior to the bitmap.finish() call. This certainly feels like a klugey workaround, but it does illustrate that DrawText is working to some degree. The text rendering is still inconsistent, usually working completely but occasionally it misses some of the text on some app launches.

Roku Resource Monitor shows a huge spike to over 22MB in texture memory while drawing the bitmap items, then it seems to settle out at around 7MB. I suspect that my issue has to do with changes in how Roku OS 13 manages texture RAM and it's less tolerant of how my app is doing things. App optimization of my drawing functions is one path forward.

One thing worth pointing out is that my app is very non-standard. It is a SceneGraph app where I'm constructing bitmaps in a taskNode, saving the bitmaps to the file system, then loading them into SceneGraph poster elements.  Combining bitmaps with SceneGraph is probably just looking for trouble, but up until Roku OS 13, it was working pretty well.  I'm getting the feeling that I'd be better off abandoning bitmaps and doing the entire drawing with SceneGraph rectangles instead.

0 Kudos
EnTerr
Roku Guru

Re: DrawText not working on Roku OS 13

try building a MWE (Minimal Working Example) that demonstrates yours issue - the way your app faces it (creating `roBitmap` in RSG task thread) and then email partnersuccess at roku.com with that. It is a good time to report bugs while rOS 13 is fresh 

rbenditt
Streaming Star

Re: DrawText not working on Roku OS 13

Sounds like a good plan.  Thanks guys!

0 Kudos
RokuBen
Community Moderator
Community Moderator

Re: DrawText not working on Roku OS 13

Do you have a published channel showing this problem?  Does it still happen with 13.1.4?

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.