Mac OS 9
WorldScript.h
Go to the documentation of this file.
1 
19 #ifndef __WORLDSCRIPT__
20 #define __WORLDSCRIPT__
21 
22 #ifndef __MACTYPES__
23 #include <MacTypes.h>
24 #endif
25 
26 #ifndef __TRAPS__
27 #include <Traps.h>
28 #endif
29 
30 #ifndef __QUICKDRAWTEXT__
31 #include <QuickdrawText.h>
32 #endif
33 
34 #if PRAGMA_ONCE
35 #pragma once
36 #endif
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 #if PRAGMA_IMPORT
43 #pragma import on
44 #endif
45 
46 #if PRAGMA_STRUCT_ALIGN
47 #pragma options align = mac68k
48 #elif PRAGMA_STRUCT_PACKPUSH
49 #pragma pack(push, 2)
50 #elif PRAGMA_STRUCT_PACK
51 #pragma pack(2)
52 #endif
53 
54 typedef UInt16 WSIOffset;
55 typedef UInt8 WSIByteCount;
56 typedef UInt8 WSIByteIndex;
57 /* offset from start of sub-table to row in state table */
58 typedef UInt16 WSIStateOffset;
59 typedef UInt32 WSITableOffset;
60 typedef UInt16 WSISubtableOffset;
61 typedef UInt16 WSIGlyphcode;
62 typedef UInt32 WSITableIdentifiers;
63 enum {
64  kScriptSettingsTag = FOUR_CHAR_CODE('info'),
65  kMetamorphosisTag = FOUR_CHAR_CODE('mort'),
66  kGlyphExpansionTag = FOUR_CHAR_CODE('g2g#'),
67  kPropertiesTag = FOUR_CHAR_CODE('prop'),
68  kJustificationTag = FOUR_CHAR_CODE('kash'),
69  kCharToGlyphTag = FOUR_CHAR_CODE('cmap'),
70  kGlyphToCharTag = FOUR_CHAR_CODE('pamc'),
71  kFindScriptRunTag = FOUR_CHAR_CODE('fstb')
72 };
73 
74 /**** L O O K U P T A B L E T Y P E S ****/
75 enum {
76  WSILookupSimpleArray = 0, /* a simple array indexed by glyph code */
77  WSILookupSegmentSingle = 2, /* segment mapping to single value */
78  WSILookupSegmentArray = 4, /* segment mapping to lookup array */
79  WSILookupSingleTable = 6, /* sorted list of glyph, value pairs */
80  WSILookupTrimmedArray = 8 /* a simple trimmed array indexed by glyph code */
81 };
82 
83 typedef unsigned short WSILookupTableFormat;
84 typedef unsigned short WSILookupValue;
85 /* An offset from the beginning of the lookup table */
86 typedef unsigned short WSILookupOffset;
87 /* FORMAT SPECIFIC DEFINITIONS */
95  WSILookupValue
96  lookupValues[1]; /* The array of values indexed by glyph code */
97 };
106  WSIGlyphcode firstGlyph;
107  WSIGlyphcode limitGlyph;
108  WSILookupValue valueArray[1];
109 };
111 /* The format specific part of the subtable header */
113  WSILookupArrayHeader simpleArray; /* rename lookupArray as simpleArray <9> */
114  WSILookupTrimmedArrayHeader trimmedArray;
115 };
117 /* The overall subtable header */
119  WSILookupTableFormat format; /* table format */
120  WSILookupFormatSpecificHeader fsHeader; /* format specific header */
121 };
123 
124 /**** G L Y P H E X P A N S I O N ****/
125 enum {
126  /* fixed 1.0 */
127  kCurrentGlyphExpansionVersion = 0x00010000
128 };
129 
130 typedef unsigned short GlyphExpansionFormats;
131 enum { GlyphExpansionLookupFormat = 1, GlyphExpansionContextualFormat = 2 };
132 
134  WSIByteCount numGlyphs;
135  WSIByteIndex bestGlyph;
136  WSIGlyphcode glyphs[1];
137 };
140  WSIGlyphcode glyph;
141  WSIOffset offset; /* offset to ExpandedGlyphCluster */
142 };
145  WSISubtableOffset stateTableOffset;
146  WSISubtableOffset classTableOffset;
147  WSISubtableOffset
148  actionTableOffset; /* state, class and actions tables follow here... */
149 };
152  Fixed version;
153  short format;
154  short expansionNumer;
155  short expansionDenom; /* num/denom ratio for expansion <2> */
156 
157  union {
158  GlyphExpansionStateTable stateTable;
159  WSILookupTableHeader lookup; /* expanded glyph clusters follow here... */
160  } table;
161 };
163 
164 /* Glyph-to-Character constants and types */
165 enum { kCurrentGlyphToCharVersion = 0x00010100 };
166 
167 typedef unsigned short GlyphToCharLookupFormats;
168 enum {
169  kGlyphToCharLookup8Format = 1,
170  kGlyphToCharLookup16Format = 2,
171  kGlyphToCharLookup32Format = 3
172 };
173 
174 typedef UInt8 GlyphToCharFontIndex;
175 typedef UInt8 QDGlyphcode;
177  WSISubtableOffset fontNameOffset; /* offset relative to this table */
179  actions; /* only support lookupSimpleArray format for now */
180 };
183  short numTables; /* 0..n */
184  WSISubtableOffset offsets[1]; /* offsets from start of action table header */
185 };
188  Fixed version;
189 
190  WSISubtableOffset actionOffset; /* offset to GlyphToCharActionHeader */
191 
192  short format; /* size of font mask */
193  WSILookupTableHeader mappingTable;
194 };
195 typedef struct GlyphToCharHeader GlyphToCharHeader;
196 
197 /* JUSTIFICATION TYPES
198  WorldScript supports justification of text using insertion. The
199  justification table specifies a insertion string to insert between 2
200  specified glyphs. Each combination of inter-glyph boundary can be assigned a
201  justification priority, the higher the priority the more justification
202  strings inserted at that position.
203 
204  The priorities for each inter-glyph boundary are specified by the
205  justification table's state table.
206 
207  Special handling is done for scripts which use spaces to justify, because
208  the width of a space varies depending on the setting of SpaceExtra. This is
209  why the number of spaces per inserting string is specified in the
210  justification table.
211 
212 */
213 enum {
214  /* 1.0 not supported */
215  kCurrentJustificationVersion = 0x0200
216 };
217 
218 enum { kJustificationStateTableFormat = 1 };
219 
220 enum {
221  /* WSI's internal limitation <12> */
222  kMaxJustificationStringLength = 13
223 };
224 
225 typedef UInt8 WSIJustificationPriority;
226 enum { WSIJustificationSetMarkMask = 0x80 };
227 
229  WSIJustificationPriority
230  markPriority; /* non-zero priorities means insertion */
231  WSIJustificationPriority priority;
232  WSIStateOffset newState;
233 };
235 
236 typedef unsigned short WSIJustificationClasses;
237 enum {
238  wsiJustEndOfLineClass = 0,
239  wsiJustEndOfRunClass = 1,
240  wsiJustDeletedGlyphClass = 2,
241  wsiJustUserDefinedClass = 3
242 };
243 
244 typedef unsigned short WSIJustificationStates;
245 enum {
246  wsiStartOfLineState = 0, /* pre-defined states */
247  wsiStartOfRunState = 1,
248  wsiUserDefinedState = 2
249 };
250 
251 /* pre-multiplied: class# * sizeof(WSIJustificationStateEntry) */
252 typedef UInt8 WSIJustificationClassOffset;
254  short maxPriorities;
255  unsigned short rowWidth; /* width of a state table row in bytes */
256  short classTableOffset;
257  short stateTableOffset;
258 };
266  short version;
267  short format;
268 
269  Point scaling; /* numer/denom scaling of priority weights <7> */
270 
271  unsigned short spacesPerInsertion; /* # of $20 chars in justification
272  insertion string <12> */
273  unsigned short justStringOffset; /* offset to justification string */
274 
276  stateTable; /* long-aligned boundary aligned w/ spacesPerInsertion field -
277  justification string follows */
278 };
280 
281 /* Line Layout's Property table version <11> */
282 enum {
283  /* v1.0 */
284  currentPropsTableVersion = 0x00010000
285 };
286 
287 enum {
288  /* version is octal 0100 or hex 0x40 (#64) */
289  kCharToGlyphCurrentVersion = 0x40
290 };
291 
292 /* pass as priorityWeight to JustifyWSILayout to use script's current just
293  * setting */
294 enum { kScriptsDefaultJustWeight = -1 };
295 
296 /* feature selectors used in FindScriptRun and itl5 configuration tables <9> */
297 
298 typedef UInt16 WSIFeatureType;
299 typedef UInt16 WSIFeatureSelector;
300 struct WSIFeature {
301  WSIFeatureType featureType;
302  WSIFeatureSelector featureSelector;
303 };
304 typedef struct WSIFeature WSIFeature;
305 
306 #if PRAGMA_STRUCT_ALIGN
307 #pragma options align = reset
308 #elif PRAGMA_STRUCT_PACKPUSH
309 #pragma pack(pop)
310 #elif PRAGMA_STRUCT_PACK
311 #pragma pack()
312 #endif
313 
314 #ifdef PRAGMA_IMPORT_OFF
315 #pragma import off
316 #elif PRAGMA_IMPORT
317 #pragma import reset
318 #endif
319 
320 #ifdef __cplusplus
321 }
322 #endif
323 
324 #endif /* __WORLDSCRIPT__ */
Basic Macintosh data types.
long Fixed
Definition: MacTypes.h:153
Quickdraw Text Interfaces.
A-Trap constants.
Definition: WorldScript.h:133
Definition: WorldScript.h:139
Definition: WorldScript.h:144
Definition: WorldScript.h:151
Definition: WorldScript.h:182
Definition: WorldScript.h:176
Definition: WorldScript.h:187
Definition: MacTypes.h:520
Definition: WorldScript.h:300
Definition: WorldScript.h:265
Definition: WorldScript.h:228
Definition: WorldScript.h:253
Definition: WorldScript.h:94
Definition: WorldScript.h:118
Definition: WorldScript.h:105
Definition: WorldScript.h:112