Somewhat crude (and a bit lengthy, perhaps) function that returns the size of the text inside a given object (if said object has text).
There does already exist a GetTextWidth function (source/scripting/ScriptFunctions.cpp:L943). This uses FontMetrics. However, FontMetrics does not take into account text wrapping, line breaks, new lines, or font changes midway through the text it's fed. (Hence why this does not use a similar approach or, indeed, is in the same file.)
I don't know how useful it is to return left, right, top, or bottom values,
but they're included for consistency with the returned parameters of the getComputedSize function.
As I've said before, I'm something of a newbie when it comes to c++, so if I've done something weird, inefficient, or just plain wrong, tell me gently 😁
Depends on D836
Written for eventual use with D297, but not (currently) required by it.