summaryrefslogtreecommitdiffstats
path: root/filters/kword/amipro/FileFormat.txt
blob: 15f2003720b7d6fe122059460ddbad60d84f80c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
Lotus AmiPro File Format (NOT FINISHED YET)

Ariya Hidayat <ariyahidayat@yahoo.de>
Last rev: March 16, 2002

1  Foreword
-----------
This is solely based on my reverse-engineering work whilst
I work on AmiPro import filter for KWord.

2  Structure of AmiPro document
-------------------------------
An AmiPro document consists of (in order of appearance):
- header
- content, i.e the text
- embedded objects (frame, image, ...)

3  Formatting
-------------
Basic text formatting, such as bold, italic, and so on is
done inline by enclosing the text in a form of tag (like
HTML tag). A tag is something like: <+$>

The following list summarizes known formmating tags:
  <+!> bold on
  <-!> bold off
  <+"> italic on
  <-"> italic off
  <+#> underline on
  <-#> underline off
  <+)> double underline on
  <-)> double underline off
  <+$> word underline on
  <-$> word underline off
  <+&> superscript on
  <-&> superscript off
  <+'> subscript on
  <-'> subscript off
  <+%> strikethrough on
  <-%> strikethrough off

Note: Word underline is just like underline, except that
spaces between words are not underlined.

Paragraph align is also encoded using tag, here it the list:
  <+@> left alignment
  <+A> right alignment
  <+B> center alignment
  <+C> justified

Linespacing is encoded using tag:
  <:S+-1> single
  <:S+-2> one-and-half
  <:S+-3> double
  <:S+480> custom, 480/20 = 24 pt

Font: tag <:f...>
Example: <:f240,2Arial,255,0,0> means "Arial" font
of size 240/20 = 12 pt, with red color (R=255,G=0,B=0).
Simple tag <:f> means back to default font.

Special characters are escaped or encoded because 
they have special meaning. Known so far: 
   < encoded as <<
   [            <[>
   @            @@
   >            <;>

4  Styles
---------
Styles are defined in the header, precisely in section
[tag]. The format for this section is shown with an
example below:

 [tag]
     Title          style name
     8              shortcut key ("F8")
     [fnt]
         Arial      font family ("Arial")
         360        font size, 360/20 = 18 pt
         0          font color (see below)
         16385      formatting flag (see below)
     [algn]
         4          alignment flag (see below)
         1
         216        indent, 216/20 = 10.8 pt 
         144        first line indent, 144/20 = 7.2 pt
         288        rest indent, 288/20 = 14.4 pt
     [spc]
         33         linespace flag (see below)
         400        custom spacing, 400/20 = 20 pt
         1
         144        space before, 144/20 = 7.2 pt
         72         space after, 72/20 = 3.6 pt
         1
         115        text tightness (90%=tight,115%=loose)
     [brk]
         16         break flag (see below)
     [line]
         8
         0
         1
         0
         1
         1
         1
         10
         10
         1

        [spec]
                0
                1

                0
                1
                1
                0
                0
                0
                0
        [nfmt]
                272
                1
                2
                .
                ,
                </c>
        Title             style followed (see also break flag)
        0
        0


Color Representation:
  bit 0-7   : red 
  bit 8-15  : green
  bit 16-23 : blue

Note about AmiPro flags: although many things are set
per bit, sometimes they are mutually exclusive, e.g
left-aligned vs right-aligned. This must be taken into
consideration.

Formatting flag (16 bit)
  bit 0  : bold
  bit 1  : italic
  bit 2  : underline
  bit 3  : word underline
  bit 4  : all caps
  bit 6  : double underline
  bit 11 : initial caps
  bit 12 : first line bold
  bit 14 & 15 always set (??)

Alignment flag
  bit 0  : left aligned
  bit 1  : right aligned
  bit 2  : centered
  bit 3  : justified
  bit 4  : all indent (left & right)
  bit 9  : hanging indent

Linespace flag
  bit 0  : single
  bit 1  : one-and-half
  bit 2  : double
  bit 3  : custom
  bit 4  : always add in
  bit 5  : add in when not a break

Break flag:
  bit 0  : page break before
  bit 1  : page break after
  bit 2  : allow break within
  bit 3  : keep with previous
  bit 4  : keep with next
  bit 5  :
  bit 6  : specifiy following style
  bit 7  : column break before
  bit 8  : column break after

Styles are applied using the following sequences:
@StyleName@, which put inline (within the text/content).
Normally this appears in beginning of paragraph.

5  Page Layout
-------------
Page layout is defined in section [lay]. Here is the format,
along with an example:

  [lay]
      Standard
      516
      [rght]
          16833     paper height, 16833/20 = 841.65 pt
	  11906     paper width, 11906/20 = 595.3 pt
	  4
	  1440
	  1440
	  1
	  1440
	  1440
	  0
	  1
		0
		1
		0
		2
		1
		1440
		10465
		12


6  Frame, Image, Table
----------------------
still pretty much a mystery :-P

7  Equation
-----------
Equation or mathematical formula is represented in
a language similar to TeX or LaTeX. Each equation is however
put in a separate frame, so it is not really part
of the document. Think of equation as embedded object
within the document.