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_IND	= 3,	/* BASE_IND */
50   USE_N		= 4,	/* BASE_NUM */
51   USE_GB	= 5,	/* BASE_OTHER */
52   USE_CGJ	= 6,	/* CGJ */
53 //  USE_F		= 7,	/* CONS_FINAL */
54   USE_FM	= 8,	/* CONS_FINAL_MOD */
55 //  USE_M		= 9,	/* CONS_MED */
56 //  USE_CM	= 10,	/* CONS_MOD */
57   USE_SUB	= 11,	/* CONS_SUB */
58   USE_H		= 12,	/* HALANT */
59 
60   USE_HN	= 13,	/* HALANT_NUM */
61   USE_ZWNJ	= 14,	/* Zero width non-joiner */
62   USE_ZWJ	= 15,	/* Zero width joiner */
63   USE_WJ	= 16,	/* Word joiner */
64   USE_Rsv	= 17,	/* Reserved characters */
65   USE_R		= 18,	/* REPHA */
66   USE_S		= 19,	/* SYM */
67 //  USE_SM	= 20,	/* SYM_MOD */
68   USE_VS	= 21,	/* VARIATION_SELECTOR */
69 //  USE_V	= 36,	/* VOWEL */
70 //  USE_VM	= 40,	/* VOWEL_MOD */
71 
72   USE_FAbv	= 24,	/* CONS_FINAL_ABOVE */
73   USE_FBlw	= 25,	/* CONS_FINAL_BELOW */
74   USE_FPst	= 26,	/* CONS_FINAL_POST */
75   USE_MAbv	= 27,	/* CONS_MED_ABOVE */
76   USE_MBlw	= 28,	/* CONS_MED_BELOW */
77   USE_MPst	= 29,	/* CONS_MED_POST */
78   USE_MPre	= 30,	/* CONS_MED_PRE */
79   USE_CMAbv	= 31,	/* CONS_MOD_ABOVE */
80   USE_CMBlw	= 32,	/* CONS_MOD_BELOW */
81   USE_VAbv	= 33,	/* VOWEL_ABOVE / VOWEL_ABOVE_BELOW / VOWEL_ABOVE_BELOW_POST / VOWEL_ABOVE_POST */
82   USE_VBlw	= 34,	/* VOWEL_BELOW / VOWEL_BELOW_POST */
83   USE_VPst	= 35,	/* VOWEL_POST	UIPC = Right */
84   USE_VPre	= 22,	/* VOWEL_PRE / VOWEL_PRE_ABOVE / VOWEL_PRE_ABOVE_POST / VOWEL_PRE_POST */
85   USE_VMAbv	= 37,	/* VOWEL_MOD_ABOVE */
86   USE_VMBlw	= 38,	/* VOWEL_MOD_BELOW */
87   USE_VMPst	= 39,	/* VOWEL_MOD_POST */
88   USE_VMPre	= 23,	/* VOWEL_MOD_PRE */
89   USE_SMAbv	= 41,	/* SYM_MOD_ABOVE */
90   USE_SMBlw	= 42,	/* SYM_MOD_BELOW */
91   USE_CS	= 43	/* CONS_WITH_STACKER */
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