We used to find the rectangle which fits the given text, for example if give \"TESTING\" in gettextbounds api it will give a rectangle that fits the given string \"TESTING\"
Here's a way that works for me: use Paint.measureText(text) to get text's width and Paint.getTextBounds(text, 0, text.length(), bounds) to get text's height (height = bounds.height())