1. A computer-implemented method of converting a source layout of a bi-directional text to a target layout of a bi-directional text, comprising using a processor of the computer for: detecting a shaping attribute of said text based on scanning said text to detect at least one character of a specific shape; detecting a text type attribute of said text from said shaping attribute; detecting an orientation attribute of said text from the detected text type attribute; detecting a swapping attribute of said text, using the detected text type attribute and the detected orientation attribute; and converting the source layout to the target layout, based on the detected attributes.