Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: AJA on Fri 30/01/2004 16:30:21

Title: Bug?: TTF fonts with DrawText
Post by: AJA on Fri 30/01/2004 16:30:21
(http://koti.mbnet.fi/dima/images/scrnshot.png)

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)
Title: Re:Bug?: TTF fonts with DrawText
Post by: a-v-o on Fri 30/01/2004 20:44:02
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?

Title: Re:Bug?: TTF fonts with DrawText
Post by: AJA on Fri 30/01/2004 20:46:52
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.
Title: Re:Bug?: TTF fonts with DrawText
Post by: a-v-o on Fri 30/01/2004 21:02:37
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.
Title: Re:Bug?: TTF fonts with DrawText
Post by: Pumaman on Sat 31/01/2004 14:48:50
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.