For Windows apps, you can use the Windows API GetTextExtentPoint32 function to measure the text size. Here's a VBScript example. You need to specify the text and the UI object to get font parameters from:
Sub Main
Dim str, obj
str = "Test"
Set obj = Sys.Process("notepad").Window("Notepad").Window("Edit")
Call Log.Message(GetTextWidth(str, obj))
End Sub
' Returns the width, in pixels, of the specified text if it was
' placed in the specified control.
' The function uses the control's current font to measure the text size.
Function GetTextWidth(Str, Control)
Dim dc, size
dc = Win32API.GetDC(Control.Handle)
Set size = Win32API.tagSIZE
Call Win32API.GetTextExtentPoint32(dc, Str, Len(Str), size)
Call Win32API.ReleaseDC(Control.Handle, dc)
GetTextWidth = size.cx
End Function