I'm new to GD but can I make a suggestion? Create a function that takes a whole string of characters and then returns the dimensions used up by the string - Width & Height in pixels.
For a fixedsize 8x8 font:
"ace" will give us a dimension of Width = 24 and Height = 6 (lowercase).
"ACE" will give us a dimension of Width = 24 and Height = 8 (uppercase).
GD will then do the calculation natively which will be a big performance boost, rather than making multiple function calls for every character in the a string which will take longer.
Uses for this function for example will allow one to create a destination surface according to the dimensions, blit the string to that surface, then do all sorts of extra effects like scaling and rotation...
Like I said, just a suggestion - use it don't use it.
[EDIT - a few minute later]
I see that CGapiSurface::DrawText has support for GDDRAWTEXT_CALCWIDTH, but doesn't have a GDDRAWTEXT_CALCHEIGHT, which would be a nice to have. But CGapiSurface::RenderSystemFont does not have the same ability.