graphics->drawText not drawing on a pushed bitmap beyond screen bounds in 1.12.0

Hello! I've just updated to 1.12.0 and I'm running into a bad issue with drawText in the C API. I have a bitmap containing multiple screens worth of data that I draw into once and scroll as an audio sequence advances. This is mostly text data with some lines drawn for borders.

In 1.11.1, this works fine. This is about halfway scrolled through the bitmap.

However, in 1.12.0, this is what I see:

I hacked something silly by seeing if I can draw a circle and some text to see if there is a difference there:

Sure enough, the circle renders, but the text does not.

However, if I set the text rendering to SCREEN_HEIGHT - 1, it renders:

I can only assume that there is some sort of clipping occurring trying to optimize when text would normally be rendered offscreen, but this after I have pushed the context into the bitmap so I do want to draw it beyond normal screenbounds.

Is there another way to solve this?

Thanks!

2 Likes

I screwed up. I added an "optimization" without thinking it through. :frowning:

I'll revert this and try and get it in the 1.12.1 update

1 Like

Thanks! You probably know already, but surprisingly it happens on the device even if I compile the project with the earlier SDK.

The fix probably won't make it into 1.12.1 since the update's already through the pipeline, so I found a workaround: instead of font:drawText(...) do:

gfx:setFont(font)
gfx.drawText(...)

The difference is it uses the "styled" text drawing function where _ toggles italics and * toggles bold. The styled version doesn't have the dumb broken bounds check.. :sweat_smile:

Is this something I can access within the C API? The only drawText function I appear to have access to is the one in the graphics library, which is the one I've been using already.

@dave : has this fix made it into the latest version of the API yet? I'm on 1.12.3, and I think I've just run into the same bug. I'm also using the C API so don't have access to your workaround (unless you can access that styled-text drawing function directly from C?).

Ah, boo. I submitted the fix for that in June but it looks like it didn't get merged to main until a week ago. :frowning: It'll be in 1.13. Sorry for the hassle.

And nope, the C API can only call the buggy text drawing variant since we haven't implemented font families there. Been waiting to see if anyone requests it..

2 Likes