Abstract:
A method and apparatus for displaying bi-directional text using a browser program on a computer ( 20 ) coupled to drive a display ( 22 ) and having an operating system such that the computer normally writes text to the display in a default language in a first, default direction. The computer opens a window ( 44 ) on the display and receives a string of codes, each code corresponding to a character in a passage of text ( 54 ), at least a portion of which is in a non-default language that is written in a second direction, opposite to the default direction. The computer displays the characters corresponding to the codes in the window such that the passage of text is displayed with all portions thereof arranged in respectively-appropriate directions, substantially without reference to language support provided by the operating system or browser.

Description:
CROSS-REFERENCE TO RELATED APPLICATION 
   This application is a continuation of pending U.S. application Ser. No. 09/444,683, filed Nov. 22, 1999, now abandoned which is incorporated by reference herein. 

   FIELD OF THE INVENTION 
   The present invention relates generally to multiple language support in computer systems, and specifically to bi-directional language support over computer networks. 
   BACKGROUND OF THE INVENTION 
   In most computer network systems, including particularly the World-Wide Web and other forms of communication over the Internet, text is conveyed using the Latin alphabet or variants thereof. The systems are designed to support writing and reading from left to right. Similarly, common computer operating systems, such as the standard Microsoft Windows system, are designed for left-to-right text operation. 
   Variants of standard operating systems and Web software have been developed to afford bi-directional support and fonts for languages such as Arabic, Hebrew and Japanese. For example, special Windows operating systems are offered with National Language Support (NLS), which typically allows a user to switch back and forth between English and foreign language fonts and between left-to-right (LTR) and right-to-left (RTL) text operation. Some Web browsers also offer NLS. Computers sold with NLS operating systems generally have keyboards on which both the Latin and appropriate foreign language characters are printed. NLS must be pre-installed on the user&#39;s computer, and does not offer a solution to a user who wishes to read a foreign-language document or access a Web site without having the particular language support on his or her computer. 
   Two types of fonts are used for transmission and display of RTL text on the Web: logical fonts and visual fonts, which are also known as Web fonts. Logical fonts are used on bi-directional language support and font styles already present in the user&#39;s NLS operating system and/or browser. They can thus operate only in a NLS environment and are written to the computer display from right to left. Visual fonts also require that the font characters be installed on the user&#39;s computer, but do not require the computer to have NLS. Instead, special Hypertext Mark-up Language (HTML) code is used to select the foreign language characters and to write them to the computer display in RTL order, even though the letters must be entered in LTR order on the HTML page itself. If the user&#39;s computer has neither logical nor visual font support installed, the only way to transmit and display foreign language text is in graphic form, which is slow and inconvenient. 
   Thus, a user who wishes to view a Web page with Hebrew language text, for example, will generally be unable to do so unless the appropriate type of Hebrew language support has been installed on his or her computer. Furthermore, even if the user has Hebrew NLS installed, Hebrew Web texts will frequently be displayed in LTR order, rather than the appropriate RTL, because the user&#39;s browser is attempting to read a visual font as a logical font, or vice versa. 
   On-screen keyboards have been developed for users who wish to enter Hebrew characters from a computer that does not have Hebrew NLS. Such a keyboard is available, for example, at the “Snunit” Web site of the Hebrew University of Jerusalem (www.snunit.k12.il). A user selects characters from the keyboard by means of mouse clicks and can thus generate a line of text in web font form. 
   SUMMARY OF THE INVENTION 
   It is an object of the present invention to provide improved methods and devices for bi-directional computer language support. In some aspects of the present invention, the bi-directional support is used for transmitting and displaying RTL language texts over a network, particularly the Internet. 
   It is a further object of some aspects of the present invention to provide improved methods and devices for bi-directional entry of text into a computer, without requiring that the computer have the appropriate national language support. 
   It is yet a further object of some aspects of the present invention to provide improved methods and devices that enable a user to view a Web page including RTL national language text, without the necessity of installing national language support on the user&#39;s computer. 
   It is still a further object of some aspects of the present invention to provide methods and devices that enable a user to conveniently correct the direction of text flow displayed on a Web page, for example, when text in a RTL language is displayed from left to right due to confusion of logical and visual fonts. 
   In preferred embodiments of the present invention, a utility program enables a user of a computer to write and/or read bi-directional texts to and/or from the World Wide Web, typically including non-Latin characters in a selected RTL language. The program works regardless of whether there is an operating system or Web browser running on the computer that provides bi-directional language support. Preferably, the program comprises an applet written in the Java language, which is accessed by the user&#39;s Web browser program. Alternatively, the program may comprise an application program, preferably a Java application, which is downloaded to the user&#39;s computer. The program thus provides bi-directional support, for both logical and visual fonts in substantially any desired languages, without the necessity of installing a special operating system, browser or Web font support. 
   To enter bi-directional text into the computer, the user selects the appropriate text direction and character set, most preferably using controls and a model keyboard that the applet causes to be displayed on the user&#39;s computer screen. Preferably, the user is able to freely intersperse LTR text in a Latin alphabet and RTL text in the selected non-Latin alphabet. The applet causes text characters entered by the user to be displayed in the appropriate language and in the appropriate direction (LTR or RTL), as selected by the user. After the user has finished entering a passage of text, the passage is transmitted over the Web, most preferably as a standard coded character stream, using ASCII or ISO-standard codes. 
   A computer receiving the text sent by the user decodes the character stream to reconstruct the text as it was entered by the user. In a preferred embodiment, the receiving computer is used to view a Web page including the bi-directional text passage. Such a display may be achieved by means of any suitable operating system or browser having the necessary NLS or bi-directional capability, as is known in the art. Alternatively, an applet running on the viewing computer, preferably identical to the applet that was used to enter the text, is used to decode and display the text on the Web page. Most preferably, the applet is posted for downloading to the viewing computer along with the HTML code of the Web page. 
   In some preferred embodiments of the present invention, the applet running on the viewing computer generates a bi-directional window on the computer screen, in which all the characters, both Latin and in the selected non-Latin alphabet, are displayed using the appropriate alphabets and in the proper (LTR or RTL) order. The applet performs this function independently of whether the browser and operating system of the viewing computer have or do not have the appropriate bi-directional language support. As described hereinabove, when a Web page including text in a non-supported language is shown on the computer screen, the non-Latin portion of the text passage will normally appear on the screen as nonsense characters. A user of the viewing computer preferably drags and sizes the window generated by the applet, using a pointing device such as a mouse, for example, so that the window covers the text passage. Alternatively, the viewer cuts and pastes the text passage into the window. In either case, the applet reads the codes of the characters in the window and restores the characters to their appropriate form and order (RTL or LTR). 
   Preferably, the window includes an on-screen direction switch, so that the user can reverse the direction of display of RTL characters shown in the window. The switch allows the user to correct instantly for reversal of RTL character order between logical and visual fonts. 
   There is therefore provided, in accordance with a preferred embodiment of the present invention, a method for displaying bi-directional text using a browser program on a computer coupled to drive a display and having an operating system such that the computer normally writes text to the display in a default language in a first, default direction, the method including: 
   opening a window on the display; 
   receiving a string of codes, each code corresponding to a character in a passage of text, at least a portion of which is in a non-default language that is written in a second direction, opposite to the default direction; and 
   displaying the characters corresponding to the codes in the window such that the passage of text is displayed with all portions thereof arranged in respectively appropriate directions, substantially without reference to language support provided by the operating system or browser. 
   Preferably, receiving the string of codes includes receiving an input keyed by a user of the computer and generating the string of codes responsive to the input. Most preferably, receiving the input includes displaying a keyboard in the non-default language on the computer display and receiving an input from the user responsive to the displayed keyboard, wherein displaying the keyboard includes varying the language of the keyboard display responsive to a selection by the user. 
   Further preferably, generating the string of codes includes writing codes to the string corresponding to the portion of the passage in the non-default language in a reverse order, such that the characters in the non-default language are displayed in proper order in the second direction. 
   In a preferred embodiment, the method includes transmitting the string of codes over a network. 
   Preferably, receiving the string of codes includes reading codes of characters located in an area of the display overlain by the window, wherein opening the window includes adjusting coordinates of the window so as to contain characters on the display corresponding to the string. Alternatively, receiving the string of codes includes cutting and pasting characters on the display corresponding to the string so as to be contained the window. 
   Preferably, displaying the characters includes translating the codes of the characters on the display so that they appear in the window in an alphabet of the non-default language. Further preferably, translating the codes of the characters includes reversing an order of the converted characters so that they appear in their correct order in the non-default language, wherein reversing the order of the characters includes reversing an order of at least some of the characters in the window responsive to an order switch invoked by a user of the computer. 
   There is further provided, in accordance with a preferred embodiment of the present invention, a method for displaying bi-directional text using a computer coupled to drive a display and capable of writing text to the display in a first, default language, normally written in a first direction, and in a second language, normally written in a second direction opposite to the first direction, the method including: 
   opening a window on the display; 
   receiving a string of codes, each code corresponding to a character in a passage of text, at least a portion of which passage is in the second language; 
   displaying the characters corresponding to the codes in the window; and 
   reversing the order of at least some of the displayed characters, responsive to an order switch invoked by a user of the computer, so that the portion of the passage in the second language is displayed with the characters properly ordered in the second direction. 
   Preferably, reversing the order of the characters includes displaying a switch control on the computer display, which control is selected by the user to invoke the order switch. 
   Preferably, in the methods described hereinabove, the first direction is left-to-right, and the second direction is right-to-left. 
   In a preferred embodiment, receiving the string of codes includes receiving the codes via a network. Preferably, receiving the string of codes includes receiving codes corresponding to a logical font. Alternatively, receiving the string of codes includes receiving codes corresponding to a visual font. Preferably, the network includes the World Wide Web, and displaying the characters includes applying an applet to process the codes. 
   There is also provided, in accordance with a preferred embodiment of the present invention, apparatus for displaying bi-directional text, including: 
   a display screen; and 
   a computer running an operating system and a browser program and coupled to drive the display such that text is normally written to the display in a default language in a first, default direction, 
   wherein the computer receives a string of codes, each code corresponding to a character in a passage of text, at least a portion of which is in a non-default language that is written in a second direction, opposite to the default direction, and causes the characters corresponding to the codes to be displayed in a window on the screen such that the passage of text is displayed with all portions thereof arranged in respectively appropriate directions, substantially without reference to language support provided by the operating system or browser. 
   Preferably, the apparatus includes a user input device, wherein the string of codes includes an input keyed by a user of the computer operating the input device, and wherein the computer transmits the string of codes over a network. 
   In a preferred embodiment, responsive to an input by a user, the computer overlays the window on an area of the display screen in which the characters are displayed, receives the string of codes corresponding to the characters in the area, and processes the codes so as to display the characters in their appropriate languages. Preferably, the computer reverses the order of the displayed characters in the portion of the text that is in the non-default language. 
   There is moreover provided, in accordance with a preferred embodiment of the present invention, apparatus for displaying bi-directional text, including: 
   a display screen; and 
   a computer coupled to drive the display and capable of writing text to the display in a first, default language, normally written in a first direction, and a second language, normally written in a second direction opposite to the first direction, 
   wherein the computer receives a string of codes, each code corresponding to a character in a passage of text at least a portion of which is in the second language, causes the characters corresponding to the codes to be displayed in a window on the screen, and reverses the order of at least some of the displayed characters, responsive to an order switch invoked by a user of the computer, so that the portion of the passage in the second language is displayed with the characters properly ordered in the second direction. 
   Preferably, the computer processes the codes by means of an applet. 
   There is additionally provided, in accordance with a preferred embodiment of the present invention, a computer program product, having computer readable program instructions embodied therein, which instructions cause a computer coupled to drive a display and having an operating system such that the computer normally writes text to the display in a default language in a first, default direction, to receive a string of codes, each code corresponding to a character in a passage of text, at least a portion of which is in a non-default language that is written in a second direction, opposite to the default direction, and to display the characters corresponding to the codes in a window on the display such that the passage of text is displayed with all portions thereof arranged in respectively-appropriate directions, substantially without reference to language support provided by the operating system or browser. 
   There is further provided, in accordance with another preferred embodiment of the present invention, a computer program product, having computer readable program instructions embodied therein, which instructions cause a computer coupled to drive a display and capable of writing text to the display in a first, default language, normally written in a first direction, and a second language, normally written in a second direction opposite to the first direction, to receive a string of codes, each code corresponding to a character in a passage of text, at least a portion of which passage is in the second language, to display the characters corresponding to the codes in a window on the computer display, and to reverse the order of at least some of the displayed characters, responsive to an order switch invoked by a user of the computer, so that the portion of the passage in the second language is displayed with the characters properly ordered in the second direction. 
   Preferably, the instructions include an applet, most preferably a Java applet. 
   The present invention will be more fully understood from the following detailed description of thereof, taken together with the drawings. 

   
     BRIEF DESCRIPTION OF THE DRAWINGS 
       FIG. 1  is a schematic, pictorial illustration showing a computer used for entry of bi-directional text, in accordance with a preferred embodiment of the present invention; 
       FIG. 2  is a flow chart that schematically illustrates the operation of an applet running on the computer of  FIG. 1 , in accordance with a preferred embodiment of the present invention; 
       FIGS. 3A-3C  are schematic, pictorial illustrations showing successive stages in a method of displaying bi-directional text on a computer, in accordance with a preferred embodiment of the present invention; and 
       FIG. 4  is a flow chart that schematically illustrates the method used in  FIGS. 3A-3C , in accordance with a preferred embodiment of the present invention. 
   

   DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS 
   Reference is now made to  FIG. 1 , which is a schematic, pictorial illustration of a computer  20  used for entry of bi-directional text, in accordance with a preferred embodiment of the present invention. The computer shown and described here is used, by way of example, for entry of English and Hebrew text, but it will be understood that any other language that is written from right to left could be used instead of Hebrew, for example, Arabic or Japanese. Computer  20  includes a display screen  22 , a keyboard  24 , a mouse  25  and a network connection, typically connecting to the Internet using a suitable browser program, as is known in the art. 
   In the present example, computer  20  is typically not equipped with Hebrew National Language Support (NLS), and keyboard  24  has keys  34 ,  36 , etc., which are imprinted with only Latin characters. If a user of the computer wishes to enter Hebrew text, the user invokes a bi-directional support (BIDI) applet, which opens a window  28  on screen  22  in which an image of a bilingual keyboard  26  is displayed. The applet may be resident on computer  20  or read by the computer from tangible media, such as a diskette, or it may be downloaded from a server, typically associated with a Web site  50  with which computer  20  communicates via the network. The user operates keyboard  26  either by pointing to and clicking on keys  38 ,  40 , etc., using mouse  25 , or by depressing the corresponding keys on keyboard  24 . Text generated using keyboard  26 , as described hereinbelow, is displayed on screen  22  in a text window  44 . Preferably, for each text character selected, the applet accesses and displays in the appropriate position in window  44  an image of the character. Such images may be stored and accessed as “GIF” files, for example. Alternatively, the applet uses standard visual fonts (Web fonts), but without the necessity of reconfiguring the browser for this purpose. 
   Preferably, window  28  includes on-screen control facilities for the user. The user selects whether keyboard  26  is to display Hebrew characters, English characters, or other characters, such as symbols, using respective buttons  30 ,  32  and  35 , operated by mouse  25 . Alternatively, the user may switch between the keyboard displays using special keystrokes, for example, &lt;ALT&gt;&lt;SHIFT&gt; to switch between Hebrew and English. When text entry is complete, the user selects a submit button  37  or depresses the &lt;ENTER&gt; key on keyboard  24  to send the text to the server. A configuration control  39  enables the user to set translation parameters, such as the character code set that is used to represent the Hebrew characters sent to the server (ASCII or ISO-8859-8, for example, as are known in the art). 
     FIG. 2  is a flow chart that schematically illustrates operation of the BIDI applet described with reference to  FIG. 1 , in accordance with a preferred embodiment of the present invention. The applet receives each of the keystrokes made on keyboard  24  or, alternatively or additionally, each of the keys selected on keyboard  26 , and stores the keystrokes and/or selections in a buffer in a memory of computer  20 . Whenever submit button  37  is selected or &lt;ENTER&gt; is depressed, the contents of the buffer are translated into the appropriate code string and sent to the server or, alternatively, stored on disk for later use. 
   Assuming that Hebrew operation has been invoked (by selecting button  30 ), each new keystroke or key selection received by the applet causes the corresponding character to be displayed at the left of the last line appearing in window  44 . In order to achieve the desired right-to-left (RTL) display of the Hebrew characters, the keystrokes/selections corresponding to the characters in each line of window  44  are preferably stored in the buffer and sent to the server in reverse order. If English button  32  is selected, the applet begins to enter the characters in normal, forward order, putting each new letter to the right of the preceding English letter, until button  30  is again selected. Numbers are treated similarly to English letters, but special characters, such as punctuation marks, are not. Characters can also be entered, stored and displayed in the middle of a line using on-screen editing methods known in the art. 
   The BIDI applet counts the characters or sums the widths of characters in each line of text, and continues adding characters to that line until it is filled, or until the user invokes a new line (for example, by typing or selecting “\n”). When the applet detects a full line, it breaks the line at whichever one of spaces  48 , between the characters in the line, is closest to the end of the line, which appears at the left side of window  44 . In terms of the keystrokes/selections stored in the buffer, which are written in reverse order, this is the space that is closest to the beginning of the particular line. The applet inserts a line feed code at the end of the line in the buffer (i.e., the beginning of the line displayed on screen). It then continues to store characters, again, in reverse order, in the next line. This process goes on until the user has finished creating a Hebrew (or bilingual) text passage  54 , and then selects button  37  to submit the passage to the server. 
     FIG. 3A  is a schematic, pictorial illustration showing text passage  54 , created in Hebrew, as it might appear on screen  22  of another computer  60  that does not have Hebrew NLS. The passage is shown as having been downloaded to computer  60  from a Web site  52 . Passage  54  appears as nonsense characters on screen  22  due to the lack of Hebrew support on computer  60 . In accordance with a preferred embodiment of the present invention, however, Web site  52  includes HTML code which generates a BIDI window  56  on screen  22 . This window is associated with a BIDI applet, which may be downloaded from site  52  and/or stored on computer  60 , and which converts the nonsense characters into the appropriate Hebrew characters, as described hereinbelow. The BIDI applet is preferably the same one used to generate the Hebrew passage, as described above, but may alternatively be a smaller applet without write capabilities. Although the example illustrated in  FIGS. 3A-3C  relates to the specific text passage  54  shown in  FIG. 1 , window  56  and its associated applet are equally applicable to decoding and displaying standard Hebrew text received from any source. The BIDI window and applet are particularly suited for viewing Web pages that include Hebrew text, whether using logical or visual fonts. 
     FIGS. 3B ,  3 C and  4  illustrate the use of window  56  to convert passage  54  on screen  22  of computer  60  into intelligible Hebrew, in accordance with a preferred embodiment of the present invention.  FIGS. 3B and 3C  are schematic pictorial views of computer  60 .  FIG. 4  is a flow chart that schematically illustrates the operation of the BIDI applet. 
   As shown in  FIG. 3B , in order to read passage  54 , mouse  25  is used to move and size window  56  so as to overlie the passage. Window  56  includes a transparent region  60 , in which the passage can be seen. Alternatively, the mouse is used to select and cut passage  54  and then to paste it into window  56 . The BIDI applet reads the codes of the characters “captured” in region  60  and displays them as Hebrew characters, using graphic representations or a Web font, as described hereinabove. It is noted, however, that the Hebrew letters in passage  54  are still displayed in  FIG. 3B  from left to right, presumably because the passage in site  52  is represented by a logical font, while window  56  is set to receive a visual font, or vice versa. 
   To overcome this problem, mouse  25  is used to select a “switch” button  62  in window  56 , which reverses the order of the Hebrew letters, as shown in  FIG. 3C . Latin characters in the window are not reversed. Passage  54  is now returned to its original, intelligible form. 
   Although computers  20  ( FIG. 1) and 60  ( FIGS. 3A-3C ) are characterized as not having Hebrew NLS in their operating systems or Web browsers, BIDI applets and associated tools such as those described herein may also be used with computers that do have partial or complete NLS. For example, Hebrew window  56  with switch button  62  provides a convenient way for overcoming the problem of viewing Hebrew visual fonts using a browser configured for Hebrew logical fonts, and vice versa. Further applications of the present invention, including applications in support of other languages, will be apparent to those skilled in the art. 
   It will be thus appreciated that the preferred embodiments described above are cited by way of example, and the full scope of the invention is limited only by the claims.