home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / utilities / utilsf / ifftext / FTXT < prev    next >
Text File  |  1993-06-24  |  21KB  |  474 lines

  1. "FTXT" IFF Formatted Text
  2.  
  3. Date:   November 15, 1985
  4. From:   Steve Shaw and Jerry Morrison, Electronic Arts and 
  5.         Bob "Kodiak" Burns, Commodore-Amiga
  6. Status: Draft 2.6
  7.  
  8. DRAFT                 DRAFT             DRAFT               
  9. DRAFT                 DRAFT             DRAFT   
  10.  
  11. 1. Introduction
  12.  
  13. This memo is the IFF supplement for FORM FTXT. An FTXT is an IFF "data 
  14. section" or "FORM type" which can be an IFF file or a part of one containing 
  15. a stream of text plus optional formatting information."EA IFF 85" 
  16. is Electronic Arts' standard for interchange format files. (See the 
  17. IFF reference.)
  18.  
  19. An FTXT is an archival and interchange representation designed for 
  20. three uses. The simplest use is for a "console device" or "glass teletype" 
  21. (the minimal 2-D text layout means): a stream of "graphic" ("printable") 
  22. characters plus positioning characters "space" ("SP") and line terminator 
  23. ("LF"). This is not intended for cursor movements on a screen although 
  24. it does not conflict with standard cursor-moving characters. The second 
  25. use is text that has explicit formatting information (or "looks") 
  26. such as font family and size, typeface, etc. The third use is as the 
  27. lowest layer of a structured document that also has "inherited" styles 
  28. to implicitly control character looks. For that use, FORMs FTXT would 
  29. be embedded within a future document FORM type. The beauty of FTXT 
  30. is that these three uses are interchangeable, that is, a program written 
  31. for one purpose can read and write the others' files. So a word processor 
  32. does not have to write a separate plain text file to communicate with 
  33. other programs.
  34.  
  35. Text is stored in one or more "CHRS" chunks inside an FTXT. Each CHRS 
  36. contains a stream of 8-bit text compatible with ISO and ANSI data 
  37. interchange standards. FTXT uses just the central character set from 
  38. the ISO/ANSI standards. (These two standards are henceforth called 
  39. "ISO/ANSI" as in "see the ISO/ANSI reference".)
  40.  
  41. Since it's possible to extract just the text portions from future 
  42. document FORM types, programs can exchange data without having to 
  43. save both plain text and formatted text representations.
  44.  
  45. Character looks are stored as embedded control sequences within CHRS 
  46. chunks. This document specifies which class of control sequences to 
  47. use: the CSI group. This document does not yet specify their meanings, 
  48. e.g. which one means "turn on italic face". Consult ISO/ANSI.
  49.  
  50. Section 2 defines the chunk types character stream "CHRS" and font 
  51. specifier "FONS". These are the "standard" chunks. Specialized chunks 
  52. for private or future needs can be added later. Section 3 outlines 
  53. an FTXT reader program that strips a document down to plain unformatted 
  54. text. Appendix A is a code table for the 8-bit ISO/ANSI character 
  55. set used here. Appendix B is an example FTXT shown as a box diagram. 
  56. Appendix C is a racetrack diagram of the syntax of ISO/ANSI control 
  57. sequences.
  58.  
  59.  
  60. Reference:
  61.  
  62. Amiga[tm] is a trademark of Commodore-Amiga, Inc.
  63.  
  64. Electronic Arts[tm] is a trademark of Electronic Arts.
  65.  
  66. IFF: "EA IFF 85" Standard for Interchange Format Files describes the 
  67. underlying conventions for all IFF files.
  68.  
  69. ISO/ANSI: ISO/DIS 6429.2 and ANSI X3.64-1979. International Organization 
  70. for Standardization (ISO) and American National Standards Institute 
  71. (ANSI) data-interchange standards. The relevant parts of these two 
  72. standards documents are identical. ISO standard 2022 is also relevant.
  73.  
  74.  
  75. 2. Standard Data and Property Chunks
  76.  
  77. The main contents of a FORM FTXT is in its character stream "CHRS" 
  78. chunks. Formatting property chunks may also appear. The only formatting 
  79. property yet defined is "FONS", a font specifier. A FORM FTXT with 
  80. no CHRS represents an empty text stream. A FORM FTXT may contain nested 
  81. IFF FORMs, LISTs, or CATs, although a "stripping" reader (see section 
  82. 3) will ignore them.
  83.  
  84. Character Set
  85.  
  86. FORM FTXT uses the core of the 8-bit character set defined by the 
  87. ISO/ANSI standards cited at the start of this document. (See Appendix 
  88. A for a character code table.) This character set is divided into 
  89. two "graphic" groups plus two "control" groups. Eight of the control 
  90. characters begin ISO/ANSI standard control sequences. (See "Control 
  91. Sequences", below.) Most control sequences and control characters 
  92. are reserved for future use and for compatibility with ISO/ANSI. Current 
  93. reader programs should skip them.
  94.  
  95. %       C0 is the group of control characters in the range NUL (hex 
  96. 0) through hex 1F. Of these, only LF (hex 0A) and ESC (hex 1B) are 
  97. significant. ESC begins a control sequence. LF is the line terminator, 
  98. meaning "go to the first horizontal position of the next line". All 
  99. other C0 characters are not used. In particular, CR (hex 0D) is not 
  100. recognized as a line terminator.
  101.  
  102. %       G0 is the group of graphic characters in the range hex 20 through 
  103. hex 7F. SP (hex 20) is the space character. DEL (hex 7F) is the delete 
  104. character which is not used. The rest are the standard ASCII printable 
  105. characters "!" (hex 21) through "~" (hex 7E).
  106.  
  107. %       C1 is the group of extended control characters in the range 
  108. hex 80 through hex 9F. Some of these begin control sequences. The 
  109. control sequence starting with CSI (hex 9B) is used for FTXT formatting. 
  110. All other control sequences and C1 control characters are unused.
  111.  
  112. %       G1 is the group of extended graphic characters in the range 
  113. NBSP (hex A0) through "X" (hex FF). It is one of the alternate graphic 
  114. groups proposed for ISO/ANSI standardization.
  115.  
  116. Control Sequences
  117.  
  118. Eight of the control characters begin ISO/ANSI standard "control sequences" 
  119. (or "escape sequences"). These sequences are described below and diagrammed 
  120. in Appendix C.
  121.  
  122. G0      ::= (SP through DEL)
  123. G1      ::= (NBSP through "X")
  124.  
  125. ESC-Seq ::= ESC (SP through "/")* ("0" through "~")
  126. ShiftToG2       ::= SS2 G0
  127. ShiftToG3       ::= SS3 G0
  128. CSI-Seq ::= CSI (SP through "?")* ("@" through "~")
  129. DCS-Seq ::= (DCS | OSC | PM | APC) (SP through "~" | G1)* ST
  130.  
  131. "ESC-Seq" is the control sequence ESC (hex 1B), followed by zero or 
  132. more characters in the range SP through "/S (hex 20 through hex 2F), 
  133. followed by a character in the range "0" through "~" (hex 30 through 
  134. hex 7E). These sequences are reserved for future use and should be 
  135. skipped by current FTXT reader programs.
  136.  
  137. SS2 (hex 8E) and SS3 (hex 8F) shift the single following G0 character 
  138. into yet-to-be-defined graphic sets G2 and G3, respectively. These 
  139. sequences should not be used until the character sets G2 and G3 are 
  140. standardized. A reader may simply skip the SS2 or SS3 (taking the 
  141. following character as a corresponding G0 character) or replace the 
  142. two-character sequence with a character like "?" to mean "absent".
  143.  
  144. FTXT uses "CSI-Seq" control sequences to store character formatting 
  145. (font selection by number, type face, and text size) and perhaps layout 
  146. information (position and rotation). "CSI-Seq" control sequences start 
  147. with CSI (the "control sequence introducer", hex 9B). Syntactically, 
  148. the sequence includes zero or more characters in the range SP through 
  149. "?" (hex 20 through hex 3F) and a concluding character in the range 
  150. "@" through "~" (hex 40 through hex 7E). These sequences may be skipped 
  151. by a minimal FTXT reader, i.e. one that ignores formatting information.
  152.  
  153. Note: A future FTXT standardization document will explain the uses 
  154. of CSI-Seq sequences for setting character face (light weight vs. 
  155. medium vs. bold, italic vs. upright, height, pitch, position, and 
  156. rotation). For now, consult the ISO/ANSI references.
  157.  
  158. "DCS-Seq" is the control sequences starting with DCS (hex 90), OSC 
  159. (hex 9D), PM (hex 9E), or APC (hex 9F), followed by zero or more characters 
  160. each of which is in the range SP through "~" (hex 20 through hex 7E) 
  161. or else a G1 character, and terminated by an ST (hex 9C). These sequences 
  162. are reserved for future use and should be skipped by current FTXT 
  163. reader programs.
  164.  
  165. Data Chunk CHRS
  166.  
  167. A CHRS chunk contains a sequence of 8-bit characters abiding by the 
  168. ISO/ANSI standards cited at the start of this document. This includes 
  169. the character set and control sequences as described above and summarized 
  170. in Appendicies A and C.
  171.  
  172. A FORM FTXT may contain any number of