Corrected text positioning and added getTextWidth and getTextHeight methods.