Smart selection of the closest text object