1 /*
2  * Copyright © 2015  Mozilla Foundation.
3  * Copyright © 2015  Google, Inc.
4  *
5  *  This is part of HarfBuzz, a text shaping library.
6  *
7  * Permission is hereby granted, without written agreement and without
8  * license or royalty fees, to use, copy, modify, and distribute this
9  * software and its documentation for any purpose, provided that the
10  * above copyright notice and the following two paragraphs appear in
11  * all copies of this software.
12  *
13  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16  * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
17  * DAMAGE.
18  *
19  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21  * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
22  * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24  *
25  * Mozilla Author(s): Jonathan Kew
26  * Google Author(s): Behdad Esfahbod
27  */
28 
29 #ifndef HB_OT_SHAPE_COMPLEX_USE_PRIVATE_HH
30 #define HB_OT_SHAPE_COMPLEX_USE_PRIVATE_HH
31 
32 #include "hb-private.hh"
33 
34 
35 #include "hb-ot-shape-complex-private.hh"
36 
37 
38 #define USE_TABLE_ELEMENT_TYPE uint8_t
39 
40 /* Cateories used in the Universal Shaping Engine spec:
41  * https://www.microsoft.com/typography/OpenTypeDev/USE/intro.htm
42  */
43 /* Note: This enum is duplicated in the -machine.rl source file.
44  * Not sure how to avoid duplication. */
45 enum use_category_t {
46   USE_O		= 0,	/* OTHER */
47 
48   USE_B		= 1,	/* BASE */
49   USE_IV	= 2,	/* BASE_VOWEL */
50   USE_IND	= 3,	/* BASE_IND */
51   USE_N		= 4,	/* BASE_NUM */
52   USE_GB	= 5,	/* BASE_OTHER */
53   USE_CGJ	= 6,	/* CGJ */
54 //  USE_F		= 7,	/* CONS_FINAL */
55   USE_FM	= 8,	/* CONS_FINAL_MOD */
56 //  USE_M		= 9,	/* CONS_MED */
57 //  USE_CM	= 10,	/* CONS_MOD */
58   USE_SUB	= 11,	/* CONS_SUB */
59   USE_H		= 12,	/* HALANT */
60 
61   USE_HN	= 13,	/* HALANT_NUM */
62   USE_ZWNJ	= 14,	/* Zero width non-joiner */
63   USE_ZWJ	= 15,	/* Zero width joiner */
64   USE_WJ	= 16,	/* Word joiner */
65   USE_Rsv	= 17,	/* Reserved characters */
66   USE_R		= 18,	/* REPHA */
67   USE_S		= 19,	/* SYM */
68 //  USE_SM	= 20,	/* SYM_MOD */
69   USE_VS	= 21,	/* VARIATION_SELECTOR */
70 //  USE_V	= 36,	/* VOWEL */
71 //  USE_VM	= 40,	/* VOWEL_MOD */
72 
73   USE_FAbv	= 24,	/* CONS_FINAL_ABOVE */
74   USE_FBlw	= 25,	/* CONS_FINAL_BELOW */
75   USE_FPst	= 26,	/* CONS_FINAL_POST */
76   USE_MAbv	= 27,	/* CONS_MED_ABOVE */
77   USE_MBlw	= 28,	/* CONS_MED_BELOW */
78   USE_MPst	= 29,	/* CONS_MED_POST */
79   USE_MPre	= 30,	/* CONS_MED_PRE */
80   USE_CMAbv	= 31,	/* CONS_MOD_ABOVE */
81   USE_CMBlw	= 32,	/* CONS_MOD_BELOW */
82   USE_VAbv	= 33,	/* VOWEL_ABOVE / VOWEL_ABOVE_BELOW / VOWEL_ABOVE_BELOW_POST / VOWEL_ABOVE_POST */
83   USE_VBlw	= 34,	/* VOWEL_BELOW / VOWEL_BELOW_POST */
84   USE_VPst	= 35,	/* VOWEL_POST	UIPC = Right */
85   USE_VPre	= 22,	/* VOWEL_PRE / VOWEL_PRE_ABOVE / VOWEL_PRE_ABOVE_POST / VOWEL_PRE_POST */
86   USE_VMAbv	= 37,	/* VOWEL_MOD_ABOVE */
87   USE_VMBlw	= 38,	/* VOWEL_MOD_BELOW */
88   USE_VMPst	= 39,	/* VOWEL_MOD_POST */
89   USE_VMPre	= 23,	/* VOWEL_MOD_PRE */
90   USE_SMAbv	= 41,	/* SYM_MOD_ABOVE */
91   USE_SMBlw	= 42	/* SYM_MOD_BELOW */
92 };
93 
94 HB_INTERNAL USE_TABLE_ELEMENT_TYPE
95 hb_use_get_categories (hb_codepoint_t u);
96 
97 #endif /* HB_OT_SHAPE_COMPLEX_USE_PRIVATE_HH */
98