Download

How to get text string width?

I am using HUD->AddDebugText() to render some debug messages to the screen (using the default font).
In order to determine the width of these strings I call


float width = 0.0f, height = 0.0f;
HUD->GetTextSize("String", width, height);

However, that always returns 0 as width.
So I tried the following instead:


float width = 0.0f, height = 0.0f;
HUD->GetTextSize("String", width, height, GEngine->GetMediumFont());

But that does again just return 0 as width.
Any ideas what I am doing wrong, or is this a bug?