1/*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation.  Oracle designates this
7 * particular file as subject to the "Classpath" exception as provided
8 * by Oracle in the LICENSE file that accompanied this code.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26/*
27 *
28 * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
29 *
30 */
31
32#ifndef __LETYPES_H
33#define __LETYPES_H
34
35/**
36 * If LE_Standalone is defined, it must exist and contain
37 * definitions for some core ICU defines.
38 */
39#ifdef LE_STANDALONE
40#include "LEStandalone.h"
41#endif
42
43#ifdef LE_STANDALONE
44/* Stand-alone Layout Engine- without ICU. */
45#include "LEStandalone.h"
46#define LE_USE_CMEMORY
47#else
48#if !defined(LE_USE_CMEMORY) && (defined(U_LAYOUT_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION) || defined(U_STATIC_IMPLEMENTATION) || defined(U_COMBINED_IMPLEMENTATION))
49#define LE_USE_CMEMORY
50#endif
51
52#include "unicode/utypes.h"
53
54#ifdef __cplusplus
55#include "unicode/uobject.h"
56#endif
57
58#ifdef LE_USE_CMEMORY
59#include "cmemory.h"
60#endif
61#endif
62
63/*!
64 * \file
65 * \brief Basic definitions for the ICU LayoutEngine
66 */
67
68/**
69 * A type used for signed, 32-bit integers.
70 *
71 * @stable ICU 2.4
72 */
73#ifndef HAVE_LE_INT32
74typedef int32_t le_int32;
75#endif
76
77/**
78 * A type used for unsigned, 32-bit integers.
79 *
80 * @stable ICU 2.4
81 */
82#ifndef HAVE_LE_UINT32
83typedef uint32_t le_uint32;
84#endif
85
86/**
87 * A type used for signed, 16-bit integers.
88 *
89 * @stable ICU 2.4
90 */
91#ifndef HAVE_LE_INT16
92typedef int16_t le_int16;
93#endif
94
95#ifndef HAVE_LE_UINT16
96/**
97 * A type used for unsigned, 16-bit integers.
98 *
99 * @stable ICU 2.4
100 */
101typedef uint16_t le_uint16;
102#endif
103
104#ifndef HAVE_LE_INT8
105/**
106 * A type used for signed, 8-bit integers.
107 *
108 * @stable ICU 2.4
109 */
110typedef int8_t le_int8;
111#endif
112
113#ifndef HAVE_LE_UINT8
114/**
115 * A type used for unsigned, 8-bit integers.
116 *
117 * @stable ICU 2.4
118 */
119typedef uint8_t le_uint8;
120#endif
121
122/**
123* A type used for boolean values.
124*
125* @stable ICU 2.4
126*/
127typedef UBool le_bool;
128
129#ifndef TRUE
130/**
131 * Used for <code>le_bool</code> values which are <code>true</code>.
132 *
133 * @stable ICU 2.4
134 */
135#define TRUE 1
136#endif
137
138#ifndef FALSE
139/**
140 * Used for <code>le_bool</code> values which are <code>false</code>.
141 *
142 * @stable ICU 2.4
143 */
144#define FALSE 0
145#endif
146
147#ifndef NULL
148/**
149 * Used to represent empty pointers.
150 *
151 * @stable ICU 2.4
152 */
153#define NULL 0
154#endif
155
156/**
157 * Used for four character tags.
158 *
159 * @stable ICU 2.4
160 */
161typedef le_uint32 LETag;
162
163/**
164 * Used for 16-bit glyph indices as they're represented
165 * in TrueType font tables.
166 *
167 * @stable ICU 3.2
168 */
169typedef le_uint16 TTGlyphID;
170
171/**
172 * Used for glyph indices. The low-order 16 bits are
173 * the glyph ID within the font. The next 8 bits are
174 * the sub-font ID within a compound font. The high-
175 * order 8 bits are client defined. The LayoutEngine
176 * will never change or look at the client defined bits.
177 *
178 * @stable ICU 3.2
179 */
180typedef le_uint32 LEGlyphID;
181
182/**
183 * Used to mask off the glyph ID part of an LEGlyphID.
184 *
185 * @see LEGlyphID
186 * @stable ICU 3.2
187 */
188#define LE_GLYPH_MASK     0x0000FFFF
189
190/**
191 * Used to shift the glyph ID part of an LEGlyphID
192 * into the low-order bits.
193 *
194 * @see LEGlyphID
195 * @stable ICU 3.2
196 */
197#define LE_GLYPH_SHIFT    0
198
199
200/**
201 * Used to mask off the sub-font ID part of an LEGlyphID.
202 *
203 * @see LEGlyphID
204 * @stable ICU 3.2
205 */
206#define LE_SUB_FONT_MASK  0x00FF0000
207
208/**
209 * Used to shift the sub-font ID part of an LEGlyphID
210 * into the low-order bits.
211 *
212 * @see LEGlyphID
213 * @stable ICU 3.2
214 */
215#define LE_SUB_FONT_SHIFT 16
216
217
218/**
219 * Used to mask off the client-defined part of an LEGlyphID.
220 *
221 * @see LEGlyphID
222 * @stable ICU 3.2
223 */
224#define LE_CLIENT_MASK    0xFF000000
225
226/**
227 * Used to shift the sub-font ID part of an LEGlyphID
228 * into the low-order bits.
229 *
230 * @see LEGlyphID
231 * @stable ICU 3.2
232 */
233#define LE_CLIENT_SHIFT   24
234
235
236/**
237 * A convenience macro to get the Glyph ID part of an LEGlyphID.
238 *
239 * @see LEGlyphID
240 * @stable ICU 3.2
241 */
242#define LE_GET_GLYPH(gid) ((gid & LE_GLYPH_MASK) >> LE_GLYPH_SHIFT)
243
244/**
245 * A convenience macro to get the sub-font ID part of an LEGlyphID.
246 *
247 * @see LEGlyphID
248 * @stable ICU 3.2
249 */
250#define LE_GET_SUB_FONT(gid) ((gid & LE_SUB_FONT_MASK) >> LE_SUB_FONT_SHIFT)
251
252/**
253 * A convenience macro to get the client-defined part of an LEGlyphID.
254 *
255 * @see LEGlyphID
256 * @stable ICU 3.2
257 */
258#define LE_GET_CLIENT(gid) ((gid & LE_CLIENT_MASK) >> LE_CLIENT_SHIFT)
259
260
261/**
262 * A convenience macro to set the Glyph ID part of an LEGlyphID.
263 *
264 * @see LEGlyphID
265 * @stable ICU 3.2
266 */
267#define LE_SET_GLYPH(gid, glyph) ((gid & ~LE_GLYPH_MASK) | ((glyph << LE_GLYPH_SHIFT) & LE_GLYPH_MASK))
268
269/**
270 * A convenience macro to set the sub-font ID part of an LEGlyphID.
271 *
272 * @see LEGlyphID
273 * @stable ICU 3.2
274 */
275#define LE_SET_SUB_FONT(gid, font) ((gid & ~LE_SUB_FONT_MASK) | ((font << LE_SUB_FONT_SHIFT) & LE_SUB_FONT_MASK))
276
277/**
278 * A convenience macro to set the client-defined part of an LEGlyphID.
279 *
280 * @see LEGlyphID
281 * @stable ICU 3.2
282 */
283#define LE_SET_CLIENT(gid, client) ((gid & ~LE_CLIENT_MASK) | ((client << LE_CLIENT_SHIFT) & LE_CLIENT_MASK))
284
285
286/**
287 * Used to represent 16-bit Unicode code points.
288 *
289 * @stable ICU 2.4
290 */
291typedef UChar LEUnicode16;
292
293/**
294 * Used to represent 32-bit Unicode code points.
295 *
296 * @stable ICU 2.4
297 */
298typedef UChar32 LEUnicode32;
299
300#ifndef U_HIDE_DEPRECATED_API
301/**
302 * Used to represent 16-bit Unicode code points.
303 *
304 * @deprecated since ICU 2.4. Use LEUnicode16 instead
305 */
306typedef UChar LEUnicode;
307#endif  /* U_HIDE_DEPRECATED_API */
308
309/**
310 * Used to hold a pair of (x, y) values which represent a point.
311 *
312 * @stable ICU 2.4
313 */
314struct LEPoint
315{
316    /**
317     * The x coordinate of the point.
318     *
319     * @stable ICU 2.4
320     */
321    float fX;
322
323    /**
324     * The y coordinate of the point.
325     *
326     * @stable ICU 2.4
327     */
328    float fY;
329};
330
331#ifndef __cplusplus
332/**
333 * Used to hold a pair of (x, y) values which represent a point.
334 *
335 * @stable ICU 2.4
336 */
337typedef struct LEPoint LEPoint;
338#endif
339
340/**
341 * \def LE_TRACE
342 * @internal
343 */
344#ifndef LE_TRACE
345# define LE_TRACE 0
346#endif
347
348#if LE_TRACE
349# include <stdio.h>
350# define _LETRACE printf("\n%s:%d: LE: ", __FILE__, __LINE__),printf
351#else
352# define _LETRACE 0&&
353#endif
354
355#ifndef U_HIDE_INTERNAL_API
356
357#ifndef LE_ASSERT_BAD_FONT
358#define LE_ASSERT_BAD_FONT 0
359#endif
360
361#if LE_ASSERT_BAD_FONT
362#include <stdio.h>
363#define LE_DEBUG_BAD_FONT(x) fprintf(stderr,"%s:%d: BAD FONT: %s\n", __FILE__, __LINE__, (x));
364#else
365#define LE_DEBUG_BAD_FONT(x)
366#endif
367
368/**
369 * Max value representable by a uintptr
370 */
371
372#ifndef UINT32_MAX
373#define LE_UINT32_MAX 0xFFFFFFFFU
374#else
375#define LE_UINT32_MAX UINT32_MAX
376#endif
377
378#ifndef UINTPTR_MAX
379#define LE_UINTPTR_MAX LE_UINT32_MAX
380#else
381#define LE_UINTPTR_MAX UINTPTR_MAX
382#endif
383
384/**
385 * Range check for overflow
386 */
387#define LE_RANGE_CHECK(type, count, ptrfn) (( (LE_UINTPTR_MAX / sizeof(type)) < count ) ? NULL : (ptrfn))
388/**
389 * A convenience macro to get the length of an array.
390 *
391 * @internal
392 */
393#define LE_ARRAY_SIZE(array) (sizeof array / sizeof array[0])
394
395#ifdef LE_USE_CMEMORY
396/**
397 * A convenience macro for copying an array.
398 *
399 * @internal
400 */
401#define LE_ARRAY_COPY(dst, src, count) uprv_memcpy((void *) (dst), (void *) (src), (count) * sizeof (src)[0])
402
403/**
404 * Allocate an array of basic types. This is used to isolate the rest of
405 * the LayoutEngine code from cmemory.h.
406 *
407 * @internal
408 */
409#define LE_NEW_ARRAY(type, count) (type *)  LE_RANGE_CHECK(type,count,uprv_malloc((count) * sizeof(type)))
410
411/**
412 * Re-allocate an array of basic types. This is used to isolate the rest of
413 * the LayoutEngine code from cmemory.h.
414 *
415 * @internal
416 */
417#define LE_GROW_ARRAY(array, newSize) uprv_realloc((void *) (array), (newSize) * sizeof (array)[0])
418
419 /**
420 * Free an array of basic types. This is used to isolate the rest of
421 * the LayoutEngine code from cmemory.h.
422 *
423 * @internal
424 */
425#define LE_DELETE_ARRAY(array) uprv_free((void *) (array))
426#else
427/* !LE_USE_CMEMORY - Not using ICU memory - use C std lib versions */
428
429#include <stdlib.h>
430#include <string.h>
431
432/**
433 * A convenience macro to get the length of an array.
434 *
435 * @internal
436 */
437#define LE_ARRAY_SIZE(array) (sizeof array / sizeof array[0])
438
439/**
440 * A convenience macro for copying an array.
441 *
442 * @internal
443 */
444#define LE_ARRAY_COPY(dst, src, count) memcpy((void *) (dst), (void *) (src), (count) * sizeof (src)[0])
445
446/**
447 * Allocate an array of basic types. This is used to isolate the rest of
448 * the LayoutEngine code from cmemory.h.
449 *
450 * @internal
451 */
452#define LE_NEW_ARRAY(type, count) LE_RANGE_CHECK(type,count,(type *) malloc((count) * sizeof(type)))
453
454/**
455 * Re-allocate an array of basic types. This is used to isolate the rest of
456 * the LayoutEngine code from cmemory.h.
457 *
458 * @internal
459 */
460#define LE_GROW_ARRAY(array, newSize) realloc((void *) (array), (newSize) * sizeof (array)[0])
461
462 /**
463 * Free an array of basic types. This is used to isolate the rest of
464 * the LayoutEngine code from cmemory.h.
465 *
466 * @internal
467 */
468#define LE_DELETE_ARRAY(array) free((void *) (array))
469
470#endif  /* LE_USE_CMEMORY */
471#endif  /* U_HIDE_INTERNAL_API */
472
473/**
474 * A macro to construct the four-letter tags used to
475 * label TrueType tables, and for script, language and
476 * feature tags in OpenType tables.
477 *
478 * WARNING: THIS MACRO WILL ONLY WORK CORRECTLY IF
479 * THE ARGUMENT CHARACTERS ARE ASCII.
480 *
481 * @stable ICU 3.2
482 */
483#define LE_MAKE_TAG(a, b, c, d) \
484    (((le_uint32)(a) << 24) |   \
485     ((le_uint32)(b) << 16) |   \
486     ((le_uint32)(c) << 8)  |   \
487      (le_uint32)(d))
488
489/**
490 * This enumeration defines constants for the standard
491 * TrueType, OpenType and AAT table tags.
492 *
493 * @stable ICU 3.2
494 */
495enum LETableTags {
496    LE_ACNT_TABLE_TAG = 0x61636E74UL, /**< 'acnt' */
497    LE_AVAR_TABLE_TAG = 0x61766172UL, /**< 'avar' */
498    LE_BASE_TABLE_TAG = 0x42415345UL, /**< 'BASE' */
499    LE_BDAT_TABLE_TAG = 0x62646174UL, /**< 'bdat' */
500    LE_BHED_TABLE_TAG = 0x62686564UL, /**< 'bhed' */
501    LE_BLOC_TABLE_TAG = 0x626C6F63UL, /**< 'bloc' */
502    LE_BSLN_TABLE_TAG = 0x62736C6EUL, /**< 'bsln' */
503    LE_CFF__TABLE_TAG = 0x43464620UL, /**< 'CFF ' */
504    LE_CMAP_TABLE_TAG = 0x636D6170UL, /**< 'cmap' */
505    LE_CVAR_TABLE_TAG = 0x63766172UL, /**< 'cvar' */
506    LE_CVT__TABLE_TAG = 0x63767420UL, /**< 'cvt ' */
507    LE_DSIG_TABLE_TAG = 0x44534947UL, /**< 'DSIG' */
508    LE_EBDT_TABLE_TAG = 0x45424454UL, /**< 'EBDT' */
509    LE_EBLC_TABLE_TAG = 0x45424C43UL, /**< 'EBLC' */
510    LE_EBSC_TABLE_TAG = 0x45425343UL, /**< 'EBSC' */
511    LE_FDSC_TABLE_TAG = 0x66647363UL, /**< 'fdsc' */
512    LE_FEAT_TABLE_TAG = 0x66656174UL, /**< 'feat' */
513    LE_FMTX_TABLE_TAG = 0x666D7478UL, /**< 'fmtx' */
514    LE_FPGM_TABLE_TAG = 0x6670676DUL, /**< 'fpgm' */
515    LE_FVAR_TABLE_TAG = 0x66766172UL, /**< 'fvar' */
516    LE_GASP_TABLE_TAG = 0x67617370UL, /**< 'gasp' */
517    LE_GDEF_TABLE_TAG = 0x47444546UL, /**< 'GDEF' */
518    LE_GLYF_TABLE_TAG = 0x676C7966UL, /**< 'glyf' */
519    LE_GPOS_TABLE_TAG = 0x47504F53UL, /**< 'GPOS' */
520    LE_GSUB_TABLE_TAG = 0x47535542UL, /**< 'GSUB' */
521    LE_GVAR_TABLE_TAG = 0x67766172UL, /**< 'gvar' */
522    LE_HDMX_TABLE_TAG = 0x68646D78UL, /**< 'hdmx' */
523    LE_HEAD_TABLE_TAG = 0x68656164UL, /**< 'head' */
524    LE_HHEA_TABLE_TAG = 0x68686561UL, /**< 'hhea' */
525    LE_HMTX_TABLE_TAG = 0x686D7478UL, /**< 'hmtx' */
526    LE_HSTY_TABLE_TAG = 0x68737479UL, /**< 'hsty' */
527    LE_JUST_TABLE_TAG = 0x6A757374UL, /**< 'just' */
528    LE_JSTF_TABLE_TAG = 0x4A535446UL, /**< 'JSTF' */
529    LE_KERN_TABLE_TAG = 0x6B65726EUL, /**< 'kern' */
530    LE_LCAR_TABLE_TAG = 0x6C636172UL, /**< 'lcar' */
531    LE_LOCA_TABLE_TAG = 0x6C6F6361UL, /**< 'loca' */
532    LE_LTSH_TABLE_TAG = 0x4C545348UL, /**< 'LTSH' */
533    LE_MAXP_TABLE_TAG = 0x6D617870UL, /**< 'maxp' */
534    LE_MORT_TABLE_TAG = 0x6D6F7274UL, /**< 'mort' */
535    LE_MORX_TABLE_TAG = 0x6D6F7278UL, /**< 'morx' */
536    LE_NAME_TABLE_TAG = 0x6E616D65UL, /**< 'name' */
537    LE_OPBD_TABLE_TAG = 0x6F706264UL, /**< 'opbd' */
538    LE_OS_2_TABLE_TAG = 0x4F532F32UL, /**< 'OS/2' */
539    LE_PCLT_TABLE_TAG = 0x50434C54UL, /**< 'PCLT' */
540    LE_POST_TABLE_TAG = 0x706F7374UL, /**< 'post' */
541    LE_PREP_TABLE_TAG = 0x70726570UL, /**< 'prep' */
542    LE_PROP_TABLE_TAG = 0x70726F70UL, /**< 'prop' */
543    LE_TRAK_TABLE_TAG = 0x7472616BUL, /**< 'trak' */
544    LE_VDMX_TABLE_TAG = 0x56444D58UL, /**< 'VDMX' */
545    LE_VHEA_TABLE_TAG = 0x76686561UL, /**< 'vhea' */
546    LE_VMTX_TABLE_TAG = 0x766D7478UL, /**< 'vmtx' */
547    LE_VORG_TABLE_TAG = 0x564F5247UL, /**< 'VORG' */
548    LE_ZAPF_TABLE_TAG = 0x5A617066UL  /**< 'Zapf' */
549};
550
551/**
552 * This enumeration defines constants for all
553 * the common OpenType feature tags.
554 *
555 * @stable ICU 3.2
556 */
557enum LEFeatureTags {
558    LE_AALT_FEATURE_TAG = 0x61616C74UL, /**< 'aalt' */
559    LE_ABVF_FEATURE_TAG = 0x61627666UL, /**< 'abvf' */
560    LE_ABVM_FEATURE_TAG = 0x6162766DUL, /**< 'abvm' */
561    LE_ABVS_FEATURE_TAG = 0x61627673UL, /**< 'abvs' */
562    LE_AFRC_FEATURE_TAG = 0x61667263UL, /**< 'afrc' */
563    LE_AKHN_FEATURE_TAG = 0x616B686EUL, /**< 'akhn' */
564    LE_BLWF_FEATURE_TAG = 0x626C7766UL, /**< 'blwf' */
565    LE_BLWM_FEATURE_TAG = 0x626C776DUL, /**< 'blwm' */
566    LE_BLWS_FEATURE_TAG = 0x626C7773UL, /**< 'blws' */
567    LE_CALT_FEATURE_TAG = 0x63616C74UL, /**< 'calt' */
568    LE_CASE_FEATURE_TAG = 0x63617365UL, /**< 'case' */
569    LE_CCMP_FEATURE_TAG = 0x63636D70UL, /**< 'ccmp' */
570    LE_CJCT_FEATURE_TAG = 0x636A6374UL, /**< 'cjct' */
571    LE_CLIG_FEATURE_TAG = 0x636C6967UL, /**< 'clig' */
572    LE_CPSP_FEATURE_TAG = 0x63707370UL, /**< 'cpsp' */
573    LE_CSWH_FEATURE_TAG = 0x63737768UL, /**< 'cswh' */
574    LE_CURS_FEATURE_TAG = 0x63757273UL, /**< 'curs' */
575    LE_C2SC_FEATURE_TAG = 0x63327363UL, /**< 'c2sc' */
576    LE_C2PC_FEATURE_TAG = 0x63327063UL, /**< 'c2pc' */
577    LE_DIST_FEATURE_TAG = 0x64697374UL, /**< 'dist' */
578    LE_DLIG_FEATURE_TAG = 0x646C6967UL, /**< 'dlig' */
579    LE_DNOM_FEATURE_TAG = 0x646E6F6DUL, /**< 'dnom' */
580    LE_EXPT_FEATURE_TAG = 0x65787074UL, /**< 'expt' */
581    LE_FALT_FEATURE_TAG = 0x66616C74UL, /**< 'falt' */
582    LE_FIN2_FEATURE_TAG = 0x66696E32UL, /**< 'fin2' */
583    LE_FIN3_FEATURE_TAG = 0x66696E33UL, /**< 'fin3' */
584    LE_FINA_FEATURE_TAG = 0x66696E61UL, /**< 'fina' */
585    LE_FRAC_FEATURE_TAG = 0x66726163UL, /**< 'frac' */
586    LE_FWID_FEATURE_TAG = 0x66776964UL, /**< 'fwid' */
587    LE_HALF_FEATURE_TAG = 0x68616C66UL, /**< 'half' */
588    LE_HALN_FEATURE_TAG = 0x68616C6EUL, /**< 'haln' */
589    LE_HALT_FEATURE_TAG = 0x68616C74UL, /**< 'halt' */
590    LE_HIST_FEATURE_TAG = 0x68697374UL, /**< 'hist' */
591    LE_HKNA_FEATURE_TAG = 0x686B6E61UL, /**< 'hkna' */
592    LE_HLIG_FEATURE_TAG = 0x686C6967UL, /**< 'hlig' */
593    LE_HNGL_FEATURE_TAG = 0x686E676CUL, /**< 'hngl' */
594    LE_HWID_FEATURE_TAG = 0x68776964UL, /**< 'hwid' */
595    LE_INIT_FEATURE_TAG = 0x696E6974UL, /**< 'init' */
596    LE_ISOL_FEATURE_TAG = 0x69736F6CUL, /**< 'isol' */
597    LE_ITAL_FEATURE_TAG = 0x6974616CUL, /**< 'ital' */
598    LE_JALT_FEATURE_TAG = 0x6A616C74UL, /**< 'jalt' */
599    LE_JP78_FEATURE_TAG = 0x6A703738UL, /**< 'jp78' */
600    LE_JP83_FEATURE_TAG = 0x6A703833UL, /**< 'jp83' */
601    LE_JP90_FEATURE_TAG = 0x6A703930UL, /**< 'jp90' */
602    LE_KERN_FEATURE_TAG = 0x6B65726EUL, /**< 'kern' */
603    LE_LFBD_FEATURE_TAG = 0x6C666264UL, /**< 'lfbd' */
604    LE_LIGA_FEATURE_TAG = 0x6C696761UL, /**< 'liga' */
605    LE_LJMO_FEATURE_TAG = 0x6C6A6D6FUL, /**< 'ljmo' */
606    LE_LNUM_FEATURE_TAG = 0x6C6E756DUL, /**< 'lnum' */
607    LE_LOCL_FEATURE_TAG = 0x6C6F636CUL, /**< 'locl' */
608    LE_MARK_FEATURE_TAG = 0x6D61726BUL, /**< 'mark' */
609    LE_MED2_FEATURE_TAG = 0x6D656432UL, /**< 'med2' */
610    LE_MEDI_FEATURE_TAG = 0x6D656469UL, /**< 'medi' */
611    LE_MGRK_FEATURE_TAG = 0x6D67726BUL, /**< 'mgrk' */
612    LE_MKMK_FEATURE_TAG = 0x6D6B6D6BUL, /**< 'mkmk' */
613    LE_MSET_FEATURE_TAG = 0x6D736574UL, /**< 'mset' */
614    LE_NALT_FEATURE_TAG = 0x6E616C74UL, /**< 'nalt' */
615    LE_NLCK_FEATURE_TAG = 0x6E6C636BUL, /**< 'nlck' */
616    LE_NUKT_FEATURE_TAG = 0x6E756B74UL, /**< 'nukt' */
617    LE_NUMR_FEATURE_TAG = 0x6E756D72UL, /**< 'numr' */
618    LE_ONUM_FEATURE_TAG = 0x6F6E756DUL, /**< 'onum' */
619    LE_OPBD_FEATURE_TAG = 0x6F706264UL, /**< 'opbd' */
620    LE_ORDN_FEATURE_TAG = 0x6F72646EUL, /**< 'ordn' */
621    LE_ORNM_FEATURE_TAG = 0x6F726E6DUL, /**< 'ornm' */
622    LE_PALT_FEATURE_TAG = 0x70616C74UL, /**< 'palt' */
623    LE_PCAP_FEATURE_TAG = 0x70636170UL, /**< 'pcap' */
624    LE_PNUM_FEATURE_TAG = 0x706E756DUL, /**< 'pnum' */
625    LE_PREF_FEATURE_TAG = 0x70726566UL, /**< 'pref' */
626    LE_PRES_FEATURE_TAG = 0x70726573UL, /**< 'pres' */
627    LE_PSTF_FEATURE_TAG = 0x70737466UL, /**< 'pstf' */
628    LE_PSTS_FEATURE_TAG = 0x70737473UL, /**< 'psts' */
629    LE_PWID_FEATURE_TAG = 0x70776964UL, /**< 'pwid' */
630    LE_QWID_FEATURE_TAG = 0x71776964UL, /**< 'qwid' */
631    LE_RAND_FEATURE_TAG = 0x72616E64UL, /**< 'rand' */
632    LE_RLIG_FEATURE_TAG = 0x726C6967UL, /**< 'rlig' */
633    LE_RPHF_FEATURE_TAG = 0x72706866UL, /**< 'rphf' */
634    LE_RKRF_FEATURE_TAG = 0x726B7266UL, /**< 'rkrf' */
635    LE_RTBD_FEATURE_TAG = 0x72746264UL, /**< 'rtbd' */
636    LE_RTLA_FEATURE_TAG = 0x72746C61UL, /**< 'rtla' */
637    LE_RUBY_FEATURE_TAG = 0x72756279UL, /**< 'ruby' */
638    LE_SALT_FEATURE_TAG = 0x73616C74UL, /**< 'salt' */
639    LE_SINF_FEATURE_TAG = 0x73696E66UL, /**< 'sinf' */
640    LE_SIZE_FEATURE_TAG = 0x73697A65UL, /**< 'size' */
641    LE_SMCP_FEATURE_TAG = 0x736D6370UL, /**< 'smcp' */
642    LE_SMPL_FEATURE_TAG = 0x736D706CUL, /**< 'smpl' */
643    LE_SS01_FEATURE_TAG = 0x73733031UL, /**< 'ss01' */
644    LE_SS02_FEATURE_TAG = 0x73733032UL, /**< 'ss02' */
645    LE_SS03_FEATURE_TAG = 0x73733033UL, /**< 'ss03' */
646    LE_SS04_FEATURE_TAG = 0x73733034UL, /**< 'ss04' */
647    LE_SS05_FEATURE_TAG = 0x73733035UL, /**< 'ss05' */
648    LE_SS06_FEATURE_TAG = 0x73733036UL, /**< 'ss06' */
649    LE_SS07_FEATURE_TAG = 0x73733037UL, /**< 'ss07' */
650    LE_SS08_FEATURE_TAG = 0x73733038UL, /**< 'ss08' */
651    LE_SS09_FEATURE_TAG = 0x73733039UL, /**< 'ss09' */
652    LE_SS10_FEATURE_TAG = 0x73733130UL, /**< 'ss10' */
653    LE_SS11_FEATURE_TAG = 0x73733131UL, /**< 'ss11' */
654    LE_SS12_FEATURE_TAG = 0x73733132UL, /**< 'ss12' */
655    LE_SS13_FEATURE_TAG = 0x73733133UL, /**< 'ss13' */
656    LE_SS14_FEATURE_TAG = 0x73733134UL, /**< 'ss14' */
657    LE_SS15_FEATURE_TAG = 0x73733135UL, /**< 'ss15' */
658    LE_SS16_FEATURE_TAG = 0x73733136UL, /**< 'ss16' */
659    LE_SS17_FEATURE_TAG = 0x73733137UL, /**< 'ss17' */
660    LE_SS18_FEATURE_TAG = 0x73733138UL, /**< 'ss18' */
661    LE_SS19_FEATURE_TAG = 0x73733139UL, /**< 'ss19' */
662    LE_SS20_FEATURE_TAG = 0x73733230UL, /**< 'ss20' */
663    LE_SUBS_FEATURE_TAG = 0x73756273UL, /**< 'subs' */
664    LE_SUPS_FEATURE_TAG = 0x73757073UL, /**< 'sups' */
665    LE_SWSH_FEATURE_TAG = 0x73777368UL, /**< 'swsh' */
666    LE_TITL_FEATURE_TAG = 0x7469746CUL, /**< 'titl' */
667    LE_TJMO_FEATURE_TAG = 0x746A6D6FUL, /**< 'tjmo' */
668    LE_TNAM_FEATURE_TAG = 0x746E616DUL, /**< 'tnam' */
669    LE_TNUM_FEATURE_TAG = 0x746E756DUL, /**< 'tnum' */
670    LE_TRAD_FEATURE_TAG = 0x74726164UL, /**< 'trad' */
671    LE_TWID_FEATURE_TAG = 0x74776964UL, /**< 'twid' */
672    LE_UNIC_FEATURE_TAG = 0x756E6963UL, /**< 'unic' */
673    LE_VALT_FEATURE_TAG = 0x76616C74UL, /**< 'valt' */
674    LE_VATU_FEATURE_TAG = 0x76617475UL, /**< 'vatu' */
675    LE_VERT_FEATURE_TAG = 0x76657274UL, /**< 'vert' */
676    LE_VHAL_FEATURE_TAG = 0x7668616CUL, /**< 'vhal' */
677    LE_VJMO_FEATURE_TAG = 0x766A6D6FUL, /**< 'vjmo' */
678    LE_VKNA_FEATURE_TAG = 0x766B6E61UL, /**< 'vkna' */
679    LE_VKRN_FEATURE_TAG = 0x766B726EUL, /**< 'vkrn' */
680    LE_VPAL_FEATURE_TAG = 0x7670616CUL, /**< 'vpal' */
681    LE_VRT2_FEATURE_TAG = 0x76727432UL, /**< 'vrt2' */
682    LE_ZERO_FEATURE_TAG = 0x7A65726FUL  /**< 'zero' */
683};
684
685/**
686 * @internal
687 */
688enum LEFeatureENUMs {
689  LE_Kerning_FEATURE_ENUM = 0,   /**< Requests Kerning. Formerly LayoutEngine::kTypoFlagKern */
690  LE_Ligatures_FEATURE_ENUM = 1, /**< Requests Ligatures. Formerly LayoutEngine::kTypoFlagLiga */
691  LE_NoCanon_FEATURE_ENUM = 2, /**< Requests No Canonical Processing */
692  LE_CLIG_FEATURE_ENUM,  /**< Feature specific enum */
693  LE_DLIG_FEATURE_ENUM,  /**< Feature specific enum */
694  LE_HLIG_FEATURE_ENUM,  /**< Feature specific enum */
695  LE_LIGA_FEATURE_ENUM,  /**< Feature specific enum */
696  LE_RLIG_FEATURE_ENUM,  /**< Feature specific enum */
697  LE_SMCP_FEATURE_ENUM,  /**< Feature specific enum */
698  LE_FRAC_FEATURE_ENUM,  /**< Feature specific enum */
699  LE_AFRC_FEATURE_ENUM,  /**< Feature specific enum */
700  LE_ZERO_FEATURE_ENUM,  /**< Feature specific enum */
701  LE_SWSH_FEATURE_ENUM,  /**< Feature specific enum */
702  LE_CSWH_FEATURE_ENUM,  /**< Feature specific enum */
703  LE_SALT_FEATURE_ENUM,  /**< Feature specific enum */
704  LE_NALT_FEATURE_ENUM,  /**< Feature specific enum */
705  LE_RUBY_FEATURE_ENUM,  /**< Feature specific enum */
706  LE_SS01_FEATURE_ENUM,  /**< Feature specific enum */
707  LE_SS02_FEATURE_ENUM,  /**< Feature specific enum */
708  LE_SS03_FEATURE_ENUM,  /**< Feature specific enum */
709  LE_SS04_FEATURE_ENUM,  /**< Feature specific enum */
710  LE_SS05_FEATURE_ENUM,  /**< Feature specific enum */
711  LE_SS06_FEATURE_ENUM,  /**< Feature specific enum */
712  LE_SS07_FEATURE_ENUM,   /**< Feature specific enum */
713
714  LE_CHAR_FILTER_FEATURE_ENUM = 31, /**< Apply CharSubstitutionFilter */
715  LE_FEATURE_ENUM_MAX = LE_CHAR_FILTER_FEATURE_ENUM
716};
717
718
719/**
720 * Flags for typographic features.
721 * @internal
722 * @{
723 */
724#define LE_Kerning_FEATURE_FLAG   (1 << LE_Kerning_FEATURE_ENUM)
725#define LE_Ligatures_FEATURE_FLAG (1 << LE_Ligatures_FEATURE_ENUM)
726#define LE_NoCanon_FEATURE_FLAG (1 << LE_NoCanon_FEATURE_ENUM)
727#define LE_CLIG_FEATURE_FLAG (1 << LE_CLIG_FEATURE_ENUM)
728#define LE_DLIG_FEATURE_FLAG (1 << LE_DLIG_FEATURE_ENUM)
729#define LE_HLIG_FEATURE_FLAG (1 << LE_HLIG_FEATURE_ENUM)
730#define LE_LIGA_FEATURE_FLAG (1 << LE_LIGA_FEATURE_ENUM)
731#define LE_RLIG_FEATURE_FLAG (1 << LE_RLIG_FEATURE_ENUM)
732#define LE_SMCP_FEATURE_FLAG (1 << LE_SMCP_FEATURE_ENUM)
733#define LE_FRAC_FEATURE_FLAG (1 << LE_FRAC_FEATURE_ENUM)
734#define LE_AFRC_FEATURE_FLAG (1 << LE_AFRC_FEATURE_ENUM)
735#define LE_ZERO_FEATURE_FLAG (1 << LE_ZERO_FEATURE_ENUM)
736#define LE_SWSH_FEATURE_FLAG (1 << LE_SWSH_FEATURE_ENUM)
737#define LE_CSWH_FEATURE_FLAG (1 << LE_CSWH_FEATURE_ENUM)
738#define LE_SALT_FEATURE_FLAG (1 << LE_SALT_FEATURE_ENUM)
739#define LE_NALT_FEATURE_FLAG (1 << LE_NALT_FEATURE_ENUM)
740#define LE_RUBY_FEATURE_FLAG (1 << LE_RUBY_FEATURE_ENUM)
741#define LE_SS01_FEATURE_FLAG (1 << LE_SS01_FEATURE_ENUM)
742#define LE_SS02_FEATURE_FLAG (1 << LE_SS02_FEATURE_ENUM)
743#define LE_SS03_FEATURE_FLAG (1 << LE_SS03_FEATURE_ENUM)
744#define LE_SS04_FEATURE_FLAG (1 << LE_SS04_FEATURE_ENUM)
745#define LE_SS05_FEATURE_FLAG (1 << LE_SS05_FEATURE_ENUM)
746#define LE_SS06_FEATURE_FLAG (1 << LE_SS06_FEATURE_ENUM)
747#define LE_SS07_FEATURE_FLAG (1 << LE_SS07_FEATURE_ENUM)
748
749#define LE_CHAR_FILTER_FEATURE_FLAG (1 << LE_CHAR_FILTER_FEATURE_ENUM)
750/**
751 * @}
752 */
753
754#define LE_DEFAULT_FEATURE_FLAG (LE_Kerning_FEATURE_FLAG | LE_Ligatures_FEATURE_FLAG) /**< default features */
755
756/**
757 * Error codes returned by the LayoutEngine.
758 *
759 * @stable ICU 2.4
760 */
761#ifndef HAVE_LEERRORCODE
762enum LEErrorCode {
763    /* informational */
764    LE_NO_SUBFONT_WARNING          = U_USING_DEFAULT_WARNING, /**< The font does not contain subfonts. */
765
766    /* success */
767    LE_NO_ERROR                     = U_ZERO_ERROR, /**< No error, no warning. */
768
769    /* failures */
770    LE_ILLEGAL_ARGUMENT_ERROR       = U_ILLEGAL_ARGUMENT_ERROR,  /**< An illegal argument was detected. */
771    LE_MEMORY_ALLOCATION_ERROR      = U_MEMORY_ALLOCATION_ERROR, /**< Memory allocation error. */
772    LE_INDEX_OUT_OF_BOUNDS_ERROR    = U_INDEX_OUTOFBOUNDS_ERROR, /**< Trying to access an index that is out of bounds. */
773    LE_NO_LAYOUT_ERROR              = U_UNSUPPORTED_ERROR,       /**< You must call layoutChars() first. */
774    LE_INTERNAL_ERROR               = U_INTERNAL_PROGRAM_ERROR,  /**< An internal error was encountered. */
775    LE_FONT_FILE_NOT_FOUND_ERROR    = U_FILE_ACCESS_ERROR,       /**< The requested font file cannot be opened. */
776    LE_MISSING_FONT_TABLE_ERROR     = U_MISSING_RESOURCE_ERROR   /**< The requested font table does not exist. */
777};
778#endif
779
780#ifndef __cplusplus
781/**
782 * Error codes returned by the LayoutEngine.
783 *
784 * @stable ICU 2.4
785 */
786typedef enum LEErrorCode LEErrorCode;
787#endif
788
789/**
790 * A convenience macro to test for the success of a LayoutEngine call.
791 *
792 * @stable ICU 2.4
793 */
794#ifndef LE_SUCCESS
795#define LE_SUCCESS(code) (U_SUCCESS((UErrorCode)code))
796#endif
797
798/**
799 * A convenience macro to test for the failure of a LayoutEngine call.
800 *
801 * @stable ICU 2.4
802 */
803#ifndef LE_FAILURE
804#define LE_FAILURE(code) (U_FAILURE((UErrorCode)code))
805#endif
806
807#endif
808