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.
3. The method of claim 1 , wherein detecting the shaping attribute further comprises detecting if the text contains at least one middle shaped Arabic script character and: responsive to detecting that the text contains at least one middle shaped Arabic script character, setting the shaping attribute to a shaped value; and responsive to detecting that the text does not contain any middle shaped Arabic script character, setting the shaping attribute to a nominal value.