Added util function for text direction.