1. A computer-implemented method of detecting a layout of a bi-directional text, comprising using a processor of the computer for: scanning a bi-directional text to detect whether the bi-directional text contains at least one character of a predetermined shape; determining a shaping attribute for the text, responsive to a result of the scanning; using the shaping attribute to determine a text type attribute of the text, the text type attribute indicating how the text is stored; evaluating words of the text, in view of the text type attribute, to determine an orientation attribute of the text, the orientation comprising a left-to-right (“LTR”) value or a right-to-left (“RTL”) value; and associating the determined attributes with the text.
1. A computer-implemented method of detecting a layout of a bi-directional text, comprising using a processor of the computer for: scanning a bi-directional text to detect whether the bi-directional text contains at least one character of a predetermined shape; determining a shaping attribute for the text, responsive to a result of the scanning; using the shaping attribute to determine a text type attribute of the text, the text type attribute indicating how the text is stored; evaluating words of the text, in view of the text type attribute, to determine an orientation attribute of the text, the orientation comprising a left-to-right (“LTR”) value or a right-to-left (“RTL”) value; and associating the determined attributes with the text. 12. The method of claim 1 , wherein the setting the orientation attribute further comprises comparing, responsive to determining that the text type attribute indicates an “as typed” value, a count of Arabic script words in the text to a count of non-Arabic script words in the text, and: if the count of Arabic script words in the text is higher than the count of non-Arabic script words in the text, setting the orientation attribute to the RTL value; if the count of Arabic script words in the text is lower than the count of non-Arabic script words in the text, setting the orientation attribute to the LTR value; and if the count of Arabic script words in the text is equal to the count of non-Arabic script words in the text, setting the orientation attribute based on a bi-directionality of a first character in the text.