support all orientations

top-down, bottom-up, from-left-to-right and from-right-to-left.