Modified drawing method to draw text into the window