1、ECMA Technical Report TR/532ndEdition - June 1992Standardizing Information and Communication SystemsPhone: +41 22 849.60.00 - Fax: +41 22 849.60.01 - URL: http:/www.ecma.ch - Internet: helpdeskecma.chHandling of Bi-Directional Texts.ECMA Technical Report TR/53June 1992Standardizing Information and C
2、ommunication SystemsPhone: +41 22 849.60.00 - Fax: +41 22 849.60.01 - URL: http:/www.ecma.ch - Internet: helpdeskecma.chMB Tr-53.doc 01-07-98 16,06Handling of Bi-Directional Texts.Brief HistoryIn April 1988, ECMA TC1 decided to produce a Technical Report on specific control functions required for pr
3、esentation oftexts in scripts using different writing directions.The requirement for such control functions resulted from ECMA activities in the area of coding of bilingual character sets suchas Latin/Arabic and Latin/Hebrew. The control functions were to provide for the proper presentation of bi-di
4、rectional texts oncharacter imaging devices.An ECMA TC1 ad-hoc group was formed and instructed:G01 to establish the new additional control functions required in Standard ECMA-48 for handling bi-directional texts;G01 to determine the required modifications to existing control functions in Standard EC
5、MA-48 for handling bi-directional texts;G01 prepare the necessary explanatory information for inclusion in Standard ECMA-48;G01 to provide worked examples for the handling of bi-directional text, applying the new and the modified controlfunctions described in this ECMA Technical Report and included
6、in the fifth edition of Standard ECMA-48;G01 to consider in particular a horizontal line orientation and a top-to-bottom line progression.This ECMA Technical Report explains the particularities to be considered when handling bi-directional texts. It is alsointended to be used as a guidance to implem
7、entors of bi-directional text applications in a character-coded environment.This ECMA Technical Report was used as the basis for making the necessary enhancements and changes to StandardECMA-48. The changes in and the additions to Standard ECMA-48 are also reflected in the latest edition of the corr
8、espondingInternational Standard, viz. ISO/IEC 6429:1992.Adopted as an ECMA Technical Report by the General Assembly of June 1992.- i -Table of contents1 Scope 12 General Considerations 13 References 14 Notations and definitions 14.1 Notation 14.2 Definitions 15 Requirements for the handling of bi-di
9、rectional texts 25.1 Directions of strings 25.2 Ordering of data 25.3 Transparency 26 The bi-directional device model 26.1 The device structure 26.1.1 The input component 36.1.2 The data component 36.1.3 The presentation component 36.1.4 The graphic image output 46.2 Relationship between the active
10、data position and the active presentation position 46.3 Movement of the active positions 46.3.1 Implicit movement 56.3.2 Explicit movement 56.3.3 Indirect movement 56.4 Data stream and data organization 66.5 Areas, fields and tabulation 66.5.1 Areas 66.5.2 Fields and tabulation 66.6 Simplified prese
11、ntation of the device model 77 The changes and additions made to Standard ECMA-48 87.1 New modes for handling bi-directionality 87.2 Control functions added for handling bi-directionality 97.3 Control functions modified for handling bi-directionality 98 Levels of device support for bi-directionality
12、 118.1 Bi-directional devices with presentation component and data component 118.2 Bi-directional devices with presentation component only 11Annex A Worked examples 14- ii -.1ScopeThis ECMA Technical Report specifies technical means to handle bi-directional text in character-imaging devices inthe ca
13、se of:G01 texts in a single script of which specific parts need to be presented in an opposite direction (for example,numbers in Arabic or Hebrew);G01 texts in different scripts presented in opposite directions (like Latin and Arabic or Latin and Hebrew);G01 texts presented with a horizontal line or
14、ientation and a top-to-bottom line progression.Other presentation directions may be the subject of further studies.2 General ConsiderationsIn this ECMA Technical Report a bi-directional device model is used to explain the handling of bi-directional texts. Tobe able to use the device model with Stand
15、ard ECMA-48 the following modifications to that Standard were necessary:G01 the device concept had to be extended;G01 two new modes had to be added;G01 a set of new control functions had to be included;G01 the definitions of a number of existing control functions had to be changed.The fifth edition
16、of Standard ECMA-48 includes the appropriate changes and additions.The control functions are intended to be used imbedded in character coded data for interchange with character imaginginput/output devices that are capable of handling bi-directional texts.The architecture of such devices is reflected
17、 by the bi-directional device model described in 6.The method for the coded representation of the new bi-directional control functions is identical with that already usedin Standard ECMA-48.The technical capabilities of the bi-directional devices to which this Technical Report and the extended speci
18、ficationsof the fifth edition of Standard ECMA-48 apply, can vary according to the levels of bi-directional support which isrequired or provided. Different bi-directional technical means may, therefore, be selected for implementation,depending on the particularities of the specific application.3 Ref
19、erencesECMA-48 Control functions for coded character sets (1991);ISO/IEC 6429:1992 Information technology - Control functions for coded character sets.4 Notations and definitions4.1 NotationIn this ECMA Technical Report the same convention as in Standard ECMA-48 has been adopted to assist thereader.
20、 Capital letters are used to refer to a specific control function, mode, mode setting, or graphic character inorder to avoid confusion, for example, between the concept “space“ and the graphic character SPACE.It is intended that this convention and the acronyms of the modes and the control functions
21、 be retained in alltranslations of the text.4.2 DefinitionsIn this ECMA Technical Report the same definitions as in the fifth edition of Standard ECMA-48 apply.- 2 -5 Requirements for the handling of bi-directional textsMany languages, like the languages using the Latin script, are written and read
22、from left-to-right. Other languages,such as Arabic and Hebrew, are written and read mainly from right-to-left; numbers in these languages, for instance,are written and read from left-to-right. Finally, texts of languages with opposite presentation directions can beintermixed.As a consequence, bi-dir
23、ectional character-imaging devices have to provide support:G01 for both left-to-right and right-to-left presentation directions;G01 for text with embedded (nested) sections of texts with left-to-right and right-to-left presentation directions.5.1 Directions of stringsMany graphic characters have an
24、inherent directionality. Others have no inherent directionality and abide bycontext. Examples of both types of the graphic characters in question are: Space, punctuation marks, separators,parentheses, and others.In order to fully specify the directionality of a string of text constituted of graphic
25、characters with and graphiccharacters without inherent directionality, control functions need to be imbedded in the text string.Another requirement is to support some presentation variants which depend on the direction of the presented textstring: italicized characters, for instance, are right-slant
26、ing for strings running from left-to-right, and left-slanting forstrings running from right-to-left.5.2 Ordering of dataThe order in which the graphic characters in a string of a bi-directional text (data stream) are interchanged maydiffer from the order in which the graphic characters are presented
27、 in the graphic image output. For example, “hello“may be presented as “olleh“ on a right-to-left device.These cases, and all their consequences must be handled as part of a bi-directional support.5.3 TransparencyApplications that are designed to handle bi-directional data streams can fully control t
28、he functionality of a bi-directional device. Such applications are called “bi-directionality-aware“ applications.On the other hand, there is a need to allow applications not designed to handle bi-directional data streams tofunction reasonably well in a bi-directional environment, making this environ
29、ment “transparent“ to the application.Such applications are called “bi-directionality-unaware“ applications.6 The bi-directional device modelTo explain the requirements for and the methods of handling bi-directional texts, a device model is defined in thisECMA Technical Report. This model was also u
30、sed to extend the uni-directional device concepts defined in earliereditions of Standard ECMA-48.Different devices complying with the model are represented schematically in figures 1 to 3 in 6.6.A character-imaging device, according to the bi-directional device model, is a device which is capable of
31、 receiving adata stream consisting of graphic characters and control functions and which is capable of producing a graphic imageoutput from the received information. The graphic image output must be readable by a human being according to theapplicable traditional writing conventions such as left-to-
32、right, right-to-left, top-to-bottom and bottom-to-top. Thegraphic image output is, in general, produced in the form of one or more rectangular arrays of character positions andlines which are called pages.In addition to receiving a data stream, a character-imaging device may also be capable of trans
33、mitting a data streamconsisting of graphic characters and control functions. The transmitted data stream is, in general, composed of acombination of data which have been sent to the device and data which have been entered locally into the device, forexample by an associated keyboard.6.1 The device s
34、tructureA uni-directional device as referred to in this ECMA Technical Report is shown in figure 1.- 3 -A bi-directional device as described in this model consists of eitherG01 an input component, a data component, a presentation component, and a graphic image output as shownin figure 2, orG01 an in
35、put component, a presentation component only, and a graphic image output as depicted in figure 3.6.1.1 The input componentThe input component is used for receiving the data stream. In addition, the input component may receive datafrom a manual input device such as a keyboard or a mouse.This ECMA Tec
36、hnical Report does not deal with the input component.6.1.2 The data componentThe data component is used to store the information received from the input component and to make it availableto a presentation process that transforms the information for the presentation component for subsequent graphicim
37、age output. A data component is generally not provided in uni-directional devices.The data component structures the information in successive lines; each line consisting of successive characterpositions.The lines in the data component convey the organizational aspects of the information. In the data
38、 componentlines have no orientation; to simplify matters their orientation is considered to be horizontal only.The sequential order of the lines is called the line progression. In the data component the line progression isconsidered to be from top-to-bottom only. The lines are counted in the directi
39、on of the line progression and arenumbered consecutively by the numbers 1, 2, 3 .The sequential order of the character positions along a line in the data component is called the characterprogression. The character progression is considered to be from left-to-right only. The character positions along
40、 aline are counted in the direction of the character progression and are numbered consecutively by the numbers 1,2, 3 .At any time there is a unique character position in the data component which is available for the next graphiccharacter or relative to which certain control functions are to be exec
41、uted. This character position is called theactive data position. The active data position can be moved implicitly or explicitly or indirectly.The line in the data component containing the active data position is called the active data line, the field in thedata component containing the active data p
42、osition is called the active data field, the area in the data componentcontaining the active data position is called the active data area, the page in the data component containing theactive data position is called the active data page.6.1.3 The presentation componentThe presentation component is us
43、ed for receiving the information from the data component through thepresentation process and for producing the graphic image output. This output may, for example, be rendered on adisplay or a printer. A presentation component is provided in bi-directional as well as in uni-directional devices.The pr
44、esentation component structures the information into successive lines; each line consisting of successivecharacter positions.The lines in the presentation component convey the graphic image output aspects and their orientation can beconsidered to be either horizontal or vertical. This ECMA Technical
45、 Report deals only with horizontal lineorientation.The sequential order of the lines is called the line progression. The lines are counted in the direction of the lineprogression and are numbered consecutively by the numbers 1, 2, 3 . For horizontal line orientation thedirection of the line progress
46、ion can be considered to be either from top-to-bottom or from bottom-to-top. ThisECMA Technical Report deals only with the line progression from top-to-bottom.The sequential order of the character positions along a line in the presentation component is called the characterpath. For horizontal line o
47、rientation the character path can be either from left-to-right or from right-to-left. Thecharacter positions along a line are counted in the direction of the character path and are numbered consecutivelyby the numbers 1, 2, 3 .- 4 -At any time there is a unique character position in the presentation
48、 component which is available for the nextgraphic character or relative to which certain control functions are to be executed. This character position iscalled the active presentation position. The active presentation position can be moved implicitly or indirectly. Inthe case where a device has no d
49、ata component, the active presentation position can also be moved implicitly. Itis common practice to mark the active presentation position in a graphic image output by a special visibleindicator called the cursor.The line in the presentation component containing the active presentation position is called the activepresentation line, the field in the presentation component containing the active presentation position is called theactive presentation field, the area in the presentation component containing the active presentation position iscalled the active presentation area, the page i