Bug?: TTF fonts with DrawText

Started by AJA, Fri 30/01/2004 16:30:21

Previous topic - Next topic

AJA



Have I done something or is this a bug? It seems that AGS doesn't "clean up" the higher characters completely. I noticed this when I was making a demo game for my plugin.

The text is drawn using the DrawText API function. And the TTF font is obviously outlined by AGS. (AGS 2.6 SP1)

a-v-o

CJ changed the screen upate in 2.6. Therefore there is a new function: MarkRegionDirty.
Maybe this function is what you need, or a different hook. Which event hook do you use?


AJA

#2
uh.. postscreendraw...

QuoteMarkRegionDirty: All engine API functions such as DrawText and BlitBitmap call this automatically, so you only need to call it if you manually modify the bitmap surface.

So, I guess that's the problem. The bug is there in that function. Or the DrawText function doesn't call it with the correct parameters (so that it would clean up the whole text)..


-EDIT-

Now it works... GetTextExtent doesn't return the correct height... and the width could also be wrong. I tried calling the MarkRegionDirty function after the DrawText function and when I added 15 to the bottom value, it was perfectly clean.

a-v-o

good, then CJ can fix the GetTextExtent which he propably also uses internally to mark the region dirty. Then you won't need the workaround anymore.

Pumaman

Ick yeah, there's a known problem with GetTextExtent but I hadn't thought about the implications it would have here.

The problem is part of the third party TTF rendering library that AGS uses, that it sometimes returns the wrong height for the text. The amount of error varies from font to font, and for some fonts it returns the correct height; this makes it difficult to work around.

I'm glad you've found a workaround anyway, I'll continue to look into it.

SMF spam blocked by CleanTalk